CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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),
20  m_workerMap(),
21  actReg_(areg)
22  {
23  }
24 
25  WorkerRegistry::WorkerRegistry(std::shared_ptr<ActivityRegistry> areg,
26  std::shared_ptr<ModuleRegistry> modReg):
27  modRegistry_(modReg),
28  m_workerMap(),
29  actReg_(areg)
30  {
31  }
32 
34  }
35 
37  m_workerMap.clear();
38  }
39 
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()){
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  }
60 }
PreallocationConfiguration const * preallocate_
Definition: WorkerParams.h:40
ParameterSet * pset_
Definition: WorkerParams.h:38
std::shared_ptr< ActivityRegistry > actReg_
WorkerRegistry(std::shared_ptr< ActivityRegistry > areg)
ExceptionToActionTable const * actions_
Definition: WorkerParams.h:42
WorkerMap m_workerMap
internal map of registered workers (owned).
ProductRegistry * reg_
Definition: WorkerParams.h:39
areg
Definition: Schedule.cc:374
edm::propagate_const< std::shared_ptr< ModuleRegistry > > modRegistry_
std::shared_ptr< ProcessConfiguration const > processConfiguration_
Definition: WorkerParams.h:41
Worker * getWorker(WorkerParams const &p, std::string const &moduleLabel)
Retrieve the particular instance of the worker.