VR-Forces 5.0.2 Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Classes | Public Types | Public Member Functions | Static Public Member Functions | Protected Attributes | Private Member Functions
DtFactoryTemplate< T_CreationObject, T_Key > Class Template Reference

template<typename T_CreationObject, typename T_Key>
class DtFactoryTemplate< T_CreationObject, T_Key >

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.

Inheritance diagram for DtFactoryTemplate< T_CreationObject, T_Key >:
Inheritance graph
[legend]

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 DtCreatorMapTypecreatorMap () 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, boolmyMessageWarningFilters
 

Private Member Functions

 DtFactoryTemplate (const DtFactoryTemplate &orig)
 
const DtFactoryTemplateoperator= (const DtFactoryTemplate &orig)
 

Member Typedef Documentation

template<typename T_CreationObject, typename T_Key>
typedef T_CreationObject*(* DtFactoryTemplate< T_CreationObject, T_Key >::DtCreatorFcn)()
template<typename T_CreationObject, typename T_Key>
typedef std::map<T_Key, DtFactoryTemplateEntry> DtFactoryTemplate< T_CreationObject, T_Key >::DtCreatorMapType

Constructor & Destructor Documentation

template<typename T_CreationObject, typename T_Key>
DtFactoryTemplate< T_CreationObject, T_Key >::DtFactoryTemplate ( )

constructor

template<typename T_CreationObject, typename T_Key>
DtFactoryTemplate< T_CreationObject, T_Key >::DtFactoryTemplate ( const DtFactoryTemplate< T_CreationObject, T_Key > &  orig)
private

Not implemented.

template<typename T_CreationObject, typename T_Key>
virtual DtFactoryTemplate< T_CreationObject, T_Key >::~DtFactoryTemplate ( )
virtual

Destructor: deletes factory and any entries on the factory.

Member Function Documentation

template<typename T_CreationObject, typename T_Key>
const DtFactoryTemplate& DtFactoryTemplate< T_CreationObject, T_Key >::operator= ( const DtFactoryTemplate< T_CreationObject, T_Key > &  orig)
private

Not implemented.

template<typename T_CreationObject, typename T_Key>
virtual void DtFactoryTemplate< T_CreationObject, T_Key >::addCreatorFcn ( const T_Key &  key,
DtCreatorFcn  fcn 
)
virtual

Add a creator function to the factory.

template<typename T_CreationObject, typename T_Key>
virtual bool DtFactoryTemplate< T_CreationObject, T_Key >::removeCreatorFcn ( const T_Key &  key)
virtual

Remove a creator function with the given key. Return true if the key is found.

template<typename T_CreationObject, typename T_Key>
virtual T_CreationObject* DtFactoryTemplate< T_CreationObject, T_Key >::createNew ( const T_Key &  key) const
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().

template<typename T_CreationObject, typename T_Key>
virtual bool DtFactoryTemplate< T_CreationObject, T_Key >::isKeyRegistered ( const T_Key &  key) const
virtual
template<typename T_CreationObject, typename T_Key>
static DtFactoryTemplate<T_CreationObject, T_Key>* DtFactoryTemplate< T_CreationObject, T_Key >::create ( )
static
template<typename T_CreationObject, typename T_Key>
virtual DtString DtFactoryTemplate< T_CreationObject, T_Key >::creationObjectName ( ) const
virtual
Returns
The name of the creation object that will be printed in any errors. Errors are printed when a creation call is made and no creator is found. Default implementation returns "data".
template<typename T_CreationObject, typename T_Key>
virtual const DtCreatorMapType& DtFactoryTemplate< T_CreationObject, T_Key >::creatorMap ( ) const
virtual
template<typename T_CreationObject, typename T_Key>
virtual void DtFactoryTemplate< T_CreationObject, T_Key >::setAlwaysWarnOnlyOnce ( bool  )
virtual

Whether or not to always warn only once, even if not registered. Default is true.

template<typename T_CreationObject, typename T_Key>
bool DtFactoryTemplate< T_CreationObject, T_Key >::alwaysWarnOnlyOnce ( ) const

Member Data Documentation

template<typename T_CreationObject, typename T_Key>
DtCreatorMapType DtFactoryTemplate< T_CreationObject, T_Key >::myCreatorMap
protected
template<typename T_CreationObject, typename T_Key>
bool DtFactoryTemplate< T_CreationObject, T_Key >::myAlwaysWarnOnlyOnce
protected
template<typename T_CreationObject, typename T_Key>
std::map<T_Key, bool> DtFactoryTemplate< T_CreationObject, T_Key >::myMessageWarningFilters
mutableprotected

The documentation for this class was generated from the following file:

Document ID: Generated on Sun Dec 4 20:22:03 EST 2022 from SVN revision 249613
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)