dlinear  0.0.1
Delta-complete SMT solver for linear programming
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 "dlinear/util/Config.h"
16
17namespace dlinear {
18
27class ArgParser {
28 public:
30 ArgParser();
36 void Parse(int argc, const char **argv);
37
39 [[nodiscard]] static std::string version();
41 [[nodiscard]] static std::string repository_status();
43 [[nodiscard]] std::string prompt() const;
44
51 [[nodiscard]] Config ToConfig() const;
52
60 template <class T>
61 [[nodiscard]] T get(const std::string &key) const {
62 return parser_.get<T>(key);
63 }
64
65 friend std::ostream &operator<<(std::ostream &os, const dlinear::ArgParser &parser);
66
67 private:
69 void AddOptions();
70
76 void ValidateOptions();
77
78 friend std::ostream &operator<<(std::ostream &os, const ArgParser &parser);
79
80 argparse::ArgumentParser parser_;
82 const std::string qsoptex_hash_;
83 const std::string soplex_hash_;
84};
85
86} // namespace dlinear
Used to parse command line arguments and produce a corresponding Config object to be used throughout ...
Definition ArgParser.h:27
const std::string soplex_hash_
The hash of the Soplex library. Used in the prompt.
Definition ArgParser.h:83
void Parse(int argc, const char **argv)
Parse the command line arguments.
Definition ArgParser.cpp:77
argparse::ArgumentParser parser_
The parser object.
Definition ArgParser.h:80
void AddOptions()
Add all the options, positional arguments and flags to the parser.
Definition ArgParser.cpp:92
int verbosity_
Verbosity level of the program.
Definition ArgParser.h:81
void ValidateOptions()
Validate the options, ensuring the correctness of the parameters and the consistency of the options.
static std::string version()
Get read-only access to the version of the program.
const std::string qsoptex_hash_
The hash of the QSoptEx library. Used in the prompt.
Definition ArgParser.h:82
ArgParser()
Construct a new argparser object.
Definition ArgParser.cpp:63
std::string prompt() const
Get read-only access to the printable console prompt of the program.
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:61
static std::string repository_status()
Get read-only access to the hash status of the repository.
Simple dataclass used to store the configuration of the program.
Definition Config.h:38
Global namespace for the dlinear library.