Original Post
I'd like to store Class information in some kind of registry, so I can use them at run-time (editor etc). My problem is, that I don't know how I could access my custom RTTI in the sub-classes without having instances. Basically I have a common base class (Object) and a ObjectFactory. An ID creates an instance of a specific class. For my RTTI stuff I have virtual member functions that do return the classID, baseClassID and static strings for names (like ClassNames etc). I could manually rrgister every aspect/info of a class, but I would love if it goes nearly automatic, by having a single 'register' call and then the registry class polls all the info it wants to store. To add a class to the factory, I've a templated method Inside I'd like to extend it in a simple way like this and in there I'd like to have a bit like this: Now in the code example above, I use a static method - but in reality / in my implementations these are virtual methods .... and ... static virtual does not exist as virtual needs a this pointer but I don't want to deal with objects sat that level. Any idea how to have RTTI thats also works for class hierarchies without instances? As alternative I could - as said - register all infos manually or use something like GCC-XML to generate XML data what could be the base for automatic code generation (like for script bindings) thx Dom
register<MyClass>(ClassType_ID)
ObjectRegistry::getSingleton().Register<MyClass>(unique_id);
template<typename ClassType>
void Register(ClassTypeID classTypeID)
{
ClassInfo newInfo;
newInfo.classID = classTypeID;
newInfo.baseClassID = ClassType::getBaseClassTypeID();
// much more class infos added here, like names as strings, descriptions etc
// (...)
// then adding it to different tables for different type of queries
mRegisteredClassInfos[classTypeID] = newInfo;
// (...) }