print_allowed_configuration_defaults_t.cc
Go to the documentation of this file.
1 #include "fhiclcpp/types/Atom.h"
3 #include "fhiclcpp/types/Table.h"
4 #include "fhiclcpp/types/Tuple.h"
5 
6 #include <iostream>
7 
8 namespace {
9 
10  using namespace fhicl;
11  //============================================================================
12  // Job configuration
13  //
14 
15  struct PSet2 {
16  Atom<std::string> test{Name("test"), "a"};
17  Sequence<int> sequence{Name("sequence"),
18  Comment("Just to see if this works"),
19  {1, 3, 67, 5}};
20  Sequence<double, 5> array{Name("array"), {1.4, 2.3, 4., 8., 123098.}};
21  };
22 
23  struct Test {
24  Atom<int> value{Name("c"), 4};
25  };
26 
27  struct ForRootInput {
28  Atom<std::string> primary{Name("a"), "cool"};
29  Sequence<std::string> secondaries{Name("b")};
30  };
31 
32  struct Configuration {
33 
34  Atom<bool> flag{Name("flag"), true};
35  Atom<int> value{Name("value"), 7};
36  Atom<std::string> str{Name("string"), "hi mom"};
37 
39  Name("pair"),
40  {2.2345678, "Finally, I know what I'm doing."}};
41  Tuple<int, std::string, double> tup{Name("tuple"), {5, "some string", 16.}};
42 
43  Sequence<Tuple<int, double>> vt{Name("vecOfTuples"), {{3, 27.}}};
44  Sequence<Tuple<int, double>, 2> at{Name("arrayOfTuples"),
45  {{4, 15.}, {2, 17.}}};
46 
47  Sequence<Sequence<int>> vv{Name("vecOfVecs"), {{1, 3, 5}}};
48  Sequence<Sequence<int, 2>> va{Name("vecOfArrays"), {{1, 2}}};
49  Sequence<Sequence<int>, 2> av{Name("arrayOfVecs"), {{1, 2, 3}, {1}}};
50  Sequence<Sequence<int, 2>, 2> aa{Name("arrayOfArrays"), {{0, 2}, {2, 3}}};
51 
52  Tuple<Sequence<double>, bool, int> tv{Name("tupleWithVec"),
53  {{4.2, 7.3}, false, 5}};
54  Tuple<Sequence<double, 2>, bool, int> ta{Name("tupleWithArray"),
55  {{3.6, 5.3}, false, 5}};
56  Tuple<Tuple<int, double>, bool, int> tt{Name("tupleWithTuple"),
57  {{4, 5.9}, true, 8}};
58 
59  Table<PSet2> pset2{Name("pset2"),
60  Comment("This should work now\ndouble line even.")};
61  };
62 }
63 
64 int
66 {
67  Table<Configuration> pset{Name("pset")};
68  pset.print_allowed_configuration(std::cout);
69 }
ChannelGroupService::Name Name
Definition: type_traits.h:61
auto array(Array const &a)
Returns a manipulator which will print the specified array.
Definition: DumpUtils.h:228
#define Comment
Test()
Definition: templ.cpp:25
int bool
Definition: qglobal.h:345
static QCString str