Tekkotsu Homepage | Demos | Overview | Downloads | Dev. Resources | Reference | Credits |
FamilyFactory< FamilyT, NameT, FactoryBaseT, FactoryT > Class Template Reference#include <FamilyFactory.h>
Inheritance diagram for FamilyFactory< FamilyT, NameT, FactoryBaseT, FactoryT >:
![]() Detailed Descriptiontemplate<class FamilyT, typename NameT = std::string, class FactoryBaseT = Factory0Arg<FamilyT>, template< class U > class FactoryT = FactoryBaseT::template Factory>
A class which can track a set of subclass types (with shared base class FamilyT), generating new instances on demand based on some form of identifier (the NameT template parameter).
|
Public Types | |
typedef FamilyT | FamilyType |
allows indirect access to the product family type | |
typedef NameT | NameType |
allows indirect access to the product class name type | |
typedef FactoryBaseT | FactoryBaseType |
allows indirect access to the factory base class | |
Public Member Functions | |
FamilyFactory () | |
default constructor | |
virtual | ~FamilyFactory () |
destructor | |
void | getTypeNames (std::set< NameT > &types) const |
clears types and fills in the currently registered type identifiers | |
unsigned int | getNumTypes () const |
returns the number of currently registered type identifiers | |
template<typename T> | |
const NameT & | registerType (const NameT &type) |
creates a factory for the specified type from FactoryT and registers it as type | |
const NameT & | registerFactory (const NameT &type, FactoryBaseT *f) |
registers the specified factory for producing objects known by type; FamilyFactory assumes responsibilty for deallocation of f | |
FamilyT * | create (const NameT &type) const |
requests a new instance of the specified type be created, without passing any arguments to the factory | |
template<typename A1> | |
FamilyT * | create (const NameT &type, const A1 &a1) const |
requests a new instance of the specified type be created, passing a single argument to the factory | |
template<typename A1, typename A2> | |
FamilyT * | create (const NameT &type, const A1 &a1, const A2 &a2) const |
requests a new instance of the specified type be created, passing two arguments to the factory | |
template<typename A1, typename A2, typename A3> | |
FamilyT * | create (const NameT &type, const A1 &a1, const A2 &a2, const A3 &a3) const |
requests a new instance of the specified type be created, passing three arguments to the factory | |
Protected Types | |
typedef std::map< NameT, FactoryBaseT * > | factories_t |
type of factories | |
Protected Member Functions | |
FactoryBaseT * | lookupFactory (const NameT &type) const |
utility function to see if type has been registered and return it, or NULL if not found | |
Protected Attributes | |
factories_t | factories |
storage for type identifier to factory mapping | |
Classes | |
struct | FactoryType |
allows indirect access to create factory classes More... |
typedef FamilyT FamilyFactory< FamilyT, NameT, FactoryBaseT, FactoryT >::FamilyType |
allows indirect access to the product family type
Reimplemented in InstanceTracker< FamilyT, ClassNameT, FactoryBaseT, FactoryT >.
Definition at line 33 of file FamilyFactory.h.
typedef NameT FamilyFactory< FamilyT, NameT, FactoryBaseT, FactoryT >::NameType |
allows indirect access to the product class name type
Definition at line 35 of file FamilyFactory.h.
typedef FactoryBaseT FamilyFactory< FamilyT, NameT, FactoryBaseT, FactoryT >::FactoryBaseType |
allows indirect access to the factory base class
Reimplemented in InstanceTracker< FamilyT, ClassNameT, FactoryBaseT, FactoryT >.
Definition at line 37 of file FamilyFactory.h.
typedef std::map<NameT,FactoryBaseT*> FamilyFactory< FamilyT, NameT, FactoryBaseT, FactoryT >::factories_t [protected] |
FamilyFactory< FamilyT, NameT, FactoryBaseT, FactoryT >::FamilyFactory | ( | ) | [inline] |
virtual FamilyFactory< FamilyT, NameT, FactoryBaseT, FactoryT >::~FamilyFactory | ( | ) | [inline, virtual] |
void FamilyFactory< FamilyT, NameT, FactoryBaseT, FactoryT >::getTypeNames | ( | std::set< NameT > & | types | ) | const [inline] |
clears types and fills in the currently registered type identifiers
Definition at line 92 of file FamilyFactory.h.
unsigned int FamilyFactory< FamilyT, NameT, FactoryBaseT, FactoryT >::getNumTypes | ( | ) | const [inline] |
returns the number of currently registered type identifiers
Definition at line 55 of file FamilyFactory.h.
const NameT& FamilyFactory< FamilyT, NameT, FactoryBaseT, FactoryT >::registerType | ( | const NameT & | type | ) | [inline] |
creates a factory for the specified type from FactoryT and registers it as type
Definition at line 58 of file FamilyFactory.h.
Referenced by DataEvent< T, TID >::registerDataType().
const NameT & FamilyFactory< FamilyT, NameT, FactoryBaseT, FactoryT >::registerFactory | ( | const NameT & | type, | |
FactoryBaseT * | f | |||
) | [inline] |
registers the specified factory for producing objects known by type; FamilyFactory assumes responsibilty for deallocation of f
Definition at line 99 of file FamilyFactory.h.
Referenced by DataEvent< T, TID >::registerDataType(), and FamilyFactory< FamilyT, ClassNameT, FactoryBaseT, FactoryT >::registerType().
FamilyT* FamilyFactory< FamilyT, NameT, FactoryBaseT, FactoryT >::create | ( | const NameT & | type | ) | const [inline] |
requests a new instance of the specified type be created, without passing any arguments to the factory
Note that the factory interface chosen by FactoryBaseT may not actually provide such a call!
Definition at line 65 of file FamilyFactory.h.
Referenced by InstanceTracker< FamilyT, ClassNameT, FactoryBaseT, FactoryT >::create().
FamilyT* FamilyFactory< FamilyT, NameT, FactoryBaseT, FactoryT >::create | ( | const NameT & | type, | |
const A1 & | a1 | |||
) | const [inline] |
requests a new instance of the specified type be created, passing a single argument to the factory
Note that the factory interface chosen by FactoryBaseT may not actually provide such a call!
Definition at line 70 of file FamilyFactory.h.
FamilyT* FamilyFactory< FamilyT, NameT, FactoryBaseT, FactoryT >::create | ( | const NameT & | type, | |
const A1 & | a1, | |||
const A2 & | a2 | |||
) | const [inline] |
requests a new instance of the specified type be created, passing two arguments to the factory
Note that the factory interface chosen by FactoryBaseT may not actually provide such a call!
Definition at line 75 of file FamilyFactory.h.
FamilyT* FamilyFactory< FamilyT, NameT, FactoryBaseT, FactoryT >::create | ( | const NameT & | type, | |
const A1 & | a1, | |||
const A2 & | a2, | |||
const A3 & | a3 | |||
) | const [inline] |
requests a new instance of the specified type be created, passing three arguments to the factory
Note that the factory interface chosen by FactoryBaseT may not actually provide such a call!
Definition at line 80 of file FamilyFactory.h.
FactoryBaseT * FamilyFactory< FamilyT, NameT, FactoryBaseT, FactoryT >::lookupFactory | ( | const NameT & | type | ) | const [inline, protected] |
utility function to see if type has been registered and return it, or NULL if not found
Definition at line 110 of file FamilyFactory.h.
Referenced by FamilyFactory< FamilyT, ClassNameT, FactoryBaseT, FactoryT >::create().
factories_t FamilyFactory< FamilyT, NameT, FactoryBaseT, FactoryT >::factories [protected] |
storage for type identifier to factory mapping
Definition at line 88 of file FamilyFactory.h.
Referenced by FamilyFactory< FamilyT, ClassNameT, FactoryBaseT, FactoryT >::getNumTypes(), FamilyFactory< FamilyT, NameT, FactoryBaseT, FactoryT >::getTypeNames(), FamilyFactory< FamilyT, NameT, FactoryBaseT, FactoryT >::lookupFactory(), FamilyFactory< FamilyT, NameT, FactoryBaseT, FactoryT >::registerFactory(), and FamilyFactory< FamilyT, ClassNameT, FactoryBaseT, FactoryT >::~FamilyFactory().
Tekkotsu v4.0 |
Generated Thu Nov 22 00:58:24 2007 by Doxygen 1.5.4 |