LArSoft  v06_85_00
Liquid Argon Software toolkit - http://larsoft.org/
fhicl-dump.cc File Reference
#include "boost/program_options.hpp"
#include "cetlib_except/demangle.h"
#include "fhiclcpp/ParameterSet.h"
#include "fhiclcpp/detail/print_mode.h"
#include "fhiclcpp/intermediate_table.h"
#include "fhiclcpp/make_ParameterSet.h"
#include "fhiclcpp/parse.h"
#include <fstream>
#include <iostream>
#include <string>

Go to the source code of this file.

Functions

int main (int argc, char *argv[])
 

Function Documentation

int main ( int  argc,
char *  argv[] 
)

Definition at line 54 of file fhicl-dump.cc.

References fhicl::detail::annotated, e, fhicl::make_ParameterSet(), fhicl::parse_document(), fhicl::detail::prefix_annotated, and fhicl::ParameterSet::to_indented_string().

55 {
56 
57  Options opts;
58  try {
59  opts = process_arguments(argc, argv);
60  }
61  catch (cet::exception const& e) {
62  if (e.category() == help)
63  return 1;
64  if (e.category() == processing) {
65  std::cerr << e.what() << '\n';
66  return 2;
67  }
68  if (e.category() == config) {
69  std::cerr << e.what() << '\n';
70  return 3;
71  }
72  }
73 
74  auto const policy = get_policy(opts.lookup_policy, opts.lookup_path);
75 
76  ParameterSet pset;
77  try {
78  pset = form_pset(opts.input_filename, *policy);
79  }
80  catch (cet::exception const& e) {
81  std::cerr << e.what() << '\n';
82  return 4;
83  }
84  catch (...) {
85  std::cerr << "Unknown exception\n";
86  return 5;
87  }
88 
89  if (opts.quiet)
90  return 0;
91 
92  std::ofstream ofs{opts.output_filename};
93  std::ostream& os = opts.output_filename.empty() ? std::cout : ofs;
94 
95  os << "# Produced from '" << argv[0] << "' using:\n"
96  << "# Input : " << opts.input_filename << '\n'
97  << "# Policy : "
98  << cet::demangle_symbol(typeid(decltype(*policy)).name()) << '\n'
99  << "# Path : \"" << opts.lookup_path << "\"\n\n"
100  << pset.to_indented_string(0, opts.mode);
101 }
std::string to_indented_string() const
Float_t e
Definition: plot.C:34
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33