CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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::ModuleHolder
getModule (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,
std::shared_ptr
< maker::ModuleHolder > > 
labelToModule_
 

Detailed Description

Description: Constructs and owns framework modules

Usage: <usage>

Definition at line 39 of file ModuleRegistry.h.

Member Function Documentation

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

Definition at line 52 of file ModuleRegistry.h.

References labelToModule_, and edmStreamStallGrapher::t.

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

52  {
53  for(auto const& labelMod: labelToModule_) {
54  maker::ModuleHolder* t = labelMod.second.get();
55  iFunc(t);
56  }
57  }
std::map< std::string, std::shared_ptr< maker::ModuleHolder > > labelToModule_
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 22 of file ModuleRegistry.cc.

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

25  {
26  auto modItr = labelToModule_.find(moduleLabel);
27  if(modItr == labelToModule_.end()) {
28  auto modPtr=
29  Factory::get()->makeModule(p,iPre,iPost);
30 
31  // Transfer ownership of worker to the registry
32  labelToModule_[moduleLabel] = modPtr;
33  return labelToModule_[moduleLabel];
34  }
35  return (modItr->second);
36  }
std::shared_ptr< maker::ModuleHolder > makeModule(const MakeModuleParams &, signalslot::Signal< void(const ModuleDescription &)> &pre, signalslot::Signal< void(const ModuleDescription &)> &post) const
Definition: Factory.cc:68
std::map< std::string, std::shared_ptr< maker::ModuleHolder > > labelToModule_
static Factory const * get()
Definition: Factory.cc:29
maker::ModuleHolder * edm::ModuleRegistry::replaceModule ( std::string const &  iModuleLabel,
edm::ParameterSet const &  iPSet,
edm::PreallocationConfiguration const &  iPrealloc 
)

Definition at line 39 of file ModuleRegistry.cc.

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

41  {
42  auto modItr = labelToModule_.find(iModuleLabel);
43  if (modItr == labelToModule_.end()) {
44  return nullptr;
45  }
46 
47  auto modPtr=
49  modPtr->setModuleDescription(modItr->second->moduleDescription());
50  modPtr->preallocate(iPrealloc);
51 
52  // Transfer ownership of worker to the registry
53  modItr->second = modPtr;
54  return modItr->second.get();
55  }
std::shared_ptr< maker::ModuleHolder > makeReplacementModule(const edm::ParameterSet &) const
Definition: Factory.cc:77
std::map< std::string, std::shared_ptr< maker::ModuleHolder > > labelToModule_
static Factory const * get()
Definition: Factory.cc:29

Member Data Documentation

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

Definition at line 59 of file ModuleRegistry.h.

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