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.
WorkerRegistryoperator= (WorkerRegistry const &)
 WorkerRegistry (boost::shared_ptr< ActivityRegistry > areg)
 WorkerRegistry (WorkerRegistry const &)
 ~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 32 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 51 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();
  }
edm::WorkerRegistry::WorkerRegistry ( WorkerRegistry const &  )

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(), and m_workerMap.

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()){
    
      auto 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());
  }
WorkerRegistry& edm::WorkerRegistry::operator= ( WorkerRegistry const &  )

Member Data Documentation

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

Definition at line 55 of file WorkerRegistry.h.

Referenced by getWorker().

internal map of registered workers (owned).

Definition at line 54 of file WorkerRegistry.h.

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