CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Types | Private Attributes
edm::WorkerRegistry Class Reference

#include <WorkerRegistry.h>

Public Member Functions

void clear ()
 
WorkergetWorker (WorkerParams const &p, std::string const &moduleLabel)
 Retrieve the particular instance of the worker. More...
 
WorkerRegistryoperator= (WorkerRegistry const &)=delete
 
 WorkerRegistry (boost::shared_ptr< ActivityRegistry > areg)
 
 WorkerRegistry (WorkerRegistry const &)=delete
 
 ~WorkerRegistry ()
 

Private Types

typedef std::map< std::string,
boost::shared_ptr< Worker > > 
WorkerMap
 the container of workers More...
 

Private Attributes

boost::shared_ptr
< ActivityRegistry
actReg_
 
WorkerMap m_workerMap
 internal map of registered workers (owned). More...
 

Detailed Description

Definition at line 32 of file WorkerRegistry.h.

Member Typedef Documentation

typedef std::map<std::string, boost::shared_ptr<Worker> > edm::WorkerRegistry::WorkerMap
private

the container of workers

Definition at line 51 of file WorkerRegistry.h.

Constructor & Destructor Documentation

edm::WorkerRegistry::WorkerRegistry ( boost::shared_ptr< ActivityRegistry areg)
explicit

Definition at line 16 of file WorkerRegistry.cc.

16  :
17  m_workerMap(),
18  actReg_(areg)
19  {
20  }
boost::shared_ptr< ActivityRegistry > actReg_
WorkerMap m_workerMap
internal map of registered workers (owned).
edm::WorkerRegistry::~WorkerRegistry ( )

Definition at line 22 of file WorkerRegistry.cc.

References m_workerMap.

22  {
23  m_workerMap.clear();
24  }
WorkerMap m_workerMap
internal map of registered workers (owned).
edm::WorkerRegistry::WorkerRegistry ( WorkerRegistry const &  )
delete

Member Function Documentation

void edm::WorkerRegistry::clear ( void  )
Worker * edm::WorkerRegistry::getWorker ( WorkerParams const &  p,
std::string const &  moduleLabel 
)

Retrieve the particular instance of the worker.

If the worker with that set of parameters does not exist, create it

Note
Workers are owned by this class, do not delete them

Definition at line 30 of file WorkerRegistry.cc.

References actReg_, edm::Factory::get(), m_workerMap, and edm::Factory::makeWorker().

Referenced by edm::Schedule::fillWorkers(), and edm::Schedule::Schedule().

30  {
31 
32  WorkerMap::iterator workerIt = m_workerMap.find(moduleLabel);
33 
34  // if the worker is not there, make it
35  if (workerIt == m_workerMap.end()){
36 
37  auto workerPtr=
38  Factory::get()->makeWorker(p,actReg_->preModuleConstructionSignal_,
39  actReg_->postModuleConstructionSignal_);
40 
41  workerPtr->setActivityRegistry(actReg_);
42 
43  // Transfer ownership of worker to the registry
44  m_workerMap[moduleLabel].reset(workerPtr.release());
45  return m_workerMap[moduleLabel].get();
46  }
47  return (workerIt->second.get());
48  }
boost::shared_ptr< ActivityRegistry > actReg_
WorkerMap m_workerMap
internal map of registered workers (owned).
static Factory * get()
Definition: Factory.cc:29
std::unique_ptr< Worker > makeWorker(const WorkerParams &, signalslot::Signal< void(const ModuleDescription &)> &pre, signalslot::Signal< void(const ModuleDescription &)> &post) const
Definition: Factory.cc:34
WorkerRegistry& edm::WorkerRegistry::operator= ( WorkerRegistry const &  )
delete

Member Data Documentation

boost::shared_ptr<ActivityRegistry> edm::WorkerRegistry::actReg_
private

Definition at line 55 of file WorkerRegistry.h.

Referenced by getWorker().

WorkerMap edm::WorkerRegistry::m_workerMap
private

internal map of registered workers (owned).

Definition at line 54 of file WorkerRegistry.h.

Referenced by clear(), getWorker(), and ~WorkerRegistry().