LArSoft  v06_85_00
Liquid Argon Software toolkit - http://larsoft.org/
TableFragment.h
Go to the documentation of this file.
1 #ifndef fhiclcpp_types_TableFragment_h
2 #define fhiclcpp_types_TableFragment_h
3 
4 /*
5  'TableFragment' is an auxiliary class used to support the situation
6  where a user has a parameter set that looks like:
7 
8  pset: {
9 
10  a1 : <value>
11  a2 : <value>
12 
13  b3 : <value>
14  b4 : <value>
15 
16  }
17 
18  where the "a*" parameters are used by algorithm/class 'A' and the
19  "b*" parameters are used by algorithm/class 'B'. Specifically, it
20  allows users to define separate configurations for 'A' and 'B'
21  (using shorthand):
22 
23  struct A { Atom<T> a1; Atom<T> a2; };
24  struct B { Atom<T> b1; Atom<T> b2; };
25 
26  with a full configuration that looks like:
27 
28  struct Config {
29  TableFragment<A> a;
30  TableFragment<B> b;
31  };
32 
33  In this way, the parameters used by 'A' are separated from those
34  used by 'B', even though FHiCL configuration for 'pset' is flat.
35 
36  A 'TableFragment' is not a fhiclcpp type, per se, since it does not
37  represent a meaningful FHiCL construct. It does not derive from
38  ParameterBase, nor is it registered anywhere.
39 */
40 
41 #include "fhiclcpp/type_traits.h"
43 
44 namespace fhicl {
45 
46  //========================================================
47  template <typename T>
48  class TableFragment final {
49  public:
56 
57  // Compiler-produced default c'tor (and friends) is fine since 'T'
58  // is of class type.
59 
60  auto const&
61  operator()() const
62  {
63  return value_;
64  }
65 
66  private:
67  T value_;
68  };
69 }
70 
71 #endif /* fhiclcpp_types_TableFragment_h */
72 
73 // Local variables:
74 // mode: c++
75 // End:
#define REQUIRE_CLASS_TABLE_FRAGMENT
#define NO_DELEGATED_PARAMETERS
#define NO_NESTED_FHICL_TYPES_IN_TABLE
auto const & operator()() const
Definition: TableFragment.h:61
parameter set interface
#define NO_STD_CONTAINERS
#define NO_NESTED_TABLE_FRAGMENTS
std::string value(boost::any const &)