Tekkotsu Homepage | Demos | Overview | Downloads | Dev. Resources | Reference | Credits |
FamilyFactory< FamilyT, NameT, FactoryBaseT, FactoryT > Class Template ReferenceA 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). More...
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>
|
Classes | |
struct | FactoryType |
allows indirect access to create factory classes More... | |
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 | |
template<typename N > | |
void | getTypeNames (std::set< N > &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 | |
Static Public Member Functions | |
static FamilyFactory & | getRegistry () |
returns a singleton factory for the current template arguments... be careful that clients use the same templates as those used to register | |
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 |
typedef std::map<NameT,FactoryBaseT*> FamilyFactory< FamilyT, NameT, FactoryBaseT, FactoryT >::factories_t [protected] |
type of factories
Definition at line 90 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 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.
FamilyFactory< FamilyT, NameT, FactoryBaseT, FactoryT >::FamilyFactory | ( | ) |
default constructor
Definition at line 42 of file FamilyFactory.h.
virtual FamilyFactory< FamilyT, NameT, FactoryBaseT, FactoryT >::~FamilyFactory | ( | ) | [virtual] |
destructor
Definition at line 45 of file FamilyFactory.h.
FamilyT* FamilyFactory< FamilyT, NameT, FactoryBaseT, FactoryT >::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
Note that the factory interface chosen by FactoryBaseT may not actually provide such a call!
Definition at line 83 of file FamilyFactory.h.
FamilyT* FamilyFactory< FamilyT, NameT, FactoryBaseT, FactoryT >::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
Note that the factory interface chosen by FactoryBaseT may not actually provide such a call!
Definition at line 78 of file FamilyFactory.h.
FamilyT* FamilyFactory< FamilyT, NameT, FactoryBaseT, FactoryT >::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
Note that the factory interface chosen by FactoryBaseT may not actually provide such a call!
Definition at line 73 of file FamilyFactory.h.
FamilyT* FamilyFactory< FamilyT, NameT, FactoryBaseT, FactoryT >::create | ( | const NameT & | type | ) | const |
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 68 of file FamilyFactory.h.
unsigned int FamilyFactory< FamilyT, NameT, FactoryBaseT, FactoryT >::getNumTypes | ( | ) | const |
returns the number of currently registered type identifiers
Definition at line 58 of file FamilyFactory.h.
static FamilyFactory& FamilyFactory< FamilyT, NameT, FactoryBaseT, FactoryT >::getRegistry | ( | ) | [static] |
returns a singleton factory for the current template arguments... be careful that clients use the same templates as those used to register
Definition at line 52 of file FamilyFactory.h.
void FamilyFactory< FamilyT, NameT, FactoryBaseT, FactoryT >::getTypeNames | ( | std::set< N > & | types | ) | const |
clears types and fills in the currently registered type identifiers
Definition at line 96 of file FamilyFactory.h.
FactoryBaseT * FamilyFactory< FamilyT, NameT, FactoryBaseT, FactoryT >::lookupFactory | ( | const NameT & | type | ) | const [protected] |
utility function to see if type has been registered and return it, or NULL if not found
Definition at line 114 of file FamilyFactory.h.
Referenced by FamilyFactory< FamilyT, ClassNameT, FactoryBaseT, FactoryT >::create().
const NameT & FamilyFactory< FamilyT, NameT, FactoryBaseT, FactoryT >::registerFactory | ( | const NameT & | type, | |
FactoryBaseT * | f | |||
) |
registers the specified factory for producing objects known by type; FamilyFactory assumes responsibilty for deallocation of f
Definition at line 103 of file FamilyFactory.h.
Referenced by DataEvent< T >::registerDataType(), and FamilyFactory< FamilyT, ClassNameT, FactoryBaseT, FactoryT >::registerType().
const NameT& FamilyFactory< FamilyT, NameT, FactoryBaseT, FactoryT >::registerType | ( | const NameT & | type | ) |
creates a factory for the specified type from FactoryT and registers it as type
Definition at line 61 of file FamilyFactory.h.
Referenced by DataEvent< T >::registerDataType().
factories_t FamilyFactory< FamilyT, NameT, FactoryBaseT, FactoryT >::factories [protected] |
storage for type identifier to factory mapping
Definition at line 91 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 v5.1CVS |
Generated Mon May 9 04:59:07 2016 by Doxygen 1.6.3 |