13#include <unordered_map>
27 virtual const char *what()
const noexcept;
42 parser(
const bool &enable_column_output);
56 const std::string &description,
57 const std::string &default_val);
64 void add_argument(
const std::string &argument,
bool required);
73 const std::string &description,
84 const std::string &description,
85 const std::string &default_val,
98 void add_input(
const std::vector<std::string> &input);
111 template <
typename T = std::
string>
115 if constexpr (std::is_same<T, std::string>::value)
119 else if constexpr (std::is_same<T, int>::value)
121 return std::stoi(value);
123 else if constexpr (std::is_same<T, unsigned int>::value)
125 return std::stoul(value);
127 else if constexpr (std::is_same<T, double>::value)
129 return std::stod(value);
131 else if constexpr (std::is_same<T, bool>::value)
134 return lower ==
"true";
138 return static_cast<T
>(value);
162 std::string argument;
163 std::string description;
164 std::optional<std::string> value;
165 std::string default_val =
"";
172 KeyValue(
const std::string &Key,
const std::string &Value)
179 std::vector<std::pair<std::string, Options>> mOrderedArguments;
180 std::unordered_map<std::string, Options> mRequiredArguments;
181 std::unordered_map<std::string, Options> mOptionalArguments;
183 bool extra_column_output =
false;
202 void add_input(
const std::vector<KeyValue> &input);
210 std::string
to_lower(
const std::string &input)
const;
212 KeyValue get_key_value(
const std::string &input);
The parser class provides the argument parser for the CLI and JSON methods. This is case insensitive.
Definition parser.h:39
void add_input(const std::vector< std::string > &input)
add_input Add the vector with each input as it is given in the CLI in the form "--argument=value".
Definition parser.cpp:213
bool all_required_set() const
all_required_set Check ifs all required parameter are set.
Definition parser.cpp:244
std::string get_value_as_string(const std::string &argument) const
get_value Get the value for the required parameter.
Definition parser.cpp:351
T get_value(const std::string &argument) const
get_value Get the value for the required parameter.
Definition parser.h:112
void print_help() const
print_help Prints the header and the arguments with their description.
Definition parser.cpp:268
std::string to_lower(const std::string &input) const
get_key_value Converts the CLI input in the form "--argName=value" into a key value pair.
Definition parser.cpp:458
void set_help_header(const std::string &header)
set_help_header Sets the header which is printed in print_help()
Definition parser.cpp:407
bool mHelpAlreadyPrinted
Helper to avoid multiple prints of the help output.
Definition parser.h:218
void check_required_parameters() const
check_required_parameters Calls all_required_set() and throws a parserException if not all required p...
Definition parser.cpp:259
void add_subtext(const std::string &subtext)
add_subtext add subtext to description column
Definition parser.cpp:205
void add_json_input(const std::string &filename)
add_json_input Add the input parameters with a json file.
Definition parser.cpp:383
void enable_minimizer_options()
enable_minimizer_options Enables the options regarding the minimizer.
Definition parser.cpp:113
void add_argument_only_display(const std::string &argument, const std::string &description, const std::string &default_val)
add_argument Silently adds a new argument for the parser options.
Definition parser.cpp:129
void add_argument(const std::string &argument, bool required)
add_argument Silently adds a new argument for the parser options.
Definition parser.cpp:142
This classes calculates the Bounce action of the potential with a set temperature.
Definition CalculateEtaInterface.h:24
void ShowInputError()
ShowInputError shows all the available models in the terminal.
Definition parser.cpp:23