CMS 3D CMS Logo

InputSourceFactory.cc
Go to the documentation of this file.
1 
6 
7 #include <iostream>
8 
9 EDM_REGISTER_PLUGINFACTORY(edm::InputSourcePluginFactory, "CMS EDM Framework InputSource");
10 namespace edm {
11 
13 
15 
17 
19  // will not work with plugin factories
20  //static InputSourceFactory f;
21  //return &f;
22 
23  return &singleInstance_;
24  }
25 
26  std::unique_ptr<InputSource> InputSourceFactory::makeInputSource(ParameterSet const& conf,
27  InputSourceDescription const& desc) const
28 
29  {
30  std::string modtype = conf.getParameter<std::string>("@module_type");
31  FDEBUG(1) << "InputSourceFactory: module_type = " << modtype << std::endl;
32  std::unique_ptr<InputSource> wm =
33  std::unique_ptr<InputSource>(InputSourcePluginFactory::get()->create(modtype, conf, desc));
34 
35  if (wm.get() == nullptr) {
36  throw edm::Exception(errors::Configuration, "NoSourceModule")
37  << "InputSource Factory:\n"
38  << "Cannot find source type from ParameterSet: " << modtype << "\n"
39  << "Perhaps your source type is misspelled or is not an EDM Plugin?\n"
40  << "Try running EdmPluginDump to obtain a list of available Plugins.";
41  }
42 
43  wm->registerProducts();
44 
45  FDEBUG(1) << "InputSourceFactory: created input source " << modtype << std::endl;
46 
47  return wm;
48  }
49 
50 } // namespace edm
T getParameter(std::string const &) const
#define EDM_REGISTER_PLUGINFACTORY(_factory_, _category_)
Definition: PluginFactory.h:86
static InputSourceFactory const singleInstance_
static InputSourceFactory const * get()
std::unique_ptr< InputSource > makeInputSource(ParameterSet const &, InputSourceDescription const &) const
HLT enums.
#define FDEBUG(lev)
Definition: DebugMacros.h:19
T get(const Candidate &c)
Definition: component.h:55