CMS 3D CMS Logo

ModuleRegistry.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: FWCore/Framework
4 // Class : edm::ModuleRegistry
5 //
6 // Implementation:
7 // [Notes on implementation]
8 //
9 // Original Author: Chris Jones
10 // Created: Fri, 23 Aug 2013 16:39:58 GMT
11 //
12 
13 // system include files
14 
15 // user include files
18 
19 
20 namespace edm {
21  std::shared_ptr<maker::ModuleHolder>
23  std::string const& moduleLabel,
24  signalslot::Signal<void(ModuleDescription const&)>& iPre,
25  signalslot::Signal<void(ModuleDescription const&)>& iPost) {
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 modPtr;
34  }
35  return get_underlying_safe(modItr->second);
36  }
37 
40  edm::ParameterSet const& iPSet,
41  edm::PreallocationConfiguration const& iPrealloc) {
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  }
56 }
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)
std::shared_ptr< maker::ModuleHolder > makeReplacementModule(const edm::ParameterSet &) const
Definition: Factory.cc:77
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, edm::propagate_const< std::shared_ptr< maker::ModuleHolder > > > labelToModule_
static Factory const * get()
Definition: Factory.cc:29
std::shared_ptr< T > & get_underlying_safe(propagate_const< std::shared_ptr< T >> &iP)
HLT enums.
maker::ModuleHolder * replaceModule(std::string const &iModuleLabel, edm::ParameterSet const &iPSet, edm::PreallocationConfiguration const &)