DD4hep  1.30.0
Detector Description Toolkit for High Energy Physics
Classes | Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
Gaudi::PluginService::v1::Details::Registry Class Reference

In-memory database of the loaded factories. More...

#include <PluginServiceDetailsV1.h>

Classes

struct  FactoryInfo
 

Public Types

typedef std::string KeyType
 
typedef std::map< KeyType, std::string > Properties
 Type used for the properties implementation. More...
 
typedef std::map< KeyType, FactoryInfoFactoryMap
 Type used for the database implementation. More...
 

Public Member Functions

template<typename F , typename T , typename I >
FactoryInfoadd (const I &id, typename F::FuncType ptr)
 Add a factory to the database. More...
 
void * get (const std::string &id, const std::string &type) const
 Retrieve the factory for the given id. More...
 
const FactoryInfogetInfo (const std::string &id) const
 Retrieve the FactoryInfo object for an id. More...
 
RegistryaddProperty (const std::string &id, const std::string &k, const std::string &v)
 Add a property to an already existing FactoryInfo object (via its id.) More...
 
std::set< KeyTypeloadedFactoryNames () const
 Return a list of all the known and loaded factories. More...
 
const FactoryMapfactories () const
 Return the known factories (loading the list if not yet done). More...
 

Static Public Member Functions

static Registryinstance ()
 Retrieve the singleton instance of Registry. More...
 

Private Member Functions

 Registry ()
 
 Registry (const Registry &)
 Private copy constructor for the singleton pattern. More...
 
FactoryInfoadd (const std::string &id, void *factory, const std::string &type, const std::string &rtype, const std::string &className, const Properties &props=Properties())
 Add a factory to the database. More...
 
FactoryMapfactories ()
 Return the known factories (loading the list if not yet done). More...
 
void initialize ()
 

Private Attributes

bool m_initialized
 Flag recording if the registry has been initialized or not. More...
 
FactoryMap m_factories
 Internal storage for factories. More...
 
std::recursive_mutex m_mutex
 Mutex used to control concurrent access to the internal data. More...
 

Detailed Description

In-memory database of the loaded factories.

Definition at line 83 of file PluginServiceDetailsV1.h.

Member Typedef Documentation

◆ FactoryMap

Type used for the database implementation.

Definition at line 114 of file PluginServiceDetailsV1.h.

◆ KeyType

Definition at line 85 of file PluginServiceDetailsV1.h.

◆ Properties

Type used for the properties implementation.

Definition at line 88 of file PluginServiceDetailsV1.h.

Constructor & Destructor Documentation

◆ Registry() [1/2]

Gaudi::PluginService::v2::Details::Registry::Registry ( )
private

Private constructor for the singleton pattern. At construction time, the internal database of known factories is filled with the name of the libraries containing them, using the ".components" files in the LD_LIBRARY_PATH.

Definition at line 142 of file PluginServiceV1.cpp.

◆ Registry() [2/2]

Gaudi::PluginService::v1::Details::Registry::Registry ( const Registry )
inlineprivate

Private copy constructor for the singleton pattern.

Definition at line 159 of file PluginServiceDetailsV1.h.

Member Function Documentation

◆ add() [1/2]

template<typename F , typename T , typename I >
FactoryInfo& Gaudi::PluginService::v1::Details::Registry::add ( const I &  id,
typename F::FuncType  ptr 
)
inline

Add a factory to the database.

Definition at line 121 of file PluginServiceDetailsV1.h.

◆ add() [2/2]

Registry::FactoryInfo & Gaudi::PluginService::v1::Details::Registry::add ( const std::string &  id,
void *  factory,
const std::string &  type,
const std::string &  rtype,
const std::string &  className,
const Properties props = Properties() 
)
private

Add a factory to the database.

Definition at line 241 of file PluginServiceV1.cpp.

◆ addProperty()

Registry & Gaudi::PluginService::v2::Details::Registry::addProperty ( const std::string &  id,
const std::string &  k,
const std::string &  v 
)

Add a property to an already existing FactoryInfo object (via its id.)

Definition at line 303 of file PluginServiceV1.cpp.

◆ factories() [1/2]

Registry::FactoryMap & Gaudi::PluginService::v2::Details::Registry::factories ( )
inlineprivate

Return the known factories (loading the list if not yet done).

Definition at line 166 of file PluginServiceDetailsV1.h.

◆ factories() [2/2]

const Registry::FactoryMap & Gaudi::PluginService::v2::Details::Registry::factories ( ) const
inline

Return the known factories (loading the list if not yet done).

Definition at line 146 of file PluginServiceDetailsV1.h.

◆ get()

void * Gaudi::PluginService::v1::Details::Registry::get ( const std::string &  id,
const std::string &  type 
) const

Retrieve the factory for the given id.

Definition at line 266 of file PluginServiceV1.cpp.

◆ getInfo()

const Registry::FactoryInfo & Gaudi::PluginService::v2::Details::Registry::getInfo ( const std::string &  id) const

Retrieve the FactoryInfo object for an id.

Definition at line 295 of file PluginServiceV1.cpp.

◆ initialize()

void Gaudi::PluginService::v2::Details::Registry::initialize ( )
private

Initialize the registry loading the list of factories from the .component files in the library search path.

Definition at line 144 of file PluginServiceV1.cpp.

◆ instance()

Registry & Gaudi::PluginService::v2::Details::Registry::instance ( )
static

Retrieve the singleton instance of Registry.

Definition at line 136 of file PluginServiceV1.cpp.

◆ loadedFactoryNames()

std::set< Registry::KeyType > Gaudi::PluginService::v2::Details::Registry::loadedFactoryNames ( ) const

Return a list of all the known and loaded factories.

Definition at line 311 of file PluginServiceV1.cpp.

Member Data Documentation

◆ m_factories

FactoryMap Gaudi::PluginService::v1::Details::Registry::m_factories
private

Internal storage for factories.

Definition at line 179 of file PluginServiceDetailsV1.h.

◆ m_initialized

bool Gaudi::PluginService::v1::Details::Registry::m_initialized
private

Flag recording if the registry has been initialized or not.

Definition at line 176 of file PluginServiceDetailsV1.h.

◆ m_mutex

std::recursive_mutex Gaudi::PluginService::v1::Details::Registry::m_mutex
mutableprivate

Mutex used to control concurrent access to the internal data.

Definition at line 182 of file PluginServiceDetailsV1.h.


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