CMS 3D CMS Logo

edm::WorkerRegistry Class Reference

#include <FWCore/Framework/src/WorkerRegistry.h>

List of all members.

Public Member Functions

void clear ()
WorkergetWorker (WorkerParams const &)
 Retrieve the particular instance of the worker.
 WorkerRegistry (boost::shared_ptr< ActivityRegistry > areg)
 ~WorkerRegistry ()

Private Types

typedef std::map< std::string,
boost::shared_ptr< Worker > > 
WorkerMap
 the container of workers

Private Member Functions

std::string mangleWorkerParameters (ParameterSet const &parameterSet, std::string const &processName, ReleaseVersion const &releaseVersion, PassID const &passID)
 Get a unique name for the worker.

Private Attributes

boost::shared_ptr
< ActivityRegistry
actReg_
WorkerMap m_workerMap
 internal map of registered workers (owned).


Detailed Description

Definition at line 41 of file WorkerRegistry.h.


Member Typedef Documentation

typedef std::map<std::string, boost::shared_ptr<Worker> > edm::WorkerRegistry::WorkerMap [private]

the container of workers

Definition at line 64 of file WorkerRegistry.h.


Constructor & Destructor Documentation

edm::WorkerRegistry::WorkerRegistry ( boost::shared_ptr< ActivityRegistry areg  )  [explicit]

Definition at line 21 of file WorkerRegistry.cc.

00021                                                                      :
00022   m_workerMap(),
00023   actReg_(areg)
00024 {
00025 }

edm::WorkerRegistry::~WorkerRegistry (  ) 

Definition at line 27 of file WorkerRegistry.cc.

References m_workerMap.

00027                                  {
00028   m_workerMap.clear();
00029 }


Member Function Documentation

void edm::WorkerRegistry::clear ( void   ) 

Definition at line 31 of file WorkerRegistry.cc.

References m_workerMap.

Referenced by edm::EventProcessor::~EventProcessor().

00031                            {
00032   m_workerMap.clear();
00033 }

Worker * edm::WorkerRegistry::getWorker ( WorkerParams const &  p  ) 

Retrieve the particular instance of the worker.

If the worker with that set of parameters does not exist, create it

Note:
Workers are owned by this class, do not delete them

Definition at line 35 of file WorkerRegistry.cc.

References actReg_, DBSPlugin::get(), m_workerMap, mangleWorkerParameters(), edm::WorkerParams::passID_, edm::WorkerParams::processName_, edm::WorkerParams::pset_, and edm::WorkerParams::releaseVersion_.

Referenced by edm::Schedule::fillWorkers(), and edm::Schedule::Schedule().

00035                                                        {
00036 
00037   std::string workerid =
00038     mangleWorkerParameters(*p.pset_, p.processName_,
00039                            p.releaseVersion_,p.passID_);
00040 
00041   WorkerMap::iterator workerIt = m_workerMap.find(workerid);
00042   
00043   // if the worker is not there, make it
00044   if (workerIt == m_workerMap.end()){
00045     
00046     std::auto_ptr<Worker> workerPtr=
00047       Factory::get()->makeWorker(p,actReg_->preModuleConstructionSignal_,
00048                                  actReg_->postModuleConstructionSignal_);
00049     
00050     workerPtr->setActivityRegistry(actReg_);
00051 
00052     // Transfer ownership of worker to the registry 
00053     m_workerMap[workerid].reset(workerPtr.release());
00054     return m_workerMap[workerid].get();
00055     
00056   } 
00057   
00058   return (workerIt->second.get());
00059 
00060 }

std::string edm::WorkerRegistry::mangleWorkerParameters ( ParameterSet const &  parameterSet,
std::string const &  processName,
ReleaseVersion const &  releaseVersion,
PassID const &  passID 
) [private]

Get a unique name for the worker.

Form a string to be used as a key in the map of workers

Definition at line 63 of file WorkerRegistry.cc.

References edm::ParameterSet::toString().

Referenced by getWorker().

00066                                                                     {
00067 
00068   std::stringstream mangled_parameters;
00069   mangled_parameters<< parameterSet.toString()
00070                     << processName
00071                     << releaseVersion
00072                     << passID;
00073 
00074   return mangled_parameters.str();
00075 
00076 }


Member Data Documentation

boost::shared_ptr<ActivityRegistry> edm::WorkerRegistry::actReg_ [private]

Definition at line 68 of file WorkerRegistry.h.

Referenced by getWorker().

WorkerMap edm::WorkerRegistry::m_workerMap [private]

internal map of registered workers (owned).

Definition at line 67 of file WorkerRegistry.h.

Referenced by clear(), getWorker(), and ~WorkerRegistry().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:44:47 2009 for CMSSW by  doxygen 1.5.4