LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
ToolConfigTable.h
Go to the documentation of this file.
1 #ifndef art_Utilities_ToolConfigTable_h
2 #define art_Utilities_ToolConfigTable_h
3 
5 #include "fhiclcpp/types/Atom.h"
8 #include "fhiclcpp/types/Table.h"
10 
11 #include <set>
12 #include <string>
13 #include <type_traits>
14 
15 namespace art {
16 
19  struct KeysToIgnore {
20  std::set<std::string>
22  {
23  return {};
24  }
25  };
26  };
27 
28  template <typename UserConfig, typename UserKeysToIgnore = void>
30  public:
31  ToolConfigTable(fhicl::Name&& name) : fullConfig_{std::move(name)} {}
32  ToolConfigTable(fhicl::ParameterSet const& pset) : fullConfig_{pset} {}
33 
34  auto const&
35  operator()() const
36  {
37  return fullConfig_().user();
38  }
39  auto const&
40  get_PSet() const
41  {
42  return fullConfig_.get_PSet();
43  }
44 
45  void
46  print_allowed_configuration(std::ostream& os,
47  std::string const& prefix) const
48  {
49  fullConfig_.print_allowed_configuration(os, prefix);
50  }
51 
52  private:
53  template <typename T>
54  struct FullConfig {
57  };
58 
59  using KeysToIgnore_t = std::conditional_t<
63 
65  cet::exempt_ptr<fhicl::detail::ParameterBase const>
66  get_parameter_base() const override
67  {
68  return &fullConfig_;
69  }
70  };
71 } // namespace art
72 
73 #endif /* art_Utilities_ToolConfigTable_h */
74 
75 // Local variables:
76 // mode: c++
77 // End:
void print_allowed_configuration(std::ostream &os, std::string const &prefix) const
cet::exempt_ptr< fhicl::detail::ParameterBase const > get_parameter_base() const override
fhicl::TableFragment< T > user
auto const & get_PSet() const
fhicl::TableFragment< MinimalToolConfig > tool_type
double value
Definition: spectrum.C:18
auto const & operator()() const
std::conditional_t< std::is_void< UserKeysToIgnore >::value, MinimalToolConfig::KeysToIgnore, fhicl::KeysToIgnore< MinimalToolConfig::KeysToIgnore, UserKeysToIgnore >> KeysToIgnore_t
ToolConfigTable(fhicl::Name &&name)
Definition: MVAAlg.h:12
std::set< std::string > operator()()
ToolConfigTable(fhicl::ParameterSet const &pset)
fhicl::Table< FullConfig< UserConfig >, KeysToIgnore_t > fullConfig_