![]() |
ezEngine
Release 25.03
|
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 | |
ezEnumerable * | m_pNextInstance |
Additional Inherited Members | |
![]() | |
static const ezRTTI * | 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 EZ_DLL_IMPORT_EXPORT_STUFF A : public ezEnumerable { EZ_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:
EZ_ENUMERABLE_CLASS_IMPLEMENTATION(A);
That's it, now the class instances can be enumerated with 'GetFirstInstance' and 'GetNextInstance'