![]() |
Plasma Engine
2.0
|
Base class to add the ability to another class to enumerate all active instance of it, across DLL boundaries. More...
#include <EnumerableClass.h>
Protected Attributes | |
plEnumerable * | m_pNextInstance |
Additional Inherited Members | |
![]() | |
static const plRTTI * | GetStaticRTTI () |
Base class to add the ability to another class to enumerate all active instance of it, across DLL boundaries.
This creates a new class-type that has the static information about all instances that were created from that class. Another class now only has to derive from that class and will then gain the ability to count and enumerate its instances.
Usage is as follows:
If you have a class A that you want to be enumerable, add this to its header:
class PL_DLL_IMPORT_EXPORT_STUFF A : public plEnumerable { PL_DECLARE_ENUMERABLE_CLASS(A); // since A is declared as DLL import/export all code embedded in its body will also work properly ... };
Also add this somewhere in its source-file:
PL_ENUMERABLE_CLASS_IMPLEMENTATION(A);
That's it, now the class instances can be enumerated with 'GetFirstInstance' and 'GetNextInstance'