/home/runner/work/DiFfRG_current/DiFfRG_current/DiFfRG/include/DiFfRG/common/configuration_helper.hh Source File#

DiFfRG: /home/runner/work/DiFfRG_current/DiFfRG_current/DiFfRG/include/DiFfRG/common/configuration_helper.hh Source File
DiFfRG
configuration_helper.hh
Go to the documentation of this file.
1#pragma once
2
3// standard library
4#include <list>
5#include <string>
6
7// DiFfRG
9
10namespace DiFfRG
11{
16 {
17 public:
26 ConfigurationHelper(int argc, char *argv[], const std::string parameter_file = "parameter.json");
27
32
37
41 void append(std::string arg);
42
47
51 const JSONValue &get_json() const;
52
53 std::string get_log_file() const;
54 std::string get_parameter_file() const;
55 std::string get_output_name() const;
56 std::string get_output_folder() const;
57 std::string get_top_folder() const;
58
59 private:
60 void parse();
61 void parse_cli();
65
66 std::list<std::string> args;
67 std::list<std::pair<std::string, std::string>> cli_parameters;
68
70
71 bool parsed;
72
73 std::string parameter_file;
74
75 static bool logger_initialized;
76 };
77} // namespace DiFfRG
Class to read parameters given from the command line and from a parameter file.
Definition configuration_helper.hh:16
static bool logger_initialized
Definition configuration_helper.hh:75
ConfigurationHelper(const JSONValue &json)
Construct a new Configuration Helper object from a JSONValue object.
std::string parameter_file
Definition configuration_helper.hh:73
void append(std::string arg)
Add a CLI-like argument to the list of arguments.
ConfigurationHelper(int argc, char *argv[], const std::string parameter_file="parameter.json")
Construct a new Configuration Helper object To get an overview of the available arguments,...
std::string get_output_name() const
std::string get_log_file() const
bool parsed
Definition configuration_helper.hh:71
std::string get_parameter_file() const
std::list< std::pair< std::string, std::string > > cli_parameters
Definition configuration_helper.hh:67
std::string get_top_folder() const
ConfigurationHelper(const ConfigurationHelper &)
Copy a Configuration Helper.
std::string get_output_folder() const
const JSONValue & get_json() const
Obtain the JSON object containing all the parameters.
JSONValue & get_json()
Obtain the JSON object containing all the parameters.
std::list< std::string > args
Definition configuration_helper.hh:66
JSONValue json
Definition configuration_helper.hh:69
A wrapper around the boost json value class.
Definition json.hh:19
Definition complex_math.hh:10