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  auto wm = InputSourcePluginFactory::get()->create(modtype, conf, desc);
33 
34  if (wm.get() == nullptr) {
35  throw edm::Exception(errors::Configuration, "NoSourceModule")
36  << "InputSource Factory:\n"
37  << "Cannot find source type from ParameterSet: " << modtype << "\n"
38  << "Perhaps your source type is misspelled or is not an EDM Plugin?\n"
39  << "Try running EdmPluginDump to obtain a list of available Plugins.";
40  }
41 
42  wm->registerProducts();
43 
44  FDEBUG(1) << "InputSourceFactory: created input source " << modtype << std::endl;
45 
46  return wm;
47  }
48 
49 } // namespace edm
T getParameter(std::string const &) const
#define EDM_REGISTER_PLUGINFACTORY(_factory_, _category_)
Definition: PluginFactory.h:89
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