piobject metasystem memory and performance optimization
This commit is contained in:
@@ -385,6 +385,7 @@
|
||||
# define __PTYPE(t) __PIVariantTypeInfo__<t>::PureType
|
||||
#endif
|
||||
#define __VVALUE(t, v) v.value< __PTYPE(t) >()
|
||||
#define __PIOBJECT_MAX_ARGS__ 4
|
||||
|
||||
|
||||
#define PIOBJECT(name) \
|
||||
@@ -392,6 +393,7 @@
|
||||
typedef name __PIObject__; \
|
||||
public: \
|
||||
static const PIString __classNameS() {static PIString ret = PIStringAscii(#name); return ret;} \
|
||||
static const char * __classNameCC() {return #name;} \
|
||||
static uint __classNameIDS() {static uint ret = PIStringAscii(#name).hash(); return ret;} \
|
||||
virtual const char * className() const {return #name;} \
|
||||
virtual uint classNameID() const {static uint ret = PIStringAscii(#name).hash(); return ret;} \
|
||||
@@ -411,7 +413,7 @@
|
||||
__MetaData & eh(__meta_data()[id]); \
|
||||
eh.eh_set << ehp.eh_set; \
|
||||
eh.eh_func << ehp.eh_func; \
|
||||
eh.addScope(__classNameS(), id); \
|
||||
eh.addScope(__classNameCC(), id); \
|
||||
} \
|
||||
}; \
|
||||
__BaseInitializer__ __base_init__;
|
||||
@@ -431,7 +433,7 @@
|
||||
eh.eh_func << ehp.eh_func; \
|
||||
eh.scope_id = ehp.scope_id; \
|
||||
eh.scope_list = ehp.scope_list; \
|
||||
eh.addScope(__classNameS(), id); \
|
||||
eh.addScope(__classNameCC(), id); \
|
||||
} \
|
||||
}; \
|
||||
__ParentInitializer__ __parent_init__; \
|
||||
@@ -443,92 +445,61 @@
|
||||
#define PIOBJECT_SUBCLASS(name, parent) PIOBJECT(name) PIOBJECT_PARENT(parent)
|
||||
|
||||
|
||||
#define __EH_INIT_BASE__(ret, name) \
|
||||
PIMutexLocker ml(__meta_mutex()); \
|
||||
__MetaData & eh(__meta_data()[__classNameIDS()]); \
|
||||
if (eh.eh_set[fp]) return; \
|
||||
eh.eh_set << fp; \
|
||||
__MetaFunc & f(eh.eh_func[fp]); \
|
||||
f.scope = __classNameCC(); \
|
||||
f.__setFuncName(#name); \
|
||||
f.addr = fp; \
|
||||
f.addrV = fpV; \
|
||||
f.type_ret = #ret;
|
||||
|
||||
#define EH_INIT0(ret, name) \
|
||||
STATIC_INITIALIZER_BEGIN \
|
||||
PIMutexLocker ml(__meta_mutex()); \
|
||||
__MetaData & eh(__meta_data()[__classNameIDS()]); \
|
||||
void * fp = (void*)(ret(*)(void*))__stat_eh_##name##__; \
|
||||
void * fpV = fp; \
|
||||
if (eh.eh_set[fp]) return; \
|
||||
eh.eh_set << fp; \
|
||||
__MetaFunc & f(eh.eh_func[fp]); \
|
||||
f.scope = __classNameS(); \
|
||||
f.func_name = PIStringAscii(#name); \
|
||||
f.addr = fp; \
|
||||
f.addrV = fpV; \
|
||||
f.type_ret = PIStringAscii(#ret); \
|
||||
__EH_INIT_BASE__(ret, name) \
|
||||
STATIC_INITIALIZER_END
|
||||
|
||||
#define EH_INIT1(ret, name, a0, n0) \
|
||||
STATIC_INITIALIZER_BEGIN \
|
||||
PIMutexLocker ml(__meta_mutex()); \
|
||||
__MetaData & eh(__meta_data()[__classNameIDS()]); \
|
||||
void * fp = (void*)(ret(*)(void*, a0))__stat_eh_##name##__; \
|
||||
void * fpV = (void*)(ret(*)(void*, const PIVariantSimple &))__stat_eh_v_##name##__; \
|
||||
if (eh.eh_set[fp]) return; \
|
||||
eh.eh_set << fp; \
|
||||
__MetaFunc & f(eh.eh_func[fp]); \
|
||||
f.scope = __classNameS(); \
|
||||
f.func_name = PIStringAscii(#name); \
|
||||
f.addr = fp; \
|
||||
f.addrV = fpV; \
|
||||
f.type_ret = PIStringAscii(#ret); \
|
||||
f.types << PIObject::simplifyType(#a0); \
|
||||
f.names << PIStringAscii(#n0); \
|
||||
__EH_INIT_BASE__(ret, name) \
|
||||
f.__addArgument(#a0, #n0); \
|
||||
STATIC_INITIALIZER_END
|
||||
|
||||
#define EH_INIT2(ret, name, a0, n0, a1, n1) \
|
||||
STATIC_INITIALIZER_BEGIN \
|
||||
PIMutexLocker ml(__meta_mutex()); \
|
||||
__MetaData & eh(__meta_data()[__classNameIDS()]); \
|
||||
void * fp = (void*)(ret(*)(void*, a0, a1))__stat_eh_##name##__; \
|
||||
void * fpV = (void*)(ret(*)(void*, const PIVariantSimple &, const PIVariantSimple &))__stat_eh_v_##name##__; \
|
||||
if (eh.eh_set[fp]) return; \
|
||||
eh.eh_set << fp; \
|
||||
__MetaFunc & f(eh.eh_func[fp]); \
|
||||
f.scope = __classNameS(); \
|
||||
f.func_name = PIStringAscii(#name); \
|
||||
f.addr = fp; \
|
||||
f.addrV = fpV; \
|
||||
f.type_ret = PIStringAscii(#ret); \
|
||||
f.types << PIObject::simplifyType(#a0) << PIObject::simplifyType(#a1); \
|
||||
f.names << PIStringAscii(#n0) << PIStringAscii(#n1); \
|
||||
__EH_INIT_BASE__(ret, name) \
|
||||
f.__addArgument(#a0, #n0); \
|
||||
f.__addArgument(#a1, #n1); \
|
||||
STATIC_INITIALIZER_END
|
||||
|
||||
#define EH_INIT3(ret, name, a0, n0, a1, n1, a2, n2) \
|
||||
STATIC_INITIALIZER_BEGIN \
|
||||
PIMutexLocker ml(__meta_mutex()); \
|
||||
__MetaData & eh(__meta_data()[__classNameIDS()]); \
|
||||
void * fp = (void*)(ret(*)(void*, a0, a1, a2))__stat_eh_##name##__; \
|
||||
void * fpV = (void*)(ret(*)(void*, const PIVariantSimple &, const PIVariantSimple &, const PIVariantSimple &))__stat_eh_v_##name##__; \
|
||||
if (eh.eh_set[fp]) return; \
|
||||
eh.eh_set << fp; \
|
||||
__MetaFunc & f(eh.eh_func[fp]); \
|
||||
f.scope = __classNameS(); \
|
||||
f.func_name = PIStringAscii(#name); \
|
||||
f.addr = fp; \
|
||||
f.addrV = fpV; \
|
||||
f.type_ret = PIStringAscii(#ret); \
|
||||
f.types << PIObject::simplifyType(#a0) << PIObject::simplifyType(#a1) << PIObject::simplifyType(#a2); \
|
||||
f.names << PIStringAscii(#n0) << PIStringAscii(#n1) << PIStringAscii(#n2); \
|
||||
__EH_INIT_BASE__(ret, name) \
|
||||
f.__addArgument(#a0, #n0); \
|
||||
f.__addArgument(#a1, #n1); \
|
||||
f.__addArgument(#a2, #n2); \
|
||||
STATIC_INITIALIZER_END
|
||||
|
||||
#define EH_INIT4(ret, name, a0, n0, a1, n1, a2, n2, a3, n3) \
|
||||
STATIC_INITIALIZER_BEGIN \
|
||||
PIMutexLocker ml(__meta_mutex()); \
|
||||
__MetaData & eh(__meta_data()[__classNameIDS()]); \
|
||||
void * fp = (void*)(ret(*)(void*, a0, a1, a2, a3))__stat_eh_##name##__; \
|
||||
void * fpV = (void*)(ret(*)(void*, const PIVariantSimple &, const PIVariantSimple &, const PIVariantSimple &, const PIVariantSimple &))__stat_eh_v_##name##__; \
|
||||
if (eh.eh_set[fp]) return; \
|
||||
eh.eh_set << fp; \
|
||||
__MetaFunc & f(eh.eh_func[fp]); \
|
||||
f.scope = __classNameS(); \
|
||||
f.func_name = PIStringAscii(#name); \
|
||||
f.addr = fp; \
|
||||
f.addrV = fpV; \
|
||||
f.type_ret = PIStringAscii(#ret); \
|
||||
f.types << PIObject::simplifyType(#a0) << PIObject::simplifyType(#a1) << PIObject::simplifyType(#a2) << PIObject::simplifyType(#a3); \
|
||||
f.names << PIStringAscii(#n0) << PIStringAscii(#n1) << PIStringAscii(#n2) << PIStringAscii(#n3); \
|
||||
__EH_INIT_BASE__(ret, name) \
|
||||
f.__addArgument(#a0, #n0); \
|
||||
f.__addArgument(#a1, #n1); \
|
||||
f.__addArgument(#a2, #n2); \
|
||||
f.__addArgument(#a3, #n3); \
|
||||
STATIC_INITIALIZER_END
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user