LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
TableBase.h
Go to the documentation of this file.
1 #ifndef fhiclcpp_types_detail_TableBase_h
2 #define fhiclcpp_types_detail_TableBase_h
3 
4 #include "cetlib/exempt_ptr.h"
6 #include "fhiclcpp/fwd.h"
8 
9 #include <iosfwd>
10 #include <optional>
11 #include <set>
12 #include <string>
13 #include <vector>
14 
15 namespace fhicl::detail {
16  class TableBase : public ParameterBase {
17  public:
18  TableBase(Name const& name,
19  Comment const& comment,
20  par_style vt,
21  std::function<bool()> maybeUse);
22  ~TableBase();
23 
25  std::ostream& os,
26  std::string const& tab = std::string(3, ' ')) const;
27  std::vector<cet::exempt_ptr<ParameterBase>> const& members() const;
28  void validate(ParameterSet const& pset,
29  std::set<std::string> const& ignorable_keys = {});
30 
31  protected:
32  void finalize_members();
34  bool has_value() const;
35  ParameterSet const& get_pset() const;
36  ParameterSet const& guarantee_pset() const;
37 
38  private:
39  void do_set_value(ParameterSet const& pset) final;
40  std::optional<ParameterSet> select_pset(ParameterSet const& pset) const;
41  std::optional<ParameterSet> maybe_select_pset(
42  ParameterSet const& pset) const;
43 
44  std::optional<ParameterSet> pset_;
45  std::vector<cet::exempt_ptr<ParameterBase>> members_;
46  };
47 
48  // Insertion operator
49  std::ostream& operator<<(std::ostream& os, TableBase const& t);
50 }
51 
52 #endif /* fhiclcpp_types_detail_TableBase_h */
53 
54 // Local variables:
55 // mode: c++
56 // End:
ParameterSet const & get_pset() const
Definition: TableBase.cc:79
std::vector< cet::exempt_ptr< ParameterBase > > const & members() const
Definition: TableBase.cc:31
void validate(ParameterSet const &pset, std::set< std::string > const &ignorable_keys={})
Definition: TableBase.cc:56
std::optional< ParameterSet > select_pset(ParameterSet const &pset) const
Definition: TableBase.cc:92
std::vector< cet::exempt_ptr< ParameterBase > > members_
Definition: TableBase.h:45
std::string const & name() const
std::optional< ParameterSet > maybe_select_pset(ParameterSet const &pset) const
Definition: TableBase.cc:110
ParameterSet const & guarantee_pset() const
Definition: TableBase.cc:85
void print_allowed_configuration(std::ostream &os, std::string const &tab=std::string(3, ' ')) const
Definition: TableBase.cc:22
void do_set_value(ParameterSet const &pset) final
Definition: TableBase.cc:129
std::string const & comment() const
bool has_value() const
Definition: TableBase.cc:73
std::optional< ParameterSet > pset_
Definition: TableBase.h:44
std::ostream & operator<<(std::ostream &os, TableBase const &t)
Definition: TableBase.cc:139
TableBase(Name const &name, Comment const &comment, par_style vt, std::function< bool()> maybeUse)
Definition: TableBase.cc:12