MDSTk Libraries  1.1.0
Medical Data Segmentation Toolkit
Public Types | Public Member Functions | Static Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | Friends
mds::base::CFactory< T, I > Class Template Reference

Implements a generic object factory. More...

#include <mdsFactory.h>

Inheritance diagram for mds::base::CFactory< T, I >:
Inheritance graph
[legend]

List of all members.

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

tObjectcreate (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.

Detailed Description

template<class T, typename I>
class mds::base::CFactory< T, I >

Implements a generic object factory.


Member Typedef Documentation

template<class T, typename I>
typedef tObject*(* mds::base::CFactory< T, I >::tCreationFunction)()

Object creation function.

template<class T, typename I>
typedef std::map<tIdentifier, tCreationFunction> mds::base::CFactory< T, I >::tFunctions [protected]

Map of creation functions.

template<class T, typename I>
typedef I mds::base::CFactory< T, I >::tIdentifier

Object identifier type.

template<class T, typename I>
typedef CLibraryLockableClass<CFactory<T,I> >::CLock mds::base::CFactory< T, I >::tLock

Lock type.

template<class T, typename I>
typedef T mds::base::CFactory< T, I >::tObject

Produced object type.


Member Enumeration Documentation

template<int L>
anonymous enum [inherited]

Templates that require members of the CSingleton class can use this enum to check the existence.

Enumerator:
CLASS_SINGLETON 
template<int L>
anonymous enum [inherited]

Object longevity.

Enumerator:
LONGEVITY 

Constructor & Destructor Documentation

template<class T, typename I>
mds::base::CFactory< T, I >::~CFactory ( )

Destructor.

template<class T, typename I>
mds::base::CFactory< T, I >::CFactory ( ) [protected]

Private constructor.


Member Function Documentation

template<class T, typename I>
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.

template<class T, typename I>
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.

template<class T, typename I>
bool mds::base::CFactory< T, I >::unregisterObject ( const tIdentifier Id)

Unregisters the object creation function.


Friends And Related Function Documentation

template<class T, typename I>
friend class mds::base::CSingletonHolder< CFactory > [friend]

Allow factory instantiation using singleton holder.


Member Data Documentation

template<class T, typename I>
tFunctions mds::base::CFactory< T, I >::m_Functions [protected]

Map of all registered creation functions.


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