SequenceBase.h
Go to the documentation of this file.
1 #ifndef fhiclcpp_types_detail_SequenceBase_h
2 #define fhiclcpp_types_detail_SequenceBase_h
3 
4 #include "fhiclcpp/type_traits.h"
6 
7 #include <array>
8 #include <tuple>
9 #include <vector>
10 
11 namespace fhicl {
12  namespace detail {
13 
14  template <tt::const_flavor C>
15  class ParameterWalker;
16 
17  //========================================================
18  class SequenceBase : public ParameterBase {
19  public:
21  Comment&& comment,
22  par_style const vt,
23  par_type const type,
24  std::function<bool()> maybeUse)
25  : ParameterBase{name, comment, vt, type, maybeUse}
26  {}
27 
28  bool
29  empty() const
30  {
31  return size() == 0;
32  }
33  std::size_t
34  size() const
35  {
36  return get_size();
37  }
38 
39  void
41  {
43  }
44  void
46  {
47  do_walk_elements(pw);
48  }
49  void
51  {
52  do_walk_elements(pw);
53  }
54 
55  private:
56  virtual std::size_t get_size() const = 0;
57 
58  virtual void do_prepare_elements_for_validation(std::size_t) = 0;
59  virtual void do_walk_elements(
61  virtual void do_walk_elements(
63  };
64  }
65 }
66 
67 #endif /* fhiclcpp_types_detail_SequenceBase_h */
68 
69 // Local variables:
70 // mode: c++
71 // End:
const XML_Char * name
Definition: expat.h:151
void prepare_elements_for_validation(std::size_t const n)
Definition: SequenceBase.h:40
virtual void do_walk_elements(ParameterWalker< tt::const_flavor::require_non_const > &)=0
virtual std::size_t get_size() const =0
virtual void do_prepare_elements_for_validation(std::size_t)=0
void walk_elements(ParameterWalker< tt::const_flavor::require_non_const > &pw)
Definition: SequenceBase.h:45
SequenceBase(Name &&name, Comment &&comment, par_style const vt, par_type const type, std::function< bool()> maybeUse)
Definition: SequenceBase.h:20
std::size_t size() const
Definition: SequenceBase.h:34
std::string name() const
Definition: ParameterBase.h:49
std::string comment() const
Definition: ParameterBase.h:54
void walk_elements(ParameterWalker< tt::const_flavor::require_const > &pw) const
Definition: SequenceBase.h:50