VR-Forces 4.3 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator 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 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. More...

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 ()
 constructor
virtual ~DtFactoryTemplate ()
 Destructor: deletes factory and any entries on the factory.
virtual void addCreatorFcn (const T_Key &key, DtCreatorFcn fcn)
 Add a creator function to the factory.
virtual bool removeCreatorFcn (const T_Key &key)
 Remove a creator function with the given key.
virtual bool isKeyRegistered (const T_Key &key) const
virtual DtString creationObjectName () const
virtual const DtCreatorMapTypecreatorMap () const
virtual T_CreationObject * createNew (const T_Key &key) const
 Create and return a new instance of the type based on the creator functions and the type specified.

Static Public Member Functions

static DtFactoryTemplate
< T_CreationObject, T_Key > * 
create ()

Protected Attributes

DtCreatorMapType myCreatorMap

Private Member Functions

 DtFactoryTemplate (const DtFactoryTemplate &orig)
 Not implemented.
const DtFactoryTemplateoperator= (const DtFactoryTemplate &orig)
 Not implemented.

Detailed Description

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.

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

Member Data Documentation

template<typename T_CreationObject, typename T_Key>
DtCreatorMapType DtFactoryTemplate< T_CreationObject, T_Key >::myCreatorMap
protected

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

Document ID: Generated on Wed Mar 11 21:20:57 EDT 2015 from SVN revision 150940
Copyright © 2005-2014 VT MÄK. All Rights Reserved (www.mak.com)