Ignore:
Timestamp:
04/11/14 23:39:36 (11 years ago)
Author:
Maciej Komosinski
Message:

"Distributed" deserializable class registry, so that ExtValue? does not depend on so many other classes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpp/frams/util/extvalue.h

    r205 r222  
    160160const char* deserialize(const char* in);//< @return first character after the succesfully parsed string or NULL if failed
    161161const char* deserialize_inner(const char* in);
    162 static PtrListTempl<ParamInterface*> deserializable_classes;
    163162static ParamInterface *findDeserializableClass(const char* name);
    164 static void initDeserializableClasses();
     163static PtrListTempl<ParamInterface*> &getDeserializableClasses();
     164template<typename T> class AddDeserializable
     165{
     166  public:
     167AddDeserializable() {ExtValue::getDeserializableClasses()+=&T::getStaticParam();}
     168};
     169
    165170static SString format(SString& fmt,const ExtValue **values,int count);
    166171
     
    188193};
    189194
     195#define REGISTER_DESERIALIZABLE(name) ExtValue::AddDeserializable<name> deserializable_autoinit_ ## name;
    190196
    191197#endif
Note: See TracChangeset for help on using the changeset viewer.