CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
edm::ModuleRegistry Class Reference

#include "FWCore/Framework/src/ModuleRegistry.h"

Public Member Functions

template<typename F >
void forAllModuleHolders (F iFunc)
 
std::shared_ptr< maker::ModuleHoldergetModule (MakeModuleParams const &p, std::string const &moduleLabel, signalslot::Signal< void(ModuleDescription const &)> &iPre, signalslot::Signal< void(ModuleDescription const &)> &iPost)
 
maker::ModuleHolderreplaceModule (std::string const &iModuleLabel, edm::ParameterSet const &iPSet, edm::PreallocationConfiguration const &)
 

Private Attributes

std::map< std::string, edm::propagate_const< std::shared_ptr< maker::ModuleHolder > > > labelToModule_
 

Detailed Description

Description: Constructs and owns framework modules

Usage: <usage>

Definition at line 40 of file ModuleRegistry.h.

Member Function Documentation

◆ forAllModuleHolders()

template<typename F >
void edm::ModuleRegistry::forAllModuleHolders ( F  iFunc)
inline

Definition at line 52 of file ModuleRegistry.h.

52  {
53  for (auto& labelMod : labelToModule_) {
54  maker::ModuleHolder* t = labelMod.second.get();
55  iFunc(t);
56  }
57  }

References labelToModule_, and OrderedSet::t.

Referenced by edm::StreamSchedule::initializeEarlyDelete().

◆ getModule()

std::shared_ptr< maker::ModuleHolder > edm::ModuleRegistry::getModule ( MakeModuleParams const &  p,
std::string const &  moduleLabel,
signalslot::Signal< void(ModuleDescription const &)> &  iPre,
signalslot::Signal< void(ModuleDescription const &)> &  iPost 
)

Definition at line 20 of file ModuleRegistry.cc.

24  {
25  auto modItr = labelToModule_.find(moduleLabel);
26  if (modItr == labelToModule_.end()) {
27  auto modPtr = Factory::get()->makeModule(p, iPre, iPost);
28 
29  // Transfer ownership of worker to the registry
30  labelToModule_[moduleLabel] = modPtr;
31  return modPtr;
32  }
33  return get_underlying_safe(modItr->second);
34  }

References edm::Factory::get(), edm::get_underlying_safe(), labelToModule_, edm::Factory::makeModule(), HerwigMaxPtPartonFilter_cfi::moduleLabel, and AlCaHLTBitMon_ParallelJobs::p.

◆ replaceModule()

maker::ModuleHolder * edm::ModuleRegistry::replaceModule ( std::string const &  iModuleLabel,
edm::ParameterSet const &  iPSet,
edm::PreallocationConfiguration const &  iPrealloc 
)

Definition at line 36 of file ModuleRegistry.cc.

38  {
39  auto modItr = labelToModule_.find(iModuleLabel);
40  if (modItr == labelToModule_.end()) {
41  return nullptr;
42  }
43 
44  auto modPtr = Factory::get()->makeReplacementModule(iPSet);
45  modPtr->setModuleDescription(modItr->second->moduleDescription());
46  modPtr->preallocate(iPrealloc);
47 
48  // Transfer ownership of worker to the registry
49  modItr->second = modPtr;
50  return modItr->second.get();
51  }

References edm::Factory::get(), labelToModule_, and edm::Factory::makeReplacementModule().

Member Data Documentation

◆ labelToModule_

std::map<std::string, edm::propagate_const<std::shared_ptr<maker::ModuleHolder> > > edm::ModuleRegistry::labelToModule_
private

Definition at line 60 of file ModuleRegistry.h.

Referenced by forAllModuleHolders(), getModule(), and replaceModule().

AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
edm::Factory::makeReplacementModule
std::shared_ptr< maker::ModuleHolder > makeReplacementModule(const edm::ParameterSet &) const
Definition: Factory.cc:64
OrderedSet.t
t
Definition: OrderedSet.py:90
edm::get_underlying_safe
std::shared_ptr< T > & get_underlying_safe(propagate_const< std::shared_ptr< T >> &iP)
Definition: get_underlying_safe.h:40
edm::ModuleRegistry::labelToModule_
std::map< std::string, edm::propagate_const< std::shared_ptr< maker::ModuleHolder > > > labelToModule_
Definition: ModuleRegistry.h:60
edm::Factory::makeModule
std::shared_ptr< maker::ModuleHolder > makeModule(const MakeModuleParams &, signalslot::Signal< void(const ModuleDescription &)> &pre, signalslot::Signal< void(const ModuleDescription &)> &post) const
Definition: Factory.cc:55
edm::Factory::get
static Factory const * get()
Definition: Factory.cc:23
HerwigMaxPtPartonFilter_cfi.moduleLabel
moduleLabel
Definition: HerwigMaxPtPartonFilter_cfi.py:4