diff --git a/src_main/containers/pimap.h b/src_main/containers/pimap.h index a2c64fcd..a53c1a3d 100644 --- a/src_main/containers/pimap.h +++ b/src_main/containers/pimap.h @@ -197,6 +197,7 @@ public: const T at(const Key & key) const {return (*this)[key];} PIMap & operator <<(const PIMap & 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;} diff --git a/src_main/core/piobject.cpp b/src_main/core/piobject.cpp index c2d9d8ac..69e2af49 100755 --- a/src_main/core/piobject.cpp +++ b/src_main/core/piobject.cpp @@ -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; } } diff --git a/src_main/core/piobject.h b/src_main/core/piobject.h index 9269b043..5cd84ab2 100755 --- a/src_main/core/piobject.h +++ b/src_main/core/piobject.h @@ -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 scope_id; PISet eh_set; diff --git a/src_main/core/pistring.h b/src_main/core/pistring.h index c0bf5cc7..a03a891f 100755 --- a/src_main/core/pistring.h +++ b/src_main/core/pistring.h @@ -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::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;}