KeyMap.h
Go to the documentation of this file.
1 #ifndef fhiclcpp_test_types_KeyMap_h
2 #define fhiclcpp_test_types_KeyMap_h
3 
4 #include "fhiclcpp/type_traits.h"
6 
7 #include <string>
8 #include <vector>
9 
10 namespace fhicl {
11 
12  class KeyMap
13  : public detail::ParameterWalker<tt::const_flavor::require_const> {
14  public:
15  auto const&
16  result() const
17  {
18  return keys_;
19  };
20 
21  template <typename T>
22  static auto
23  get(std::string const& n)
24  {
25  KeyMap km;
26  T test{Name(n)};
27  km.walk_over(test);
28  return km.result();
29  }
30 
31  private:
32  std::vector<std::string> keys_;
33 
34  void
35  enter_table(detail::TableBase const& tb) override
36  {
37  append(tb.key());
38  }
39  void
41  {
42  append(sb.key());
43  }
44  void
45  atom(detail::AtomBase const& ab) override
46  {
47  append(ab.key());
48  }
49  void
51  {
52  append(dp.key());
53  }
54 
55  void
57  {
58  keys_.emplace_back(k);
59  }
60  };
61 }
62 
63 #endif /* fhiclcpp_test_types_KeyMap_h */
64 
65 // Local variables:
66 // mode: c++
67 // End:
std::vector< std::string > keys_
Definition: KeyMap.h:32
std::string string
Definition: nybbler.cc:12
ChannelGroupService::Name Name
void atom(detail::AtomBase const &ab) override
Definition: KeyMap.h:45
static constexpr double km
Definition: Units.h:64
void walk_over(tt::maybe_const_t< ParameterBase, C > &)
std::void_t< T > n
auto const & result() const
Definition: KeyMap.h:16
std::string const & key() const
Definition: ParameterBase.h:38
void enter_sequence(detail::SequenceBase const &sb) override
Definition: KeyMap.h:40
void enter_table(detail::TableBase const &tb) override
Definition: KeyMap.h:35
void delegated_parameter(detail::DelegateBase const &dp) override
Definition: KeyMap.h:50
void append(std::string const &k)
Definition: KeyMap.h:56