delpi  0.0.1
DElta-complete LP solver
Loading...
Searching...
No Matches
ArgParser.h
1
7#pragma once
8
9#include <iosfwd>
10#include <string>
11
12// Argparse library is used to parse the command line arguments.
13#include <argparse/argparse.hpp>
14
15#include "delpi/util/Config.h"
16
17namespace delpi {
18
26class ArgParser {
27 public:
29 ArgParser();
35 void Parse(int argc, const char **argv);
36
38 [[nodiscard]] static std::string version();
40 [[nodiscard]] static std::string repository_status();
42 [[nodiscard]] std::string prompt() const;
43
50 [[nodiscard]] Config ToConfig() const;
51
59 template <class T>
60 [[nodiscard]] T get(const std::string &key) const {
61 return parser_.get<T>(key);
62 }
63
64 private:
65 friend std::ostream &operator<<(std::ostream &os, const ArgParser &parser);
66
68 void AddOptions();
69
75 void ValidateOptions();
76
77 argparse::ArgumentParser parser_;
78 const std::string qsoptex_hash_;
79 const std::string soplex_hash_;
81};
82
83} // namespace delpi
Used to parse command line arguments and produce a corresponding Config object to be used throughout ...
Definition ArgParser.h:26
const std::string qsoptex_hash_
The hash of the QSoptEx library. Used in the prompt.
Definition ArgParser.h:78
void Parse(int argc, const char **argv)
Parse the command line arguments.
Definition ArgParser.cpp:77
int verbosity_
Verbosity level of the program.
Definition ArgParser.h:80
Config ToConfig() const
Convert the parser to a Config.
T get(const std::string &key) const
Get the value of a parameter from the internal parser.
Definition ArgParser.h:60
const std::string soplex_hash_
The hash of the Soplex library. Used in the prompt.
Definition ArgParser.h:79
void ValidateOptions()
Validate the options, ensuring the correctness of the parameters and the consistency of the options.
argparse::ArgumentParser parser_
The parser object.
Definition ArgParser.h:77
void AddOptions()
Add all the options, positional arguments and flags to the parser.
Definition ArgParser.cpp:92
Simple dataclass used to store the configuration of the program.
Definition Config.h:36
Global namespace for the delpi library.