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

The Registry of all workers that where requested Holds all instances of workers. In this implementation, Workers are owned. More...

#include "edm/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 (std::shared_ptr< ActivityRegistry > areg)
 
 WorkerRegistry (std::shared_ptr< ActivityRegistry > areg, std::shared_ptr< ModuleRegistry > iModReg)
 
 WorkerRegistry (WorkerRegistry const &)=delete
 
 ~WorkerRegistry ()
 

Private Types

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

Private Attributes

std::shared_ptr< ActivityRegistryactReg_
 
WorkerMap m_workerMap
 internal map of registered workers (owned). More...
 
edm::propagate_const
< std::shared_ptr
< ModuleRegistry > > 
modRegistry_
 

Detailed Description

The Registry of all workers that where requested Holds all instances of workers. In this implementation, Workers are owned.

Definition at line 38 of file WorkerRegistry.h.

Member Typedef Documentation

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

the container of workers

Definition at line 59 of file WorkerRegistry.h.

Constructor & Destructor Documentation

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

Definition at line 18 of file WorkerRegistry.cc.

18  :
19  modRegistry_(new ModuleRegistry),
20  m_workerMap(),
21  actReg_(areg)
22  {
23  }
std::shared_ptr< ActivityRegistry > actReg_
WorkerMap m_workerMap
internal map of registered workers (owned).
areg
Definition: Schedule.cc:384
edm::propagate_const< std::shared_ptr< ModuleRegistry > > modRegistry_
edm::WorkerRegistry::WorkerRegistry ( std::shared_ptr< ActivityRegistry areg,
std::shared_ptr< ModuleRegistry iModReg 
)

Definition at line 25 of file WorkerRegistry.cc.

26  :
27  modRegistry_(modReg),
28  m_workerMap(),
29  actReg_(areg)
30  {
31  }
std::shared_ptr< ActivityRegistry > actReg_
WorkerMap m_workerMap
internal map of registered workers (owned).
areg
Definition: Schedule.cc:384
edm::propagate_const< std::shared_ptr< ModuleRegistry > > modRegistry_
edm::WorkerRegistry::~WorkerRegistry ( )

Definition at line 33 of file WorkerRegistry.cc.

33  {
34  }
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 40 of file WorkerRegistry.cc.

References edm::WorkerParams::actions_, actReg_, m_workerMap, modRegistry_, edm::WorkerParams::preallocate_, edm::WorkerParams::processConfiguration_, edm::WorkerParams::pset_, and edm::WorkerParams::reg_.

Referenced by edm::WorkerManager::getWorker().

40  {
41 
42  WorkerMap::iterator workerIt = m_workerMap.find(moduleLabel);
43 
44  // if the worker is not there, make it
45  if (workerIt == m_workerMap.end()){
46  MakeModuleParams mmp(p.pset_,*p.reg_,p.preallocate_,p.processConfiguration_);
47  auto modulePtr = modRegistry_->getModule(mmp,moduleLabel,
48  actReg_->preModuleConstructionSignal_,
49  actReg_->postModuleConstructionSignal_);
50  auto workerPtr= modulePtr->makeWorker(p.actions_);
51 
52  workerPtr->setActivityRegistry(actReg_);
53 
54  // Transfer ownership of worker to the registry
55  m_workerMap[moduleLabel] = std::shared_ptr<Worker>(workerPtr.release()); // propagate_const<T> has no reset() function
56  return m_workerMap[moduleLabel].get();
57  }
58  return (workerIt->second.get());
59  }
std::shared_ptr< ActivityRegistry > actReg_
WorkerMap m_workerMap
internal map of registered workers (owned).
edm::propagate_const< std::shared_ptr< ModuleRegistry > > modRegistry_
WorkerRegistry& edm::WorkerRegistry::operator= ( WorkerRegistry const &  )
delete

Member Data Documentation

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

Definition at line 65 of file WorkerRegistry.h.

Referenced by getWorker().

WorkerMap edm::WorkerRegistry::m_workerMap
private

internal map of registered workers (owned).

Definition at line 64 of file WorkerRegistry.h.

Referenced by clear(), and getWorker().

edm::propagate_const<std::shared_ptr<ModuleRegistry> > edm::WorkerRegistry::modRegistry_
private

Definition at line 61 of file WorkerRegistry.h.

Referenced by getWorker().