LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
ProducerTable.h
Go to the documentation of this file.
1 #ifndef art_Framework_Core_ProducerTable_h
2 #define art_Framework_Core_ProducerTable_h
3 // vim: set sw=2 expandtab :
4 
5 #include "fhiclcpp/types/Atom.h"
8 #include "fhiclcpp/types/Table.h"
10 
11 #include <sstream>
12 #include <string>
13 
14 namespace art {
15 
16  template <typename UserConfig,
17  typename ImplicitConfig,
18  typename UserKeysToIgnore = void>
20  private: // TYPES
21  template <typename T, typename U = ImplicitConfig>
22  struct FullConfig {
23  fhicl::Atom<std::string> type{U::plugin_type()};
25  true};
27  };
28 
29  using KeysToIgnore_t = std::conditional_t<
31  typename ImplicitConfig::IgnoreKeys,
32  fhicl::KeysToIgnore<typename ImplicitConfig::IgnoreKeys,
33  UserKeysToIgnore>>;
34 
35  public: // MEMBER FUNCTIONS -- Special Member Functions
36  explicit ProducerTable(fhicl::Name&& name) : fullConfig_{std::move(name)} {}
38 
39  public: // MEMBER FUNCTIONS -- User-facing API
40  auto const&
41  operator()() const
42  {
43  return fullConfig_().user();
44  }
45 
46  auto const&
47  get_PSet() const
48  {
49  return fullConfig_.get_PSet();
50  }
51 
52  void
53  print_allowed_configuration(std::ostream& os,
54  std::string const& prefix) const
55  {
56  fullConfig_.print_allowed_configuration(os, prefix);
57  }
58 
59  private: // MEMBER FUNCTIONS
60  cet::exempt_ptr<fhicl::detail::ParameterBase const>
61  get_parameter_base() const override
62  {
63  return &fullConfig_;
64  }
65 
66  private: // DATA MEMBERS
69  };
70 
71  template <typename UserConfig, typename ImplicitConfig>
72  inline std::ostream&
73  operator<<(std::ostream& os,
75  {
76  std::ostringstream config;
77  t.print_allowed_configuration(config, std::string(3, ' '));
78  return os << config.str();
79  }
80 }
81 
82 #endif /* art_Framework_Core_ProducerTable_h */
83 
84 // Local Variables:
85 // mode: c++
86 // End:
cet::exempt_ptr< fhicl::detail::ParameterBase const > get_parameter_base() const override
Definition: ProducerTable.h:61
fhicl::TableFragment< T > user
Definition: ProducerTable.h:26
fhicl::Table< FullConfig< UserConfig, ImplicitConfig >, KeysToIgnore_t > fullConfig_
Definition: ProducerTable.h:68
ProducerTable(fhicl::Name &&name)
Definition: ProducerTable.h:36
std::ostream & operator<<(std::ostream &os, const GroupSelector &gs)
std::conditional_t< std::is_void< UserKeysToIgnore >::value, typename ImplicitConfig::IgnoreKeys, fhicl::KeysToIgnore< typename ImplicitConfig::IgnoreKeys, UserKeysToIgnore >> KeysToIgnore_t
Definition: ProducerTable.h:33
auto const & get_PSet() const
Definition: ProducerTable.h:47
double value
Definition: spectrum.C:18
ProducerTable(fhicl::ParameterSet const &pset)
Definition: ProducerTable.h:37
Definition: MVAAlg.h:12
auto const & operator()() const
Definition: ProducerTable.h:41
void print_allowed_configuration(std::ostream &os, std::string const &prefix) const
Definition: ProducerTable.h:53
fhicl::Atom< bool > errorOnFailureToPut
Definition: ProducerTable.h:24