![]() |
VR-Forces Developer's Guide
|
Template for factory classes that create an object (T_CreationObject) that is associated with a particular key (T_Key).The two template arguments are the object itself and then the type associated with that object. This template makes two assumptions: (1) The key object has a function with the signature "const DtString& string() const;" which returns the string representation of the key and (2) that the key has an implementation of the function signature "bool operator<(const T_Key& other) const" so that it can store the keys in the map.

Classes | |
| struct | DtFactoryTemplateEntry |
Public Types | |
| typedef T_CreationObject *(* | DtCreatorFcn )() |
| typedef std::map< T_Key, DtFactoryTemplateEntry > | DtCreatorMapType |
Public Member Functions | |
| DtFactoryTemplate () | |
| virtual | ~DtFactoryTemplate () |
| virtual void | addCreatorFcn (const T_Key &key, DtCreatorFcn fcn) |
| virtual bool | removeCreatorFcn (const T_Key &key) |
| virtual bool | isKeyRegistered (const T_Key &key) const |
| virtual DtString | creationObjectName () const |
| virtual const DtCreatorMapType & | creatorMap () const |
| virtual void | setAlwaysWarnOnlyOnce (bool) |
| bool | alwaysWarnOnlyOnce () const |
| virtual T_CreationObject * | createNew (const T_Key &key) const |
Static Public Member Functions | |
| static DtFactoryTemplate < T_CreationObject, T_Key > * | create () |
Protected Attributes | |
| DtCreatorMapType | myCreatorMap |
| bool | myAlwaysWarnOnlyOnce |
| std::map< T_Key, bool > | myMessageWarningFilters |
Private Member Functions | |
| DtFactoryTemplate (const DtFactoryTemplate &orig) | |
| const DtFactoryTemplate & | operator= (const DtFactoryTemplate &orig) |
| typedef T_CreationObject*(* DtFactoryTemplate< T_CreationObject, T_Key >::DtCreatorFcn)() |
| typedef std::map<T_Key, DtFactoryTemplateEntry> DtFactoryTemplate< T_CreationObject, T_Key >::DtCreatorMapType |
| DtFactoryTemplate< T_CreationObject, T_Key >::DtFactoryTemplate | ( | ) |
constructor
|
private |
Not implemented.
|
virtual |
Destructor: deletes factory and any entries on the factory.
|
private |
Not implemented.
|
virtual |
Add a creator function to the factory.
|
virtual |
Remove a creator function with the given key. Return true if the key is found.
|
virtual |
Create and return a new instance of the type based on the creator functions and the type specified. Prints a warning if not found. See creationTypeName().
|
virtual |
|
static |
|
virtual |
|
virtual |
|
virtual |
Whether or not to always warn only once, even if not registered. Default is true.
| bool DtFactoryTemplate< T_CreationObject, T_Key >::alwaysWarnOnlyOnce | ( | ) | const |
|
protected |
|
protected |
|
mutableprotected |