optimization and fixes
This commit is contained in:
@@ -197,6 +197,7 @@ public:
|
||||
const T at(const Key & key) const {return (*this)[key];}
|
||||
|
||||
PIMap<Key, T> & operator <<(const PIMap<Key, T> & other) {
|
||||
if (&other == this) return *this;
|
||||
if (other.isEmpty()) return *this;
|
||||
if (other.size() == 1) {insert(other.pim_index[0].key, other.pim_content[0]); return *this;}
|
||||
if (other.size() == 2) {insert(other.pim_index[0].key, other.pim_content[0]); insert(other.pim_index[1].key, other.pim_content[1]); return *this;}
|
||||
|
||||
@@ -674,10 +674,10 @@ bool dumpApplicationToFile(const PIString & path) {
|
||||
|
||||
|
||||
|
||||
void PIObject::__MetaData::addScope(const PIString & s) {
|
||||
if (!scope_list.contains(s)) {
|
||||
void PIObject::__MetaData::addScope(const PIString & s, uint shash) {
|
||||
if (!scope_id.contains(shash)) {
|
||||
scope_list << s;
|
||||
scope_id << s.hash();
|
||||
scope_id << shash;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -195,12 +195,16 @@
|
||||
#endif
|
||||
#define __VVALUE(t, v) v.value< __PTYPE(t) >()
|
||||
|
||||
//printf("base_init %s id=%d (%d) pid=%d (%d) ...\n", #name, id, eh.eh_func.size(), pid, ehp.eh_func.size());
|
||||
//printf("base_init %s id=%d (%d) pid=%d (%d) ok\n", #name, id, eh.eh_func.size(), pid, ehp.eh_func.size());
|
||||
//printf("parent_init %s::%s id=%d (%d) pid=%d (%d) ...\n", __classNameS().dataAscii(), #name, id, eh.eh_func.size(), pid, ehp.eh_func.size());
|
||||
//printf("parent_init %s::%s id=%d (%d) pid=%d (%d) ok\n", __classNameS().dataAscii(), #name, id, eh.eh_func.size(), pid, ehp.eh_func.size());
|
||||
|
||||
#define PIOBJECT(name) \
|
||||
protected: \
|
||||
typedef name __PIObject__; \
|
||||
public: \
|
||||
static const PIString __classNameS() {return PIStringAscii(#name);} \
|
||||
static const PIString __classNameS() {static PIString ret = PIStringAscii(#name); return ret;} \
|
||||
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;} \
|
||||
@@ -220,7 +224,7 @@
|
||||
__MetaData & eh(__meta_data()[id]); \
|
||||
eh.eh_set << ehp.eh_set; \
|
||||
eh.eh_func << ehp.eh_func; \
|
||||
eh.addScope(__classNameS()); \
|
||||
eh.addScope(__classNameS(), id); \
|
||||
} \
|
||||
}; \
|
||||
__BaseInitializer__ __base_init__;
|
||||
@@ -239,8 +243,9 @@
|
||||
__MetaData & ehp(__meta_data()[pid]); \
|
||||
eh.eh_set << ehp.eh_set; \
|
||||
eh.eh_func << ehp.eh_func; \
|
||||
eh.scope_id = ehp.scope_id; \
|
||||
eh.scope_list = ehp.scope_list; \
|
||||
eh.addScope(__classNameS()); \
|
||||
eh.addScope(PIStringAscii(#name), pid); \
|
||||
} \
|
||||
}; \
|
||||
__ParentInitializer__ __parent_init__; \
|
||||
@@ -836,8 +841,8 @@ public:
|
||||
PIStringList names;
|
||||
};
|
||||
struct __MetaData {
|
||||
__MetaData() {scope_list << PIStringAscii("PIObject");}
|
||||
void addScope(const PIString & s);
|
||||
__MetaData() {scope_list << PIStringAscii("PIObject"); scope_id << PIStringAscii("PIObject").hash();}
|
||||
void addScope(const PIString & s, uint shash);
|
||||
PIStringList scope_list;
|
||||
PISet<uint> scope_id;
|
||||
PISet<const void * > eh_set;
|
||||
|
||||
@@ -869,10 +869,11 @@ public:
|
||||
//! Compare operator
|
||||
bool operator !=(const PIStringList & o) const {return !(o == (*this));}
|
||||
|
||||
PIStringList & operator =(const PIStringList & o) {clear(); for (uint i = 0; i < o.size(); ++i) *this << o[i]; return *this;}
|
||||
//PIStringList & operator =(const PIStringList & o) {clear(); for (uint i = 0; i < o.size(); ++i) *this << o[i]; return *this;}
|
||||
PIStringList & operator =(const PIStringList & o) {PIDeque<PIString>::operator=(o); return *this;}
|
||||
|
||||
PIStringList & operator <<(const PIString & str) {push_back(str); return *this;}
|
||||
PIStringList & operator <<(const PIStringList & sl) {piForeachC (PIString & i, sl) push_back(i); return *this;}
|
||||
PIStringList & operator <<(const PIString & str) {append(str); return *this;}
|
||||
PIStringList & operator <<(const PIStringList & sl) {append(sl); return *this;}
|
||||
// inline PIStringList & operator <<(const char c) {push_back(PIString(c)); return *this;}
|
||||
// PIStringList & operator <<(const char * str) {push_back(PIString(str)); return *this;}
|
||||
// PIStringList & operator <<(const int & num) {push_back(PIString::fromNumber(num)); return *this;}
|
||||
|
||||
Reference in New Issue
Block a user