LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
InputSourceFactory.cc
Go to the documentation of this file.
2 // vim: set sw=2 expandtab :
3 
9 #include "cetlib/LibraryManager.h"
10 #include "cetlib/detail/wrapLibraryManagerException.h"
11 #include "fhiclcpp/ParameterSet.h"
12 
13 #include <memory>
14 #include <string>
15 
17 
18  std::unique_ptr<InputSource>
20  {
21  auto const libspec = conf.get<std::string>("module_type");
22  FDEBUG(1) << "InputSourceFactory: module_type = " << libspec << '\n';
23  using make_t = std::unique_ptr<InputSource>(fhicl::ParameterSet const&,
25  make_t* symbol = nullptr;
26  try {
27  cet::LibraryManager lm_{Suffixes::source()};
28  lm_.getSymbolByLibspec(libspec, "make", symbol);
29  }
30  catch (Exception const& e) {
31  cet::detail::wrapLibraryManagerException(
32  e, "InputSource", libspec, getReleaseVersion());
33  }
34  if (symbol == nullptr) {
35  throw Exception(errors::Configuration, "BadPluginLibrary")
36  << "InputSource " << libspec
37  << " has internal symbol definition problems: consult an expert.";
38  }
39  auto wm = symbol(conf, desc);
40  FDEBUG(1) << "InputSourceFactory: created input source " << libspec << '\n';
41  return wm;
42  }
43 
44 } // namespace art::InputSourceFactory
std::unique_ptr< InputSource > make(fhicl::ParameterSet const &conf, InputSourceDescription &desc)
static std::string const & source()
T get(std::string const &key) const
Definition: ParameterSet.h:314
std::string const & getReleaseVersion()
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
#define FDEBUG(LEVEL)
Definition: DebugMacros.h:25
Float_t e
Definition: plot.C:35