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 ObjectFactory & | instance () |
returns reference to instance of singleton factory More... | |
Private Member Functions | |
ObjectFactory () | |
constructor More... | |
ObjectFactory (const ObjectFactory &) | |
copy constructor More... | |
ObjectFactory & | operator= (const ObjectFactory &) |
assignment constructor More... | |
Private Attributes | |
std::map< std::string, CreateT > | creators |
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.
Member Typedef Documentation
typedef SmartPointer<T>(* julian::ObjectFactory< T >::CreateT) () |
auxiliary definition of smart pointer
Constructor & Destructor Documentation
|
inline |
destructor
|
inlineprivate |
constructor
Private constructors disables creating the instance of class
|
inlineprivate |
copy constructor
Private copy constructors disables copying the instance of class
Member Function Documentation
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).
|
static |
returns reference to instance of singleton factory
|
inlineprivate |
assignment constructor
Private assignment constructor disables copying the instance of class
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
|
private |
Map holding the creators of class and their string codes.
The documentation for this class was generated from the following file:
- C:/Unix/home/OEM/jULIAN/src/utils/objectFactory.hpp