make_tool.h
Go to the documentation of this file.
1 #ifndef art_Utilities_make_tool_h
2 #define art_Utilities_make_tool_h
3 
11 
12 namespace art {
13 
14  template <typename T>
16 
17  template <typename T>
20  {
22  std::string const libspec{pset.get<std::string>("tool_type")};
24  try {
25  result = detail::tool_type<T>::make_plugin(factory, libspec, pset);
26  }
27  catch (cet::exception const& e) {
28  throw Exception(errors::Configuration, "make_tool: ", e)
29  << "Exception caught while processing plugin spec: " << libspec << '\n';
30  }
31  return result;
32  }
33 
34  template <typename T>
37  std::string const& function_tool_type)
38  {
40  Suffixes::tool(), "toolFunction", "toolType"};
41  std::string const libspec{pset.get<std::string>("tool_type")};
43  try {
45  factory, libspec, pset, function_tool_type);
46  }
47  catch (cet::exception const& e) {
48  throw Exception(errors::Configuration, "make_tool: ", e)
49  << "Exception caught while processing plugin spec: " << libspec << '\n';
50  }
51  return result;
52  }
53 
54  template <typename T, typename TableConfig>
56  make_tool(TableConfig const& tc, std::string const& function_tool_type)
57  {
58  if constexpr (std::is_class_v<T>) {
59  return make_tool<T>(tc.get_PSet());
60  } else if (std::is_function_v<T>) {
61  return make_tool<T>(tc.get_PSet(), function_tool_type);
62  }
63  }
64 
65 } // namespace art
66 
67 #endif /* art_Utilities_make_tool_h */
68 
69 // Local variables:
70 // mode: c++
71 // End:
std::enable_if_t< std::is_class< T >::value, tool_return_type< T > > make_tool(fhicl::ParameterSet const &pset)
Definition: make_tool.h:19
::xsd::cxx::tree::exception< char > exception
Definition: Database.h:225
const XML_Char int const XML_Char * value
Definition: expat.h:331
T get(std::string const &key) const
Definition: ParameterSet.h:231
static std::string const & tool()
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
Service to store calibration data products (CDP) in the SQLite3 metadatabase of a file...
Definition: FillParentInfo.h:8
Float_t e
Definition: plot.C:35
typename detail::tool_type< T >::return_type tool_return_type
Definition: make_tool.h:15
enum BeamMode string