version 3.15.0 - improved pip_cmg and PICodeInfo storage
Important! changed API to access PICodeInfo storage
This commit is contained in:
@@ -278,28 +278,40 @@ inline PICout operator<<(PICout s, const PICodeInfo::EnumInfo & v) {
|
||||
}
|
||||
|
||||
|
||||
//! \~english Pointer to single storage of PICodeInfo::ClassInfo, access by name
|
||||
//! \~russian Указатель на единое хренилище PICodeInfo::ClassInfo, доступ по имени
|
||||
extern PIP_EXPORT PIMap<PIConstChars, PICodeInfo::ClassInfo *> * classesInfo;
|
||||
class PIP_EXPORT __Storage__ {
|
||||
__Storage__();
|
||||
~__Storage__();
|
||||
|
||||
//! \~english Pointer to single storage of PICodeInfo::EnumInfo, access by name
|
||||
//! \~russian Указатель на единое хренилище PICodeInfo::EnumInfo, доступ по имени
|
||||
extern PIP_EXPORT PIMap<PIConstChars, PICodeInfo::EnumInfo *> * enumsInfo;
|
||||
public:
|
||||
static __Storage__ * instance();
|
||||
|
||||
extern PIP_EXPORT PIMap<PIConstChars, PICodeInfo::AccessValueFunction> * accessValueFunctions;
|
||||
//! \~english Getter for single storage of PICodeInfo::ClassInfo, access by name
|
||||
//! \~russian Доступ к единому хранилищу PICodeInfo::ClassInfo, доступ по имени
|
||||
const PIMap<PIConstChars, PICodeInfo::ClassInfo *> & classes() { return *classesInfo; }
|
||||
|
||||
//! \~english Getter for single storage of PICodeInfo::EnumInfo, access by name
|
||||
//! \~russian Доступ к единому хранилищу хранилище PICodeInfo::EnumInfo, доступ по имени
|
||||
const PIMap<PIConstChars, PICodeInfo::EnumInfo *> & enums() { return *enumsInfo; }
|
||||
|
||||
PIMap<PIConstChars, PICodeInfo::ClassInfo *> * classesInfo;
|
||||
PIMap<PIConstChars, PICodeInfo::EnumInfo *> * enumsInfo;
|
||||
PIMap<PIConstChars, PICodeInfo::AccessValueFunction> * accessValueFunctions;
|
||||
PIMap<PIConstChars, PICodeInfo::AccessTypeFunction> * accessTypeFunctions;
|
||||
};
|
||||
|
||||
#define PICODEINFO (PICodeInfo::__Storage__::instance())
|
||||
|
||||
extern PIP_EXPORT PIMap<PIConstChars, PICodeInfo::AccessTypeFunction> * accessTypeFunctions;
|
||||
|
||||
inline PIByteArray getMemberValue(const void * p, const char * class_name, const char * member_name) {
|
||||
if (!p || !class_name || !member_name || !accessValueFunctions) return PIByteArray();
|
||||
AccessValueFunction af = accessValueFunctions->value(class_name, (AccessValueFunction)0);
|
||||
if (!p || !class_name || !member_name || !PICODEINFO->accessValueFunctions) return PIByteArray();
|
||||
AccessValueFunction af = PICODEINFO->accessValueFunctions->value(class_name, (AccessValueFunction)0);
|
||||
if (!af) return PIByteArray();
|
||||
return af(p, member_name);
|
||||
}
|
||||
|
||||
inline const char * getMemberType(const char * class_name, const char * member_name) {
|
||||
if (!class_name || !member_name || !accessTypeFunctions) return "";
|
||||
AccessTypeFunction af = accessTypeFunctions->value(class_name, (AccessTypeFunction)0);
|
||||
if (!class_name || !member_name || !PICODEINFO->accessTypeFunctions) return "";
|
||||
AccessTypeFunction af = PICODEINFO->accessTypeFunctions->value(class_name, (AccessTypeFunction)0);
|
||||
if (!af) return "";
|
||||
return af(member_name);
|
||||
}
|
||||
@@ -317,19 +329,5 @@ void serialize(PIByteArray & ret, const T & v) {}
|
||||
|
||||
} // namespace PICodeInfo
|
||||
|
||||
class PIP_EXPORT __PICodeInfoInitializer__ {
|
||||
public:
|
||||
__PICodeInfoInitializer__() {
|
||||
if (_inited_) return;
|
||||
_inited_ = true;
|
||||
PICodeInfo::classesInfo = new PIMap<PIConstChars, PICodeInfo::ClassInfo *>;
|
||||
PICodeInfo::enumsInfo = new PIMap<PIConstChars, PICodeInfo::EnumInfo *>;
|
||||
PICodeInfo::accessValueFunctions = new PIMap<PIConstChars, PICodeInfo::AccessValueFunction>;
|
||||
PICodeInfo::accessTypeFunctions = new PIMap<PIConstChars, PICodeInfo::AccessTypeFunction>;
|
||||
}
|
||||
static bool _inited_;
|
||||
};
|
||||
|
||||
static __PICodeInfoInitializer__ __picodeinfoinitializer__;
|
||||
|
||||
#endif // PICODEINFO_H
|
||||
|
||||
Reference in New Issue
Block a user