Functions
to_indented_string_annotated_test.cc File Reference
#include "cetlib/filepath_maker.h"
#include "fhiclcpp/ParameterSet.h"
#include "fhiclcpp/intermediate_table.h"
#include "fhiclcpp/parse.h"
#include <cstdlib>
#include <iostream>
#include <string>

Go to the source code of this file.

Functions

int main ()
 

Function Documentation

int main ( void  )

Definition at line 17 of file to_indented_string_annotated_test.cc.

18 {
19 
20  // Configuration file lookup policy.
21  char const* fhicl_env = getenv("FHICL_FILE_PATH");
22  std::string search_path;
23  if (fhicl_env == nullptr) {
24  std::cerr << "Expected environment variable FHICL_FILE_PATH is "
25  << "missing or empty: using \".\"\n";
26  search_path = ".:";
27  } else {
28  search_path = std::string(fhicl_env) + ":";
29  }
30 
31  cet::filepath_lookup policy(search_path);
32  std::string const in{"to_indented_string_annotated_test.fcl"};
33 
34  auto const tbl = fhicl::parse_document(in, policy);
35  auto pset = fhicl::ParameterSet::make(tbl);
36 
37  pset.put<int>("another_number", 4);
38  pset.put_or_replace<int>("some_number", 8);
39  pset.put_or_replace<double>("double", 234.6);
40 
41  std::cout << pset.to_indented_string(0, true) << std::endl;
42 }
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
intermediate_table parse_document(std::string const &filename, cet::filepath_maker &maker)
Definition: parse.cc:720
QTextStream & endl(QTextStream &s)