save-restore_t.cc
Go to the documentation of this file.
3 
4 #include <cstdlib>
5 #include <exception>
6 #include <iostream>
7 #include <string>
8 
9 using namespace fhicl;
10 using namespace std;
11 
12 int
13 main(int argc, char** argv)
14 {
15  if (argc != 2) {
16  std::cerr << "ERROR: expect exactly one filename!\n";
17  exit(1);
18  }
19  ParameterSet pset_ref;
20  cet::filepath_lookup policy(".:");
21  try {
22  pset_ref = ParameterSet::make(argv[1], policy);
23  }
24  catch (std::exception& e) {
25  std::cerr << "ERROR: unable to parse FHiCL file "
26  << "\"" << argv[1] << "\"\n"
27  << e.what();
28  exit(1);
29  }
30 
31  string const pset_string(pset_ref.to_string());
32  auto const pset_test = ParameterSet::make(pset_string);
33 
34  string pset_test_string(pset_test.to_string());
35  if (pset_string != pset_test_string) {
36  std::cerr << "ERROR: \n"
37  << pset_string << "\n"
38  << " !=\n"
39  << pset_test_string << "\n";
40  exit(1);
41  }
42 }
static ParameterSet make(intermediate_table const &tbl)
Definition: ParameterSet.cc:68
STL namespace.
const double e
int main(int argc, char **argv)
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
std::string to_string() const
Definition: ParameterSet.h:153