test
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(boost::shared_ptr<ActivityRegistry> areg) :
19  modRegistry_(new ModuleRegistry),
20  m_workerMap(),
21  actReg_(areg)
22  {
23  }
24 
25  WorkerRegistry::WorkerRegistry(boost::shared_ptr<ActivityRegistry> areg,
26  boost::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].reset(workerPtr.release());
56  return m_workerMap[moduleLabel].get();
57  }
58  return (workerIt->second.get());
59  }
60 }
PreallocationConfiguration const * preallocate_
Definition: WorkerParams.h:40
WorkerRegistry(boost::shared_ptr< ActivityRegistry > areg)
boost::shared_ptr< ModuleRegistry > modRegistry_
ParameterSet * pset_
Definition: WorkerParams.h:38
boost::shared_ptr< ActivityRegistry > actReg_
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:369
Worker * getWorker(WorkerParams const &p, std::string const &moduleLabel)
Retrieve the particular instance of the worker.
boost::shared_ptr< ProcessConfiguration const > processConfiguration_
Definition: WorkerParams.h:41