PTLib Version 2.12.9

- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Classes | Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
PFactoryBase Class Referenceabstract

Base class for generic factories. More...

`#include <pfactory.h>`

Inheritance diagram for PFactoryBase:
[legend]
Collaboration diagram for PFactoryBase:
[legend]

## Classes
class | FactoryMap

## Public Member Functions
virtual | ~PFactoryBase ()
virtual void | DestroySingletons ()=0

## Static Public Member Functions
static FactoryMap & | GetFactories ()

## Protected Member Functions
| PFactoryBase ()

## Static Protected Member Functions
static PFactoryBase & | InternalGetFactory (const std::string &className, PFactoryBase *(*createFactory)())
template<class TheFactory >
static PFactoryBase * | CreateFactory ()
template<class TheFactory >
static TheFactory & | GetFactoryAs ()

## Protected Attributes
PMutex | m_mutex

## Detailed Description

Base class for generic factories.

This classes reason for existance and the FactoryMap contained within it is to resolve issues with static global construction order and Windows DLL multiple instances issues. THis mechanism guarantees that the one and one only global variable (inside the GetFactories() function) is initialised before any other factory related instances of classes.

## Constructor & Destructor Documentation

PFactoryBase::PFactoryBase | ( |  | ) |
| inline protected

virtual PFactoryBase::~PFactoryBase | ( |  | ) |
| inline virtual

## Member Function Documentation

template<class TheFactory >

static PFactoryBase* PFactoryBase::CreateFactory | ( |  | ) |
| inline static protected

virtual void PFactoryBase::DestroySingletons | ( |  | ) |
| pure virtual

Implemented in PFactoryTemplate< AbstractClass, ParamType, KeyType >, and PFactoryTemplate< AbstractClass, const KeyType &, KeyType >.

static FactoryMap& PFactoryBase::GetFactories | ( |  | ) |
| static

template<class TheFactory >

static TheFactory& PFactoryBase::GetFactoryAs | ( |  | ) |
| inline static protected

References InternalGetFactory().

static PFactoryBase& PFactoryBase::InternalGetFactory | ( | const std::string & | className,
|  | PFactoryBase *(*)() | createFactory
| ) |  |
| static protected

Referenced by GetFactoryAs().

## Member Data Documentation

PMutex PFactoryBase::m_mutex
| protected

Referenced by PFactoryTemplate< AbstractClass, const KeyType &, KeyType >::InternalCreateInstance(), PFactoryTemplate< AbstractClass, const KeyType &, KeyType >::InternalDestroy(), PFactoryTemplate< AbstractClass, const KeyType &, KeyType >::InternalGetKeyList(), PFactoryTemplate< AbstractClass, const KeyType &, KeyType >::InternalIsRegistered(), PFactoryTemplate< AbstractClass, const KeyType &, KeyType >::InternalIsSingleton(), PFactoryTemplate< AbstractClass, const KeyType &, KeyType >::InternalRegister(), PFactoryTemplate< AbstractClass, const KeyType &, KeyType >::InternalRegisterAs(), PFactoryTemplate< AbstractClass, const KeyType &, KeyType >::InternalUnregister(), and PFactoryTemplate< AbstractClass, const KeyType &, KeyType >::InternalUnregisterAll().

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

- pfactory.h