PTLib  Version 2.10.11
PFactory< AbstractClass, KeyType > Class Template Reference

Template class for generic factories of an abstract class. More...

#include <pfactory.h>

Inheritance diagram for PFactory< AbstractClass, KeyType >:
PFactoryBase PDevicePluginFactory< AbstractClass, KeyType >

Classes

class  Worker
 
class  WorkerBase
 

Public Types

typedef KeyType Key_T
 
typedef AbstractClass Abstract_T
 
typedef std::map< Key_T, WorkerBase * > KeyMap_T
 
typedef std::vector< Key_TKeyList_T
 

Public Member Functions

virtual void DestroySingletons ()
 

Static Public Member Functions

static bool Register (const Key_T &key, WorkerBase *worker)
 
static bool Register (const Key_T &key, Abstract_T *instance, bool autoDeleteInstance=true)
 
static PBoolean RegisterAs (const Key_T &newKey, const Key_T &oldKey)
 
static void Unregister (const Key_T &key)
 
static void UnregisterAll ()
 
static bool IsRegistered (const Key_T &key)
 
static Abstract_TCreateInstance (const Key_T &key)
 
template<class Derived_T >
static Derived_T * CreateInstanceAs (const Key_T &key)
 
static PBoolean IsSingleton (const Key_T &key)
 
static KeyList_T GetKeyList ()
 
static KeyMap_TGetKeyMap ()
 
static PMutexGetMutex ()
 

Protected Member Functions

 PFactory ()
 
 ~PFactory ()
 
bool Register_Internal (const Key_T &key, WorkerBase *worker)
 
PBoolean RegisterAs_Internal (const Key_T &newKey, const Key_T &oldKey)
 
void Unregister_Internal (const Key_T &key)
 
void UnregisterAll_Internal ()
 
bool IsRegistered_Internal (const Key_T &key)
 
Abstract_TCreateInstance_Internal (const Key_T &key)
 
bool IsSingleton_Internal (const Key_T &key)
 
KeyList_T GetKeyList_Internal ()
 

Static Protected Member Functions

static PFactoryGetInstance ()
 

Protected Attributes

KeyMap_T m_keyMap
 

Detailed Description

template<class AbstractClass, typename KeyType = PDefaultPFactoryKey>
class PFactory< AbstractClass, KeyType >

Template class for generic factories of an abstract class.

Member Typedef Documentation

§ Abstract_T

template<class AbstractClass , typename KeyType = PDefaultPFactoryKey>
typedef AbstractClass PFactory< AbstractClass, KeyType >::Abstract_T

§ Key_T

template<class AbstractClass , typename KeyType = PDefaultPFactoryKey>
typedef KeyType PFactory< AbstractClass, KeyType >::Key_T

§ KeyList_T

template<class AbstractClass , typename KeyType = PDefaultPFactoryKey>
typedef std::vector<Key_T> PFactory< AbstractClass, KeyType >::KeyList_T

§ KeyMap_T

template<class AbstractClass , typename KeyType = PDefaultPFactoryKey>
typedef std::map<Key_T, WorkerBase *> PFactory< AbstractClass, KeyType >::KeyMap_T

Constructor & Destructor Documentation

§ PFactory()

template<class AbstractClass , typename KeyType = PDefaultPFactoryKey>
PFactory< AbstractClass, KeyType >::PFactory ( )
inlineprotected

§ ~PFactory()

template<class AbstractClass , typename KeyType = PDefaultPFactoryKey>
PFactory< AbstractClass, KeyType >::~PFactory ( )
inlineprotected

Member Function Documentation

§ CreateInstance()

template<class AbstractClass , typename KeyType = PDefaultPFactoryKey>
static Abstract_T* PFactory< AbstractClass, KeyType >::CreateInstance ( const Key_T key)
inlinestatic

§ CreateInstance_Internal()

template<class AbstractClass , typename KeyType = PDefaultPFactoryKey>
Abstract_T* PFactory< AbstractClass, KeyType >::CreateInstance_Internal ( const Key_T key)
inlineprotected

References PFactoryBase::m_mutex.

§ CreateInstanceAs()

template<class AbstractClass , typename KeyType = PDefaultPFactoryKey>
template<class Derived_T >
static Derived_T* PFactory< AbstractClass, KeyType >::CreateInstanceAs ( const Key_T key)
inlinestatic

§ DestroySingletons()

template<class AbstractClass , typename KeyType = PDefaultPFactoryKey>
virtual void PFactory< AbstractClass, KeyType >::DestroySingletons ( )
inlinevirtual

Implements PFactoryBase.

