Class implements a factory pattern. More...

#include <valueFactory.hpp>

Public Member Functions

getValue (std::string name)
 returns enumeration value More...
 
void registerValue (std::string, T)
 registers an enumeration value More...
 

Static Public Member Functions

static ValueFactoryinstance ()
 returns reference to instance of singleton factory More...
 

Private Member Functions

 ValueFactory ()
 constructor More...
 
 ValueFactory (const ValueFactory &)
 copy constructor More...
 
ValueFactoryoperator= (const ValueFactory &)
 assignment constructor More...
 

Private Attributes

std::map< std::string, T > creators
 Map holding the creators of class and their string codes. More...
 

Detailed Description

template<class T>
class julian::ValueFactory< T >

Class implements a factory pattern.

Class implement singleton factory pattern. On the basis of string it creates the enumeration value is created.

More information see [28] [23]

Constructor & Destructor Documentation

template<class T>
julian::ValueFactory< T >::ValueFactory ( )
inlineprivate

constructor

Private constructors disables creating the instance of class

template<class T>
julian::ValueFactory< T >::ValueFactory ( const ValueFactory< T > &  )
inlineprivate

copy constructor

Private copy constructors disables copying the instance of class

Member Function Documentation

template<class T >
T julian::ValueFactory< T >::getValue ( std::string  name)

returns enumeration value

If the key was not found in map, the default object is returned (first in map).

template<class T >
ValueFactory< T > & julian::ValueFactory< T >::instance ( )
static

returns reference to instance of singleton factory

template<class T>
ValueFactory& julian::ValueFactory< T >::operator= ( const ValueFactory< T > &  )
inlineprivate

assignment constructor

Private assignment constructor disables copying the instance of class

template<class T >
void julian::ValueFactory< T >::registerValue ( std::string  name,
x 
)

registers an enumeration value

Factory returns the enum basing on provided string, but first appropriate mapping must be created. This method registers the enum value

Member Data Documentation

template<class T>
std::map<std::string,T> julian::ValueFactory< T >::creators
private

Map holding the creators of class and their string codes.


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