Class implements a factory pattern. More...

#include <objectFactory.hpp>

Public Types

typedef SmartPointer< T >(* CreateT) ()
 auxiliary definition of smart pointer More...
 

Public Member Functions

SmartPointer< T > getObject (std::string name)
 returns the a SmartPointer pointing new object of type dependent on string provided More...
 
void registerObject (std::string, CreateT)
 registers an object More...
 
 ~ObjectFactory ()
 destructor More...
 

Static Public Member Functions

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

Private Member Functions

 ObjectFactory ()
 constructor More...
 
 ObjectFactory (const ObjectFactory &)
 copy constructor More...
 
ObjectFactoryoperator= (const ObjectFactory &)
 assignment constructor More...
 

Private Attributes

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

Detailed Description

template<class T>
class julian::ObjectFactory< T >

Class implements a factory pattern.

Class implement singleton factory pattern. On the basis of string it creates the object and returns SmartPointer to this object.

More information see [28] [23]

Member Typedef Documentation

template<class T>
typedef SmartPointer<T>(* julian::ObjectFactory< T >::CreateT) ()

auxiliary definition of smart pointer

Constructor & Destructor Documentation

template<class T>
julian::ObjectFactory< T >::~ObjectFactory ( )
inline

destructor

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

constructor

Private constructors disables creating the instance of class

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

copy constructor

Private copy constructors disables copying the instance of class

Member Function Documentation

template<class T >
SmartPointer< T > julian::ObjectFactory< T >::getObject ( std::string  name)

returns the a SmartPointer pointing new object of type dependent on string provided

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

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

returns reference to instance of singleton factory

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

assignment constructor

Private assignment constructor disables copying the instance of class

template<class T >
void julian::ObjectFactory< T >::registerObject ( std::string  name,
CreateT  f 
)

registers an object

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

Member Data Documentation

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

Map holding the creators of class and their string codes.


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