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 
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 
28  if (it == makers_.end()) {
29  std::unique_ptr<Maker> wm = detail::resolveMaker<MakerPluginFactory>(modtype, resolver);
30  FDEBUG(1) << "Factory: created worker of type " << modtype << std::endl;
31 
32  std::pair<MakerMap::iterator, bool> ret = makers_.insert({modtype, std::move(wm)});
33 
34  it = ret.first;
35  }
36  return it->second;
37  }
38 
39  std::shared_ptr<maker::ModuleHolder> Factory::makeModule(
40  const MakeModuleParams& p,
41  const ModuleTypeResolverBase* resolver,
42  signalslot::Signal<void(const ModuleDescription&)>& pre,
43  signalslot::Signal<void(const ModuleDescription&)>& post) const {
44  auto maker = findMaker(p, resolver);
45  auto mod(maker->makeModule(p, pre, post));
46  return mod;
47  }
48 
49  std::shared_ptr<maker::ModuleHolder> Factory::makeReplacementModule(const edm::ParameterSet& p) const {
50  std::string modtype = p.getParameter<std::string>("@module_type");
51  MakerMap::iterator it = makers_.find(modtype);
52  if (it != makers_.end()) {
53  return it->second->makeReplacementModule(p);
54  }
55  return std::shared_ptr<maker::ModuleHolder>{};
56  }
57 } // namespace edm
ret
prodAgent to be discontinued
std::shared_ptr< maker::ModuleHolder > makeReplacementModule(const edm::ParameterSet &) const
Definition: Factory.cc:49
#define FDEBUG(lev)
Definition: DebugMacros.h:19
Maker * findMaker(const MakeModuleParams &p, const ModuleTypeResolverBase *) const
Definition: Factory.cc:23
static Factory const singleInstance_
Definition: Factory.h:37
#define EDM_REGISTER_PLUGINFACTORY(_factory_, _category_)
Definition: PluginFactory.h:88
HLT enums.
std::shared_ptr< maker::ModuleHolder > makeModule(const MakeModuleParams &, const ModuleTypeResolverBase *, signalslot::Signal< void(const ModuleDescription &)> &pre, signalslot::Signal< void(const ModuleDescription &)> &post) const
Definition: Factory.cc:39
static Factory const * get()
Definition: Factory.cc:21
T mod(const T &a, const T &b)
Definition: ecalDccMap.h:4
def move(src, dest)
Definition: eostools.py:511
MakerMap makers_
Definition: Factory.h:39