MDSTk Libraries
1.1.0
Medical Data Segmentation Toolkit
|
Implements a generic object factory. More...
#include <mdsFactory.h>
Public Types | |
enum | { CLASS_SINGLETON } |
Templates that require members of the CSingleton class can use this enum to check the existence. More... | |
enum | { LONGEVITY = L } |
Object longevity. More... | |
typedef tObject *(* | tCreationFunction )() |
Object creation function. | |
typedef I | tIdentifier |
Object identifier type. | |
typedef CLibraryLockableClass < CFactory< T, I > >::CLock | tLock |
Lock type. | |
typedef T | tObject |
Produced object type. | |
Public Member Functions | |
tObject * | create (const tIdentifier &Id) |
Creates a new object having the identifier 'Id'. | |
bool | registerObject (const tIdentifier &Id, tCreationFunction Function) |
Registers an object creation function. | |
bool | unregisterObject (const tIdentifier &Id) |
Unregisters the object creation function. | |
~CFactory () | |
Destructor. | |
Static Public Member Functions | |
static void | lock () |
Locks the object. | |
static void | unlock () |
Locks the object. | |
Protected Types | |
typedef std::map< tIdentifier, tCreationFunction > | tFunctions |
Map of creation functions. | |
Protected Member Functions | |
CFactory () | |
Private constructor. | |
Protected Attributes | |
tFunctions | m_Functions |
Map of all registered creation functions. | |
Friends | |
class | mds::base::CSingletonHolder< CFactory > |
Allow factory instantiation using singleton holder. |
Implements a generic object factory.
typedef tObject*(* mds::base::CFactory< T, I >::tCreationFunction)() |
Object creation function.
typedef std::map<tIdentifier, tCreationFunction> mds::base::CFactory< T, I >::tFunctions [protected] |
Map of creation functions.
typedef I mds::base::CFactory< T, I >::tIdentifier |
Object identifier type.
typedef CLibraryLockableClass<CFactory<T,I> >::CLock mds::base::CFactory< T, I >::tLock |
Lock type.
typedef T mds::base::CFactory< T, I >::tObject |
Produced object type.
anonymous enum [inherited] |
Templates that require members of the CSingleton class can use this enum to check the existence.
mds::base::CFactory< T, I >::~CFactory | ( | ) |
Destructor.
mds::base::CFactory< T, I >::CFactory | ( | ) | [protected] |
Private constructor.
tObject* mds::base::CFactory< T, I >::create | ( | const tIdentifier & | Id | ) |
Creates a new object having the identifier 'Id'.
static void mds::base::CLockableClass< CFactory< T, I > >::lock | ( | ) | [static, inherited] |
Locks the object.
bool mds::base::CFactory< T, I >::registerObject | ( | const tIdentifier & | Id, |
tCreationFunction | Function | ||
) |
Registers an object creation function.
static void mds::base::CLockableClass< CFactory< T, I > >::unlock | ( | ) | [static, inherited] |
Locks the object.
bool mds::base::CFactory< T, I >::unregisterObject | ( | const tIdentifier & | Id | ) |
Unregisters the object creation function.
friend class mds::base::CSingletonHolder< CFactory > [friend] |
Allow factory instantiation using singleton holder.
tFunctions mds::base::CFactory< T, I >::m_Functions [protected] |
Map of all registered creation functions.