Main Page   Modules   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

IDEA::Factory< Type > Class Template Reference
[Utilities]

Factory base class. More...

#include <Factory.hh>

List of all members.

Public Methods

 Factory (const std::string &key)
 Constructor, will register itself to the pool of available Factory instances using key.

virtual ~Factory ()
 Destructor, will un register itself using it's own key.

const std::string & getKey () const
 Returns the key of the invoking Factory.


Static Public Methods

void useKey (const std::string &key)
 Sets the key to use to return the instance, see Factory::instance.

const Type * instance ()
 Returns the instance with key Factory::getUseKey. If no such key exists 0 is returned.


Private Types

typedef std::map< std::string,
const Factory * > 
String2Type

Private Methods

 Factory ()
 Default constructor, not implemented by design.

 Factory (const Factory &factory)
 Copy constructor, not implemented by design.


Static Private Methods

std::string & getUseKey ()
 The use key.

String2TypegetContainer ()
 Creates the container to store instances.

void registerFactory (const Factory *factory)
 Stores factory in s_Instances using Factory::getKey.

void unRegisterFactory (const Factory *factory)
 Removes factory from s_Instances (it in it).


Private Attributes

std::string m_Key
 Key of the instance.


Detailed Description

template<class Type>
class IDEA::Factory< Type >

Factory base class.

Author:
David Rijsman rijsman@email.arc.nasa.gov


Member Typedef Documentation

template<class Type>
typedef std::map< std::string, const Factory* > IDEA::Factory< Type >::String2Type [private]
 


Constructor & Destructor Documentation

template<class Type>
IDEA::Factory< Type >::Factory const std::string &    key [inline]
 

Constructor, will register itself to the pool of available Factory instances using key.

template<class Type>
virtual IDEA::Factory< Type >::~Factory   [inline, virtual]
 

Destructor, will un register itself using it's own key.

template<class Type>
IDEA::Factory< Type >::Factory   [private]
 

Default constructor, not implemented by design.

template<class Type>
IDEA::Factory< Type >::Factory const Factory< Type > &    factory [private]
 

Copy constructor, not implemented by design.


Member Function Documentation

template<class Type>
String2Type& IDEA::Factory< Type >::getContainer   [inline, static, private]
 

Creates the container to store instances.

This pattern is used to prevent "static initialization order fiasco" (Google this for better understanding)

template<class Type>
const std::string& IDEA::Factory< Type >::getKey   const [inline]
 

Returns the key of the invoking Factory.

template<class Type>
std::string& IDEA::Factory< Type >::getUseKey   [inline, static, private]
 

The use key.

This pattern is used to prevent "static initialization order fiasco" (Google this for better understanding)

template<class Type>
const Type* IDEA::Factory< Type >::instance   [inline, static]
 

Returns the instance with key Factory::getUseKey. If no such key exists 0 is returned.

template<class Type>
void IDEA::Factory< Type >::registerFactory const Factory< Type > *    factory [inline, static, private]
 

Stores factory in s_Instances using Factory::getKey.

template<class Type>
void IDEA::Factory< Type >::unRegisterFactory const Factory< Type > *    factory [inline, static, private]
 

Removes factory from s_Instances (it in it).

template<class Type>
void IDEA::Factory< Type >::useKey const std::string &    key [inline, static]
 

Sets the key to use to return the instance, see Factory::instance.


Member Data Documentation

template<class Type>
std::string IDEA::Factory< Type >::m_Key [private]
 

Key of the instance.


Contact information
© IDEA
Generated on Fri Feb 3 17:09:45 2006 for IDEA.