InputSourceFactory.cc
Go to the documentation of this file.
2 // vim: set sw=2 expandtab :
3 
11 #include "fhiclcpp/ParameterSet.h"
12 
13 #include <memory>
14 #include <string>
15 
16 using namespace std;
18 
19 namespace art {
20  namespace InputSourceFactory {
21 
22  unique_ptr<InputSource>
24  {
25  auto const& libspec = conf.get<string>("module_type");
26  FDEBUG(1) << "InputSourceFactory: module_type = " << libspec << endl;
27  using make_t =
28  unique_ptr<InputSource>(ParameterSet const&, InputSourceDescription&);
29  make_t* symbol = nullptr;
30  try {
31  cet::LibraryManager lm_{Suffixes::source()};
32  lm_.getSymbolByLibspec(libspec, "make", symbol);
33  }
34  catch (Exception const& e) {
36  e, "InputSource", libspec, getReleaseVersion());
37  }
38  if (symbol == nullptr) {
39  throw Exception(errors::Configuration, "BadPluginLibrary")
40  << "InputSource " << libspec
41  << " has internal symbol definition problems: consult an expert.";
42  }
43  auto wm = symbol(conf, desc);
44  FDEBUG(1) << "InputSourceFactory: created input source " << libspec
45  << endl;
46  return wm;
47  }
48 
49  } // namespace InputSourceFactory
50 } // namespace art
Definition: conf.py:1
STL namespace.
T getSymbolByLibspec(std::string const &libspec, std::string const &sym_name) const
const double e
T get(std::string const &key) const
Definition: ParameterSet.h:271
std::string const & getReleaseVersion()
unique_ptr< InputSource > make(ParameterSet const &conf, InputSourceDescription &desc)
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
#define FDEBUG(LEVEL)
Definition: DebugMacros.h:25
void wrapLibraryManagerException(cet::exception const &e, std::string const &item_type, std::string const &libspec, std::string const &release)
QTextStream & endl(QTextStream &s)