Main Page | Modules | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

Teem::Registrar< T, IdT, Arg1T, Arg2T > Class Template Reference
[Utilities]

#include <Registrar.h>

List of all members.


Detailed Description

template<typename T, typename IdT, typename Arg1T = void, typename Arg2T = void>
class Teem::Registrar< T, IdT, Arg1T, Arg2T >

A Registrar for classes with two parameters constructors.

Usage

A, is a class; B, C are its subclasses

Registrar<A, std::string, int, int> reg;

reg.registerItem<B>("you");
reg.registerItem<C>("yeah");

A* a1 = reg.createItem("you", 0, 0);
A* a2 = reg.createItem("yeah", 0, 0);


Public Member Functions

template<typename Sub>
void registerItem (const IdT &id)
 Register a class by storing a pointer to its constructor.
T * createItem (const IdT &id, Arg1T arg1, Arg2T arg2)
 Create an instance of a registered class and pass arg1 and arg2 to its constructor.
void dump (std::ostream &stream)
 Print the list of registered classes to stream.

Protected Types

typedef T *(* CreatorFunc )(Arg1T, Arg2T)
 Pointer to constructor of class T.

Static Protected Member Functions

template<typename Sub>
static T * Creator (Arg1T arg1, Arg2T arg2)
 Create a new class of type Sub with arguments arg1 and arg2.

Protected Attributes

std::map< IdT, CreatorFuncmItems
 registered constructors


The documentation for this class was generated from the following file:
Generated on Mon Oct 24 17:38:29 2005 for Teem by  doxygen 1.4.2