to_indented_string_prefix_annotated_test.cc
Go to the documentation of this file.
1 // ======================================================================
2 //
3 // test of to_indented_string with prefixed annotations
4 //
5 // ======================================================================
6 
8 
9 #include <iostream>
10 #include <string>
11 
12 int
14 {
15 
16  // Configuration file lookup policy.
17  char const* fhicl_env = getenv("FHICL_FILE_PATH");
18  std::string search_path;
19  if (fhicl_env == nullptr) {
20  std::cerr << "Expected environment variable FHICL_FILE_PATH is "
21  << "missing or empty: using \".\"\n";
22  search_path = ".:";
23  } else {
24  search_path = std::string(fhicl_env) + ":";
25  }
26 
27  cet::filepath_lookup policy(search_path);
28  std::string const in{"to_indented_string_annotated_test.fcl"};
29 
30  auto pset = fhicl::ParameterSet::make(in, policy);
31 
32  pset.put<int>("another_number", 4);
33  pset.put_or_replace<int>("some_number", 8);
34  pset.put_or_replace<double>("double", 234.6);
35 
36  std::cout << pset.to_indented_string(
38  << std::endl;
39 }
std::string string
Definition: nybbler.cc:12
static ParameterSet make(intermediate_table const &tbl)
Definition: ParameterSet.cc:68
std::string getenv(std::string const &name)
Definition: getenv.cc:15
QTextStream & endl(QTextStream &s)