XII Release 0.1.0
Loading...
Searching...
No Matches
xiiEnumerable< 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 xiiEnumerable< Derived, Base >:
[legend]

Protected Attributes

xiiEnumerablem_pNextInstance
 

Additional Inherited Members

- Static Public Member Functions inherited from xiiNoBase
static const xiiRTTIGetStaticRTTI ()
 

Detailed Description

template<typename Derived, typename Base = xiiNoBase>
class xiiEnumerable< 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 XII_DLL_IMPORT_EXPORT_STUFF A : public xiiEnumerable { XII_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:

XII_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: