DiFfRG
Loading...
Searching...
No Matches
configuration_helper.hh
Go to the documentation of this file.
1#pragma once
2
3// standard library
4#include <fstream>
5#include <list>
6#include <string>
7
8// external libraries
9#include <deal.II/base/logstream.h>
10#include <deal.II/base/parameter_handler.h>
11
12// DiFfRG
14
15namespace DiFfRG
16{
21 {
22 public:
31 ConfigurationHelper(int argc, char *argv[], const std::string parameter_file = "parameter.json");
32
37
42
46 void append(std::string arg);
47
52
56 const JSONValue &get_json() const;
57
58 std::string get_log_file() const;
59 std::string get_parameter_file() const;
60 std::string get_output_name() const;
61 std::string get_output_folder() const;
62 std::string get_top_folder() const;
63
64 private:
65 void parse();
66 void parse_cli();
70
71 std::list<std::string> args;
72 std::list<std::pair<std::string, std::string>> cli_parameters;
73
76
78
79 bool parsed;
80
81 std::string parameter_file;
82
83 static bool logger_initialized;
84 };
85} // namespace DiFfRG
Class to read parameters given from the command line and from a parameter file.
Definition configuration_helper.hh:21
static bool logger_initialized
Definition configuration_helper.hh:83
ConfigurationHelper(const JSONValue &json)
Construct a new Configuration Helper object from a JSONValue object.
std::string parameter_file
Definition configuration_helper.hh:81
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:79
std::string get_parameter_file() const
std::list< std::pair< std::string, std::string > > cli_parameters
Definition configuration_helper.hh:72
uint depth_console
Definition configuration_helper.hh:74
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:71
JSONValue json
Definition configuration_helper.hh:77
uint depth_file
Definition configuration_helper.hh:75
A wrapper around the boost json value class.
Definition json.hh:19
Definition complex_math.hh:14
unsigned int uint
Definition utils.hh:22