CMS 3D CMS Logo

WorkerRegistry.cc
Go to the documentation of this file.
1 
8 #include <memory>
15 
16 namespace edm {
17 
18  WorkerRegistry::WorkerRegistry(std::shared_ptr<ActivityRegistry> areg)
19  : modRegistry_(new ModuleRegistry), m_workerMap(), actReg_(areg) {}
20 
21  WorkerRegistry::WorkerRegistry(std::shared_ptr<ActivityRegistry> areg, std::shared_ptr<ModuleRegistry> modReg)
22  : modRegistry_(modReg), m_workerMap(), actReg_(areg) {}
23 
25 
26  void WorkerRegistry::clear() { m_workerMap.clear(); }
27 
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  }
47 } // namespace edm
edm
HLT enums.
Definition: AlignableModifier.h:19
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::MakeModuleParams
Definition: MakeModuleParams.h:21
edm::WorkerRegistry::clear
void clear()
Definition: WorkerRegistry.cc:26
edm::WorkerRegistry::WorkerRegistry
WorkerRegistry(std::shared_ptr< ActivityRegistry > areg)
Definition: WorkerRegistry.cc:18
ActivityRegistry.h
edm::WorkerRegistry::getWorker
Worker * getWorker(WorkerParams const &p, std::string const &moduleLabel)
Retrieve the particular instance of the worker.
Definition: WorkerRegistry.cc:28
edm::Worker
Definition: Worker.h:83
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
MakeModuleParams.h
edm::WorkerParams
Definition: WorkerParams.h:22
edm::WorkerRegistry::actReg_
std::shared_ptr< ActivityRegistry > actReg_
Definition: WorkerRegistry.h:63
ModuleRegistry.h
edm::ModuleRegistry
Definition: ModuleRegistry.h:40
ModuleHolder.h
edm::WorkerRegistry::modRegistry_
edm::propagate_const< std::shared_ptr< ModuleRegistry > > modRegistry_
Definition: WorkerRegistry.h:59
Worker.h
WorkerRegistry.h
HerwigMaxPtPartonFilter_cfi.moduleLabel
moduleLabel
Definition: HerwigMaxPtPartonFilter_cfi.py:4
edm::WorkerRegistry::~WorkerRegistry
~WorkerRegistry()
Definition: WorkerRegistry.cc:24