CMS 3D CMS Logo

Public Member Functions | Private Types | Private Attributes

edm::WorkerRegistry Class Reference

#include <WorkerRegistry.h>

List of all members.

Public Member Functions

void clear ()
WorkergetWorker (WorkerParams const &p, std::string const &moduleLabel)
 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 Attributes

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

Detailed Description

Definition at line 33 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 49 of file WorkerRegistry.h.


Constructor & Destructor Documentation

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

Definition at line 16 of file WorkerRegistry.cc.

                                                                       :
    m_workerMap(),
    actReg_(areg)
  {
  }
edm::WorkerRegistry::~WorkerRegistry ( )

Definition at line 22 of file WorkerRegistry.cc.

References m_workerMap.

                                   {
    m_workerMap.clear();
  }

Member Function Documentation

void edm::WorkerRegistry::clear ( void  )

Definition at line 26 of file WorkerRegistry.cc.

References m_workerMap.

                             {
    m_workerMap.clear();
  }
Worker * edm::WorkerRegistry::getWorker ( WorkerParams const &  p,
std::string const &  moduleLabel 
)

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 30 of file WorkerRegistry.cc.

References actReg_, reco::get(), m_workerMap, and moduleLabel().

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

                                                                                       {

    WorkerMap::iterator workerIt = m_workerMap.find(moduleLabel);
  
    // if the worker is not there, make it
    if (workerIt == m_workerMap.end()){
    
      std::auto_ptr<Worker> workerPtr=
        Factory::get()->makeWorker(p,actReg_->preModuleConstructionSignal_,
                                   actReg_->postModuleConstructionSignal_);
    
      workerPtr->setActivityRegistry(actReg_);

      // Transfer ownership of worker to the registry 
      m_workerMap[moduleLabel].reset(workerPtr.release());
      return m_workerMap[moduleLabel].get(); 
    } 
    return (workerIt->second.get());
  }

Member Data Documentation

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

Definition at line 53 of file WorkerRegistry.h.

Referenced by getWorker().

internal map of registered workers (owned).

Definition at line 52 of file WorkerRegistry.h.

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