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()) {
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
PreallocationConfiguration const * preallocate_
Definition: WorkerParams.h:38
ParameterSet * pset_
Definition: WorkerParams.h:36
std::shared_ptr< ActivityRegistry > actReg_
WorkerRegistry(std::shared_ptr< ActivityRegistry > areg)
ExceptionToActionTable const * actions_
Definition: WorkerParams.h:40
WorkerMap m_workerMap
internal map of registered workers (owned).
ProductRegistry * reg_
Definition: WorkerParams.h:37
edm::propagate_const< std::shared_ptr< ModuleRegistry > > modRegistry_
std::shared_ptr< ProcessConfiguration const > processConfiguration_
Definition: WorkerParams.h:39
HLT enums.
Worker * getWorker(WorkerParams const &p, std::string const &moduleLabel)
Retrieve the particular instance of the worker.