PARTONS  
PARtonic Tomography Of Nucleon Software
Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
PARTONS::BaseObjectFactory Class Reference

Provides a clone (returned as a BaseObject pointer) of an object identified by its class name and previously stored in the BaseObjectRegistry. More...

Public Member Functions

virtual ~BaseObjectFactory ()
 Default destructor. More...
 
BaseObjectnewBaseObject (unsigned int classId)
 Provides a clone of the desired object class stored in the registry identified by its integer identifier. More...
 
BaseObjectnewBaseObject (const std::string &className)
 Provides a clone of the desired object class stored in the registry identified by its string class name. More...
 
void removeFromStore (unsigned int baseObjectUniqueId)
 Remove an object from the factory. More...
 

Private Member Functions

 BaseObjectFactory (BaseObjectRegistry *pBaseObjectRegistry)
 Private default constructor to ensure the creation of a single instance of the class, managed by Parton's class. More...
 
void store (BaseObject *pBaseObject)
 Store cloned object pointer to its instantiated object map. More...
 

Private Attributes

sf::Mutex m_mutex
 Mutex to secure concurrent access to the map of instanciated obejcts. More...
 
BaseObjectRegistrym_pBaseObjectRegistry
 Pointer to ask BaseObjectRegistry pointer associated to a specific object class. More...
 
std::map< unsigned int, BaseObject * > m_pInstantiatedObject
 Store BaseObject pointer created by the factory; used at the end of the program to delete orphan pointer. More...
 

Friends

class Partons
 

Detailed Description

Provides a clone (returned as a BaseObject pointer) of an object identified by its class name and previously stored in the BaseObjectRegistry.

Furthermore, a pointer to each clone is registered in order to destroy it later on if it becomes orphan.
This class is only instantiable by the class Partons to avoid any error at the initialization of the program.

Constructor & Destructor Documentation

◆ ~BaseObjectFactory()

PARTONS::BaseObjectFactory::~BaseObjectFactory ( )
virtual

Default destructor.

◆ BaseObjectFactory()

PARTONS::BaseObjectFactory::BaseObjectFactory ( BaseObjectRegistry pBaseObjectRegistry)
private

Private default constructor to ensure the creation of a single instance of the class, managed by Parton's class.

Parameters
pBaseObjectRegistry

Member Function Documentation

◆ newBaseObject() [1/2]

BaseObject * PARTONS::BaseObjectFactory::newBaseObject ( const std::string &  className)

Provides a clone of the desired object class stored in the registry identified by its string class name.

Parameters
classId
Returns

◆ newBaseObject() [2/2]

BaseObject * PARTONS::BaseObjectFactory::newBaseObject ( unsigned int  classId)

Provides a clone of the desired object class stored in the registry identified by its integer identifier.

Parameters
classId
Returns

◆ removeFromStore()

void PARTONS::BaseObjectFactory::removeFromStore ( unsigned int  baseObjectUniqueId)

Remove an object from the factory.

Parameters
baseObjectUniqueIdUnique id identifying each object.

◆ store()

void PARTONS::BaseObjectFactory::store ( BaseObject pBaseObject)
private

Store cloned object pointer to its instantiated object map.

Parameters
pBaseObject

Friends And Related Function Documentation

◆ Partons

friend class Partons
friend

Member Data Documentation

◆ m_mutex

sf::Mutex PARTONS::BaseObjectFactory::m_mutex
private

Mutex to secure concurrent access to the map of instanciated obejcts.

◆ m_pBaseObjectRegistry

BaseObjectRegistry* PARTONS::BaseObjectFactory::m_pBaseObjectRegistry
private

Pointer to ask BaseObjectRegistry pointer associated to a specific object class.

◆ m_pInstantiatedObject

std::map<unsigned int, BaseObject*> PARTONS::BaseObjectFactory::m_pInstantiatedObject
private

Store BaseObject pointer created by the factory; used at the end of the program to delete orphan pointer.


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