CMS 3D CMS Logo

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 &&)=default
 
 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

◆ WorkerMap

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

the container of workers

Definition at line 57 of file WorkerRegistry.h.

Constructor & Destructor Documentation

◆ WorkerRegistry() [1/4]

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

Definition at line 18 of file WorkerRegistry.cc.

19  : modRegistry_(new ModuleRegistry), m_workerMap(), actReg_(areg) {}

◆ WorkerRegistry() [2/4]

edm::WorkerRegistry::WorkerRegistry ( std::shared_ptr< ActivityRegistry areg,
std::shared_ptr< ModuleRegistry iModReg 
)

Definition at line 21 of file WorkerRegistry.cc.

22  : modRegistry_(modReg), m_workerMap(), actReg_(areg) {}

◆ ~WorkerRegistry()

edm::WorkerRegistry::~WorkerRegistry ( )

Definition at line 24 of file WorkerRegistry.cc.

24 {}

◆ WorkerRegistry() [3/4]

edm::WorkerRegistry::WorkerRegistry ( WorkerRegistry &&  )
default

◆ WorkerRegistry() [4/4]

edm::WorkerRegistry::WorkerRegistry ( WorkerRegistry const &  )
delete

Member Function Documentation

◆ clear()

void edm::WorkerRegistry::clear ( void  )

Definition at line 26 of file WorkerRegistry.cc.

26 { m_workerMap.clear(); }

References m_workerMap.

◆ getWorker()

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 28 of file WorkerRegistry.cc.

28  {
29  WorkerMap::iterator workerIt = m_workerMap.find(moduleLabel);
30 
31  // if the worker is not there, make it
32  if (workerIt == m_workerMap.end()) {
33  MakeModuleParams mmp(p.pset_, *p.reg_, p.preallocate_, p.processConfiguration_);
34  auto modulePtr = modRegistry_->getModule(
35  mmp, moduleLabel, actReg_->preModuleConstructionSignal_, actReg_->postModuleConstructionSignal_);
36  auto workerPtr = modulePtr->makeWorker(p.actions_);
37 
38  workerPtr->setActivityRegistry(actReg_);
39 
40  // Transfer ownership of worker to the registry
42  std::shared_ptr<Worker>(workerPtr.release()); // propagate_const<T> has no reset() function
43  return m_workerMap[moduleLabel].get();
44  }
45  return (workerIt->second.get());
46  }

References actReg_, m_workerMap, modRegistry_, HerwigMaxPtPartonFilter_cfi::moduleLabel, and AlCaHLTBitMon_ParallelJobs::p.

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

◆ operator=()

WorkerRegistry& edm::WorkerRegistry::operator= ( WorkerRegistry const &  )
delete

Member Data Documentation

◆ actReg_

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

Definition at line 63 of file WorkerRegistry.h.

Referenced by getWorker().

◆ m_workerMap

WorkerMap edm::WorkerRegistry::m_workerMap
private

internal map of registered workers (owned).

Definition at line 62 of file WorkerRegistry.h.

Referenced by clear(), and getWorker().

◆ modRegistry_

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

Definition at line 59 of file WorkerRegistry.h.

Referenced by getWorker().

AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
edm::WorkerRegistry::m_workerMap
WorkerMap m_workerMap
internal map of registered workers (owned).
Definition: WorkerRegistry.h:62
edm::WorkerRegistry::actReg_
std::shared_ptr< ActivityRegistry > actReg_
Definition: WorkerRegistry.h:63
edm::WorkerRegistry::modRegistry_
edm::propagate_const< std::shared_ptr< ModuleRegistry > > modRegistry_
Definition: WorkerRegistry.h:59
HerwigMaxPtPartonFilter_cfi.moduleLabel
moduleLabel
Definition: HerwigMaxPtPartonFilter_cfi.py:4