§ GetInstance()

template<class AbstractClass , typename KeyType = PDefaultPFactoryKey>
static PFactory& PFactory< AbstractClass, KeyType >::GetInstance ( )
inlinestaticprotected

§ GetKeyList()

template<class AbstractClass , typename KeyType = PDefaultPFactoryKey>
static KeyList_T PFactory< AbstractClass, KeyType >::GetKeyList ( )
inlinestatic

§ GetKeyList_Internal()

template<class AbstractClass , typename KeyType = PDefaultPFactoryKey>
KeyList_T PFactory< AbstractClass, KeyType >::GetKeyList_Internal ( )
inlineprotected

References PFactoryBase::m_mutex.

§ GetKeyMap()

template<class AbstractClass , typename KeyType = PDefaultPFactoryKey>
static KeyMap_T& PFactory< AbstractClass, KeyType >::GetKeyMap ( )
inlinestatic

§ GetMutex()

template<class AbstractClass , typename KeyType = PDefaultPFactoryKey>
static PMutex& PFactory< AbstractClass, KeyType >::GetMutex ( )
inlinestatic

§ IsRegistered()

template<class AbstractClass , typename KeyType = PDefaultPFactoryKey>
static bool PFactory< AbstractClass, KeyType >::IsRegistered ( const Key_T key)
inlinestatic

§ IsRegistered_Internal()

template<class AbstractClass , typename KeyType = PDefaultPFactoryKey>
bool PFactory< AbstractClass, KeyType >::IsRegistered_Internal ( const Key_T key)
inlineprotected

References PFactoryBase::m_mutex.

§ IsSingleton()

template<class AbstractClass , typename KeyType = PDefaultPFactoryKey>
static PBoolean PFactory< AbstractClass, KeyType >::IsSingleton ( const Key_T key)
inlinestatic

§ IsSingleton_Internal()

template<class AbstractClass , typename KeyType = PDefaultPFactoryKey>
bool PFactory< AbstractClass, KeyType >::IsSingleton_Internal ( const Key_T key)
inlineprotected

References PFactoryBase::m_mutex.

§ Register() [1/2]

template<class AbstractClass , typename KeyType = PDefaultPFactoryKey>
static bool PFactory< AbstractClass, KeyType >::Register ( const Key_T key,
WorkerBase worker 
)
inlinestatic

§ Register() [2/2]

template<class AbstractClass , typename KeyType = PDefaultPFactoryKey>
static bool PFactory< AbstractClass, KeyType >::Register ( const Key_T key,
Abstract_T instance,
bool  autoDeleteInstance = true 
)
inlinestatic

References PNEW.

§ Register_Internal()

template<class AbstractClass , typename KeyType = PDefaultPFactoryKey>
bool PFactory< AbstractClass, KeyType >::Register_Internal ( const Key_T key,
WorkerBase worker 
)
inlineprotected

§ RegisterAs()

template<class AbstractClass , typename KeyType = PDefaultPFactoryKey>
static PBoolean PFactory< AbstractClass, KeyType >::RegisterAs ( const Key_T newKey,
const Key_T oldKey 
)
inlinestatic

§ RegisterAs_Internal()

template<class AbstractClass , typename KeyType = PDefaultPFactoryKey>
PBoolean PFactory< AbstractClass, KeyType >::RegisterAs_Internal ( const Key_T newKey,
const Key_T oldKey 
)
inlineprotected

References PFactoryBase::m_mutex.

§ Unregister()

template<class AbstractClass , typename KeyType = PDefaultPFactoryKey>
static void PFactory< AbstractClass, KeyType >::Unregister ( const Key_T key)
inlinestatic

§ Unregister_Internal()

template<class AbstractClass , typename KeyType = PDefaultPFactoryKey>
void PFactory< AbstractClass, KeyType >::Unregister_Internal ( const Key_T key)
inlineprotected

References PFactoryBase::m_mutex.

§ UnregisterAll()

template<class AbstractClass , typename KeyType = PDefaultPFactoryKey>
static void PFactory< AbstractClass, KeyType >::UnregisterAll ( )
inlinestatic

§ UnregisterAll_Internal()

template<class AbstractClass , typename KeyType = PDefaultPFactoryKey>
void PFactory< AbstractClass, KeyType >::UnregisterAll_Internal ( )
inlineprotected

References PFactoryBase::m_mutex.

Member Data Documentation

§ m_keyMap

template<class AbstractClass , typename KeyType = PDefaultPFactoryKey>
KeyMap_T PFactory< AbstractClass, KeyType >::m_keyMap
protected

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