Functions
PSetSample.cc File Reference
#include "cetlib/filepath_maker.h"
#include "fhiclcpp/ParameterSet.h"
#include <cassert>
#include <string>

Go to the source code of this file.

Functions

int main ()
 

Function Documentation

int main ( void  )

Definition at line 8 of file PSetSample.cc.

9 {
10  cet::filepath_lookup policy("FHICL_FILE_PATH");
11  std::string in("Sample.cfg");
12  auto const pset = fhicl::ParameterSet::make(in, policy);
13 
14  assert(pset.get<int>("a") == 1);
15  assert(pset.get<unsigned int>("a") == 1);
16  assert(pset.get<int>("b") == -1);
17  // assert(pset.get<unsigned int>("b", 0) == 0);
18 
19  assert(pset.get<double>("c") == 0.0);
20  assert(pset.get<double>("d") == 0.5);
21 
22  assert(pset.get<std::string>("e").compare("rain") == 0);
23  assert(pset.get<std::string>("f").compare("32") == 0);
24  assert(pset.get<int>("f") == 32);
25 
26  assert(pset.get<std::vector<int>>("g")[2] == 3);
27 
28  assert(pset.get<std::vector<fhicl::ParameterSet>>("h")[1]
29  .get<std::string>("h2")
30  .compare("h2") == 0);
31 
32  assert(pset.get<fhicl::ParameterSet>("i")
33  .get<fhicl::ParameterSet>("i1")
34  .get<std::string>("i1_1")
35  .compare("test") == 0);
36 
37  return 0;
38 }
std::string string
Definition: nybbler.cc:12
static ParameterSet make(intermediate_table const &tbl)
Definition: ParameterSet.cc:68
T get(std::string const &key) const
Definition: ParameterSet.h:271