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 
13 
14 namespace edm {
15 
16  WorkerRegistry::WorkerRegistry(boost::shared_ptr<ActivityRegistry> areg) :
17  m_workerMap(),
18  actReg_(areg)
19  {
20  }
21 
23  m_workerMap.clear();
24  }
25 
27  m_workerMap.clear();
28  }
29 
31 
32  WorkerMap::iterator workerIt = m_workerMap.find(moduleLabel);
33 
34  // if the worker is not there, make it
35  if (workerIt == m_workerMap.end()){
36 
37  std::auto_ptr<Worker> workerPtr=
38  Factory::get()->makeWorker(p,actReg_->preModuleConstructionSignal_,
39  actReg_->postModuleConstructionSignal_);
40 
41  workerPtr->setActivityRegistry(actReg_);
42 
43  // Transfer ownership of worker to the registry
44  m_workerMap[moduleLabel].reset(workerPtr.release());
45  return m_workerMap[moduleLabel].get();
46  }
47  return (workerIt->second.get());
48  }
49 }
WorkerRegistry(boost::shared_ptr< ActivityRegistry > areg)
boost::shared_ptr< ActivityRegistry > actReg_
WorkerMap m_workerMap
internal map of registered workers (owned).
static Factory * get()
Definition: Factory.cc:29
std::auto_ptr< Worker > makeWorker(const WorkerParams &, sigc::signal< void, const ModuleDescription & > &pre, sigc::signal< void, const ModuleDescription & > &post) const
Definition: Factory.cc:34
Worker * getWorker(WorkerParams const &p, std::string const &moduleLabel)
Retrieve the particular instance of the worker.
const std::string * moduleLabel() const
Definition: HLTadd.h:40