#include <objectfactory.h>
Public Types | |
| typedef UniqueIdTypeClass | UniqueIdType |
| typedef BaseTypeClass | BaseType |
| typedef ltCmpClass | ltCmp |
| typedef BaseType *(* | createObjectFunc )() |
| typedef std::map< UniqueIdType, createObjectFunc, ltCmp > | ObjectMap |
| Function pointer type for functions creating objects. | |
| typedef ObjectMap::iterator | ObjTypeItor |
| typedef ObjectMap::const_iterator | ObjTypeItorConst |
Public Member Functions | |
| ObjectFactory () | |
| template<typename DerivedType> | |
| bool | RegisterType (UniqueIdType id) |
| Registers a new type of object with the factory. | |
| void | RemoveType (UniqueIdType id) |
| Removes an existing object type from the factory's known list of object types. | |
| bool | IsTypeSupported (UniqueIdType id) const |
| Checks to see if the factory can create objects of the given type. | |
| void | GetSupportedTypes (std::vector< UniqueIdType > &types) const |
| Gets a list of types that this factory knows how to create. | |
| BaseType * | CreateObject (const UniqueIdType id) |
| Creates a new object. | |
| const ObjectMap & | GetMap () const |
Protected Member Functions | |
| virtual | ~ObjectFactory () |
It allows one to create any type of object as long as there is a common base class. The common base class is defined on a per-factory basis using the templated parameter BaseType.
| typedef UniqueIdTypeClass dtUtil::ObjectFactory< UniqueIdTypeClass, BaseTypeClass, ltCmpClass >::UniqueIdType |
| typedef BaseTypeClass dtUtil::ObjectFactory< UniqueIdTypeClass, BaseTypeClass, ltCmpClass >::BaseType |
| typedef ltCmpClass dtUtil::ObjectFactory< UniqueIdTypeClass, BaseTypeClass, ltCmpClass >::ltCmp |
| typedef BaseType*(* dtUtil::ObjectFactory< UniqueIdTypeClass, BaseTypeClass, ltCmpClass >::createObjectFunc)() |
| typedef std::map<UniqueIdType,createObjectFunc,ltCmp> dtUtil::ObjectFactory< UniqueIdTypeClass, BaseTypeClass, ltCmpClass >::ObjectMap |
Function pointer type for functions creating objects.
| typedef ObjectMap::iterator dtUtil::ObjectFactory< UniqueIdTypeClass, BaseTypeClass, ltCmpClass >::ObjTypeItor |
| typedef ObjectMap::const_iterator dtUtil::ObjectFactory< UniqueIdTypeClass, BaseTypeClass, ltCmpClass >::ObjTypeItorConst |
| dtUtil::ObjectFactory< UniqueIdTypeClass, BaseTypeClass, ltCmpClass >::ObjectFactory | ( | ) | [inline] |
| virtual dtUtil::ObjectFactory< UniqueIdTypeClass, BaseTypeClass, ltCmpClass >::~ObjectFactory | ( | ) | [inline, protected, virtual] |
| bool dtUtil::ObjectFactory< UniqueIdTypeClass, BaseTypeClass, ltCmpClass >::RegisterType | ( | UniqueIdType | id | ) | [inline] |
Registers a new type of object with the factory.
| void dtUtil::ObjectFactory< UniqueIdTypeClass, BaseTypeClass, ltCmpClass >::RemoveType | ( | UniqueIdType | id | ) | [inline] |
Removes an existing object type from the factory's known list of object types.
| bool dtUtil::ObjectFactory< UniqueIdTypeClass, BaseTypeClass, ltCmpClass >::IsTypeSupported | ( | UniqueIdType | id | ) | const [inline] |
Checks to see if the factory can create objects of the given type.
| id | The type of object to check for. |
| void dtUtil::ObjectFactory< UniqueIdTypeClass, BaseTypeClass, ltCmpClass >::GetSupportedTypes | ( | std::vector< UniqueIdType > & | types | ) | const [inline] |
Gets a list of types that this factory knows how to create.
| BaseType* dtUtil::ObjectFactory< UniqueIdTypeClass, BaseTypeClass, ltCmpClass >::CreateObject | ( | const UniqueIdType | id | ) | [inline] |
Creates a new object.
| id | - Type of object to create. |
| Exception | is thrown if the factory does not know how to create the requested type. |
| const ObjectMap& dtUtil::ObjectFactory< UniqueIdTypeClass, BaseTypeClass, ltCmpClass >::GetMap | ( | ) | const [inline] |