LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
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::detail {
12 
13  template <tt::const_flavor C>
14  class ParameterWalker;
15 
16  //========================================================
17  class SequenceBase : public ParameterBase {
18  public:
20  Comment&& comment,
21  par_style const vt,
22  par_type const type,
23  std::function<bool()> maybeUse)
24  : ParameterBase{name, comment, vt, type, maybeUse}
25  {}
26 
27  bool
28  empty() const noexcept
29  {
30  return size() == 0;
31  }
32  std::size_t
33  size() const noexcept
34  {
35  return get_size();
36  }
37 
38  void
40  {
42  }
43  void
45  {
46  do_walk_elements(pw);
47  }
48  void
50  {
51  do_walk_elements(pw);
52  }
53 
54  private:
55  virtual std::size_t get_size() const noexcept = 0;
56 
57  virtual void do_prepare_elements_for_validation(std::size_t) = 0;
58  virtual void do_walk_elements(
60  virtual void do_walk_elements(
62  };
63 }
64 
65 #endif /* fhiclcpp_types_detail_SequenceBase_h */
66 
67 // Local variables:
68 // mode: c++
69 // End:
bool empty() const noexcept
Definition: SequenceBase.h:28
void prepare_elements_for_validation(std::size_t const n)
Definition: SequenceBase.h:39
std::size_t size() const noexcept
Definition: SequenceBase.h:33
virtual void do_walk_elements(ParameterWalker< tt::const_flavor::require_non_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:44
SequenceBase(Name &&name, Comment &&comment, par_style const vt, par_type const type, std::function< bool()> maybeUse)
Definition: SequenceBase.h:19
std::string const & name() const
virtual std::size_t get_size() const noexcept=0
Char_t n[5]
std::string const & comment() const
void walk_elements(ParameterWalker< tt::const_flavor::require_const > &pw) const
Definition: SequenceBase.h:49