|
|
delpi
0.0.1
DElta-complete LP solver
|
Used to parse command line arguments and produce a corresponding Config object to be used throughout the execution. More...
#include <ArgParser.h>
Public Member Functions | |
| void | Parse (int argc, const char **argv) |
| Parse the command line arguments. | |
| Config | ToConfig () const |
| Convert the parser to a Config. | |
| template<class T> | |
| T | get (const std::string &key) const |
| Get the value of a parameter from the internal parser. | |
Private Member Functions | |
| void | AddOptions () |
| Add all the options, positional arguments and flags to the parser. | |
| void | ValidateOptions () |
| Validate the options, ensuring the correctness of the parameters and the consistency of the options. | |
Used to parse command line arguments and produce a corresponding Config object to be used throughout the execution.
The default values of each parameter are defined in the Config class. Besides parsing, a validation step is performed to ensure the correctness of the parameters. If an inconsistency is found, an explication of the error is printed to the console. Under the hood, it uses the argparse library.
Definition at line 26 of file ArgParser.h.
|
inlinenodiscard |
Get the value of a parameter from the internal parser.
| T | type of the parameter |
| key | name of the parameter |
| std::invalid_argument | if the key is not found |
Definition at line 60 of file ArgParser.h.
| void delpi::ArgParser::Parse | ( | int | argc, |
| const char ** | argv ) |
Parse the command line arguments.
| argc | number of arguments |
| argv | array of arguments as strings |
Definition at line 77 of file ArgParser.cpp.
|
nodiscard |
Convert the parser to a Config.
The Config object will be used throughout the program to pass the configuration to all the components.
Definition at line 148 of file ArgParser.cpp.
|
private |
Validate the options, ensuring the correctness of the parameters and the consistency of the options.
| DelpiInvalidArgumentException | if the options are inconsistent or incorrect. |
| DelpiException | if an error occurs during parsing. |
Definition at line 177 of file ArgParser.cpp.