CMS 3D CMS Logo

Factory.cc
Go to the documentation of this file.
1 
9 
10 #include <iostream>
11 
13 namespace edm {
14 
15  Factory const Factory::singleInstance_;
16 
17  Factory::~Factory() = default;
18 
19  Factory::Factory() = default;
20 
21  Factory const* Factory::get() { return &singleInstance_; }
22 
23  Maker const* Factory::findMaker(const MakeModuleParams& p, ModuleTypeResolverMaker const* resolverMaker) const {
24  std::string modtype = p.pset_->getParameter<std::string>("@module_type");
25  FDEBUG(1) << "Factory: module_type = " << modtype << std::endl;
26  MakerMap::iterator it = makers_.find(modtype);
27  if (it != makers_.end()) {
28  return it->second.get();
29  }
30  return detail::resolveMaker<MakerPluginFactory>(modtype, resolverMaker, *p.pset_, makers_);
31  }
32 
33  std::shared_ptr<maker::ModuleHolder> Factory::makeModule(
34  const MakeModuleParams& p,
35  const ModuleTypeResolverMaker* resolverMaker,
37  signalslot::Signal<void(const ModuleDescription&)>& post) const {
38  auto maker = findMaker(p, resolverMaker);
39  auto mod(maker->makeModule(p, pre, post));
40  return mod;
41  }
42 
43  std::shared_ptr<maker::ModuleHolder> Factory::makeReplacementModule(const edm::ParameterSet& p) const {
44  std::string modtype = p.getParameter<std::string>("@module_type");
45  MakerMap::iterator it = makers_.find(modtype);
46  if (it != makers_.end()) {
47  return it->second->makeReplacementModule(p);
48  }
49  return std::shared_ptr<maker::ModuleHolder>{};
50  }
51 } // namespace edm
std::shared_ptr< maker::ModuleHolder > makeReplacementModule(const edm::ParameterSet &) const
Definition: Factory.cc:43
#define FDEBUG(lev)
Definition: DebugMacros.h:19
std::shared_ptr< maker::ModuleHolder > makeModule(const MakeModuleParams &, const ModuleTypeResolverMaker *, signalslot::Signal< void(const ModuleDescription &)> &pre, signalslot::Signal< void(const ModuleDescription &)> &post) const
Definition: Factory.cc:33
static Factory const singleInstance_
Definition: Factory.h:37
#define EDM_REGISTER_PLUGINFACTORY(_factory_, _category_)
Definition: PluginFactory.h:88
HLT enums.
static Factory const * get()
Definition: Factory.cc:21
Maker const * findMaker(const MakeModuleParams &p, const ModuleTypeResolverMaker *) const
Definition: Factory.cc:23
T mod(const T &a, const T &b)
Definition: ecalDccMap.h:4
MakerMap makers_
Definition: Factory.h:39