Plasma Engine  2.0
Loading...
Searching...
No Matches
plEnumerable< 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 plEnumerable< Derived, Base >:

Protected Attributes

plEnumerablem_pNextInstance
 

Additional Inherited Members

- Static Public Member Functions inherited from plNoBase
static const plRTTIGetStaticRTTI ()
 

Detailed Description

template<typename Derived, typename Base = plNoBase>
class plEnumerable< 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 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'


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