Factory< AbstractProduct, IdentifierType, Initializator, ProductCreator, FactoryErrorPolicy > Class Template Reference

Implementation of a generic object factory. More...

#include <Factory.h>

List of all members.

Public Member Functions

bool Register (const IdentifierType &id, ProductCreator creator)
 Register selected object.
bool Unregister (const IdentifierType &id)
 Unregister selected object.
AbstractProduct * CreateObject (const IdentifierType &id, const Initializator &init)
 Creates instance of the selected object.

Private Types

typedef std::map< IdentifierType,
ProductCreator > 
IdToProductMap
 Type of container used to store object id's.

Private Attributes

IdToProductMap associations
 Container used to store object id's.


Detailed Description

template<class AbstractProduct, typename IdentifierType, typename Initializator, typename ProductCreator = AbstractProduct * (*)(const Initializator &), template< typename, class > class FactoryErrorPolicy = DefaultFactoryError>
class Factory< AbstractProduct, IdentifierType, Initializator, ProductCreator, FactoryErrorPolicy >

Implementation of a generic object factory.

This version creates instances with function having one parameter to initialize object.


Member Typedef Documentation

template<class AbstractProduct, typename IdentifierType, typename Initializator, typename ProductCreator = AbstractProduct * (*)(const Initializator &), template< typename, class > class FactoryErrorPolicy = DefaultFactoryError>
typedef std::map<IdentifierType, ProductCreator> Factory< AbstractProduct, IdentifierType, Initializator, ProductCreator, FactoryErrorPolicy >::IdToProductMap [private]

Type of container used to store object id's.


Member Function Documentation

template<class AbstractProduct, typename IdentifierType, typename Initializator, typename ProductCreator = AbstractProduct * (*)(const Initializator &), template< typename, class > class FactoryErrorPolicy = DefaultFactoryError>
AbstractProduct* Factory< AbstractProduct, IdentifierType, Initializator, ProductCreator, FactoryErrorPolicy >::CreateObject ( const IdentifierType id,
const Initializator &  init 
) [inline]

Creates instance of the selected object.

Parameters:
id Selected object id
init Initializator of the selected object

template<class AbstractProduct, typename IdentifierType, typename Initializator, typename ProductCreator = AbstractProduct * (*)(const Initializator &), template< typename, class > class FactoryErrorPolicy = DefaultFactoryError>
bool Factory< AbstractProduct, IdentifierType, Initializator, ProductCreator, FactoryErrorPolicy >::Register ( const IdentifierType id,
ProductCreator  creator 
) [inline]

Register selected object.

Parameters:
id Selected object id
creator Creator that will be used to create instance

template<class AbstractProduct, typename IdentifierType, typename Initializator, typename ProductCreator = AbstractProduct * (*)(const Initializator &), template< typename, class > class FactoryErrorPolicy = DefaultFactoryError>
bool Factory< AbstractProduct, IdentifierType, Initializator, ProductCreator, FactoryErrorPolicy >::Unregister ( const IdentifierType id  )  [inline]

Unregister selected object.

Parameters:
id Selected object id


Member Data Documentation

template<class AbstractProduct, typename IdentifierType, typename Initializator, typename ProductCreator = AbstractProduct * (*)(const Initializator &), template< typename, class > class FactoryErrorPolicy = DefaultFactoryError>
IdToProductMap Factory< AbstractProduct, IdentifierType, Initializator, ProductCreator, FactoryErrorPolicy >::associations [private]

Container used to store object id's.


The documentation for this class was generated from the following file:
Generated on Sun Apr 29 11:46:11 2007 for IPP/ICP2007 by  doxygen 1.4.7