ezEngine  Milestone 7
ezEnumerable< Derived, Base > Class Template Reference

Base class to add the ability to another class to enumerate all active instance of it, across DLL boundaries. More...

#include <EnumerableClass.h>

Inheritance diagram for ezEnumerable< Derived, Base >:

Protected Attributes

ezEnumerablem_pNextInstance
 

Detailed Description

template<typename Derived, typename Base = ezNoBase>
class ezEnumerable< Derived, Base >

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'


The documentation for this class was generated from the following file: