git-svn-id: svn://db.shs.com.ru/pip@467 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5
This commit is contained in:
@@ -37,7 +37,7 @@
|
||||
/// \relatesalso PIObject \brief you should use this macro after class declaration to use EVENT and EVENT_HANDLER and correct piCoutObj output
|
||||
#define PIOBJECT(name)
|
||||
|
||||
/// \relatesalso PIObject \brief you should use this macro after class declaration to use EVENT and EVENT_HANDLER of parent class
|
||||
/// \relatesalso PIObject \brief you should use this macro after class declaration to use EVENT and EVENT_HANDLER of parent class, and \a scopeList()
|
||||
#define PIOBJECT_SUBCLASS(name, parent)
|
||||
|
||||
|
||||
@@ -196,19 +196,22 @@
|
||||
__##name##_ParentInitializer__() { \
|
||||
PIString pn(name::__classNameS()); \
|
||||
if (pn.isEmpty()) return; \
|
||||
PIMutexLocker ml(__eh_mutex()); \
|
||||
if (__eh_data().contains(__classNameS())) return; \
|
||||
__eh_data()[pn]; \
|
||||
__eh_data()[__classNameS()]; \
|
||||
__EHData & ehp(__eh_data()[pn]); \
|
||||
__EHData & eh(__eh_data()[__classNameS()]); \
|
||||
PIMutexLocker ml(__meta_mutex()); \
|
||||
if (__meta_data().contains(__classNameS())) return; \
|
||||
__meta_data()[pn]; \
|
||||
__meta_data()[__classNameS()]; \
|
||||
__MetaData & ehp(__meta_data()[pn]); \
|
||||
__MetaData & eh(__meta_data()[__classNameS()]); \
|
||||
eh.eh_set << ehp.eh_set; \
|
||||
eh.eh_func << ehp.eh_func; \
|
||||
eh.scope_list = ehp.scope_list; \
|
||||
eh.addScope(__classNameS()); \
|
||||
} \
|
||||
}; \
|
||||
__##name##_ParentInitializer__ __##name##_parent_init__; \
|
||||
public: \
|
||||
virtual const char * superClassName() const {return #name;} \
|
||||
virtual const char * parentClassName() const {return #name;} \
|
||||
typedef name __Parent__; \
|
||||
private:
|
||||
|
||||
#define PIOBJECT_SUBCLASS(name, parent) PIOBJECT(name) PIOBJECT_PARENT(parent)
|
||||
@@ -218,8 +221,8 @@
|
||||
class __##name##0_Initializer__ { \
|
||||
public: \
|
||||
__##name##0_Initializer__() { \
|
||||
PIMutexLocker ml(__eh_mutex()); \
|
||||
__EHData & eh(__eh_data()[__classNameS()]); \
|
||||
PIMutexLocker ml(__meta_mutex()); \
|
||||
__MetaData & eh(__meta_data()[__classNameS()]); \
|
||||
void * fp = (void*)(ret(*)(void*))__stat_eh_##name##__; \
|
||||
if (eh.eh_set[fp]) return; \
|
||||
eh.eh_set << fp; \
|
||||
@@ -236,8 +239,8 @@
|
||||
class __##name##1##n0##_Initializer__ { \
|
||||
public: \
|
||||
__##name##1##n0##_Initializer__() { \
|
||||
PIMutexLocker ml(__eh_mutex()); \
|
||||
__EHData & eh(__eh_data()[__classNameS()]); \
|
||||
PIMutexLocker ml(__meta_mutex()); \
|
||||
__MetaData & eh(__meta_data()[__classNameS()]); \
|
||||
void * fp = (void*)(ret(*)(void*, a0))__stat_eh_##name##__; \
|
||||
if (eh.eh_set[fp]) return; \
|
||||
eh.eh_set << fp; \
|
||||
@@ -256,8 +259,8 @@
|
||||
class __##name##2##n0##n1##_Initializer__ { \
|
||||
public: \
|
||||
__##name##2##n0##n1##_Initializer__() { \
|
||||
PIMutexLocker ml(__eh_mutex()); \
|
||||
__EHData & eh(__eh_data()[__classNameS()]); \
|
||||
PIMutexLocker ml(__meta_mutex()); \
|
||||
__MetaData & eh(__meta_data()[__classNameS()]); \
|
||||
void * fp = (void*)(ret(*)(void*, a0, a1))__stat_eh_##name##__; \
|
||||
if (eh.eh_set[fp]) return; \
|
||||
eh.eh_set << fp; \
|
||||
@@ -276,8 +279,8 @@
|
||||
class __##name##3##n0##n1##n2##_Initializer__ { \
|
||||
public: \
|
||||
__##name##3##n0##n1##n2##_Initializer__() { \
|
||||
PIMutexLocker ml(__eh_mutex()); \
|
||||
__EHData & eh(__eh_data()[__classNameS()]); \
|
||||
PIMutexLocker ml(__meta_mutex()); \
|
||||
__MetaData & eh(__meta_data()[__classNameS()]); \
|
||||
void * fp = (void*)(ret(*)(void*, a0, a1, a2))__stat_eh_##name##__; \
|
||||
if (eh.eh_set[fp]) return; \
|
||||
eh.eh_set << fp; \
|
||||
@@ -296,8 +299,8 @@
|
||||
class __##name##4##n0##n1##n2##n3##_Initializer__ { \
|
||||
public: \
|
||||
__##name##4##n0##n1##n2##n3##_Initializer__() { \
|
||||
PIMutexLocker ml(__eh_mutex()); \
|
||||
__EHData & eh(__eh_data()[__classNameS()]); \
|
||||
PIMutexLocker ml(__meta_mutex()); \
|
||||
__MetaData & eh(__meta_data()[__classNameS()]); \
|
||||
void * fp = (void*)(ret(*)(void*, a0, a1, a2, a3))__stat_eh_##name##__; \
|
||||
if (eh.eh_set[fp]) return; \
|
||||
eh.eh_set << fp; \
|
||||
@@ -419,6 +422,7 @@ class PIP_EXPORT PIObject
|
||||
friend class PIObjectManager;
|
||||
friend void dumpApplication();
|
||||
typedef PIObject __PIObject__;
|
||||
typedef void __Parent__;
|
||||
public:
|
||||
|
||||
//! Contructs PIObject with name "name"
|
||||
@@ -440,10 +444,13 @@ public:
|
||||
|
||||
//! Returns object class name
|
||||
virtual const char * className() const {return "PIObject";}
|
||||
|
||||
static const PIString __classNameS() {return PIStringAscii("PIObject");}
|
||||
|
||||
//! Returns object superclass name
|
||||
virtual const char * superClassName() const {return "";}
|
||||
|
||||
//! Returns parent object class name
|
||||
virtual const char * parentClassName() const {return "";}
|
||||
|
||||
|
||||
//! Return if debug of this object is active
|
||||
bool debug() const {return property(PIStringAscii("debug")).toBool();}
|
||||
|
||||
@@ -479,7 +486,8 @@ public:
|
||||
void dump(const PIString & line_prefix = PIString()) const;
|
||||
|
||||
|
||||
PIStringList methodsEH();
|
||||
PIStringList scopeList() const;
|
||||
PIStringList methodsEH() const;
|
||||
bool isMethodEHContains(const PIString & name) const;
|
||||
PIString methodEHArguments(const PIString & name) const;
|
||||
PIString methodEHFullFormat(const PIString & name) const;
|
||||
@@ -672,7 +680,7 @@ public:
|
||||
bool isTypeOf() const {
|
||||
if (!this) return false;
|
||||
if (!isPIObject()) return false;
|
||||
return (PIStringAscii(className()) == T::__classNameS());
|
||||
return scopeList().contains(T::__classNameS());
|
||||
}
|
||||
template<typename T>
|
||||
T * cast() const {
|
||||
@@ -692,24 +700,28 @@ public:
|
||||
static PIString simplifyType(const char * a);
|
||||
|
||||
struct __EHFunc {
|
||||
__EHFunc(): addr(0) {;}
|
||||
__EHFunc(): addr(0), addrV(0) {;}
|
||||
bool isNull() const {return addr == 0;}
|
||||
PIString arguments() const;
|
||||
PIString fullFormat() const;
|
||||
void * addr;
|
||||
void * addrV;
|
||||
PIString func_name;
|
||||
PIString type_ret;
|
||||
PIString scope;
|
||||
PIStringList types;
|
||||
PIStringList names;
|
||||
};
|
||||
struct __EHData {
|
||||
struct __MetaData {
|
||||
__MetaData() {scope_list << PIStringAscii("PIObject");}
|
||||
void addScope(const PIString & s) {if (!scope_list.contains(s)) scope_list << s;}
|
||||
PIStringList scope_list;
|
||||
PISet<const void * > eh_set;
|
||||
PIMap<const void * , __EHFunc> eh_func;
|
||||
};
|
||||
typedef PIPair<const void * , __EHFunc> __EHPair;
|
||||
static PIMutex & __eh_mutex();
|
||||
static PIMap<PIString, __EHData> & __eh_data();
|
||||
static PIMutex & __meta_mutex();
|
||||
static PIMap<PIString, __MetaData> & __meta_data(); // [classname]=__MetaData
|
||||
|
||||
protected:
|
||||
|
||||
@@ -720,8 +732,6 @@ protected:
|
||||
virtual void propertyChanged(const PIString & name) {}
|
||||
|
||||
|
||||
static const PIString __classNameS() {return PIStringAscii("PIObject");}
|
||||
|
||||
EVENT(deleted)
|
||||
|
||||
//! \events
|
||||
|
||||
Reference in New Issue
Block a user