delpi
0.0.1
DElta-complete LP solver
Toggle main menu visibility
Loading...
Searching...
No Matches
Driver.h
1
7
#pragma once
8
9
#include <iosfwd>
10
#include <string>
11
12
#include "delpi/solver/LpSolver.h"
13
#include "delpi/util/Stats.h"
14
15
namespace
delpi
{
16
22
class
Driver
{
23
public
:
25
explicit
Driver
(
LpSolver
&lp_solver,
const
std::string &class_name =
"Driver"
);
26
virtual
~Driver
() =
default
;
27
35
bool
ParseStream
(std::istream &in,
const
std::string &sname =
"stream input"
);
36
44
bool
ParseString
(std::string_view input,
const
std::string &sname =
"string stream"
);
45
54
virtual
bool
ParseFile
(
const
std::string &filename);
55
57
static
void
Error
(
const
std::string &m);
58
60
void
Solve
();
65
void
GetInfo(
const
std::string &key)
const
;
71
void
SetInfo(
const
std::string &key,
const
std::string &value);
77
void
SetOption(
const
std::string &key,
const
std::string &value);
78
80
void
Exit();
81
83
[[nodiscard]]
const
LpSolver
&lp_solver()
const
{
return
lp_solver_
; }
85
[[nodiscard]]
const
Config
&config()
const
{
return
lp_solver_
.config(); }
87
[[nodiscard]]
const
std::string &stream_name()
const
{
return
input_name_
; }
89
std::string &m_stream_name() {
return
input_name_
; }
91
[[nodiscard]]
const
Stats
&stats()
const
{
return
stats_
; }
92
93
protected
:
100
virtual
bool
ParseStreamCore
(std::istream &in) = 0;
107
virtual
bool
ParseFileCore
(
const
std::string &filename) = 0;
114
virtual
bool
ParseStringCore
(std::string_view input) = 0;
115
116
std::string
input_name_
;
117
118
LpSolver
&
lp_solver_
;
119
120
IterationStats
stats_
;
121
};
122
123
}
// namespace delpi
delpi::Config
Simple dataclass used to store the configuration of the program.
Definition
Config.h:36
delpi::Driver::ParseStreamCore
virtual bool ParseStreamCore(std::istream &in)=0
Parse the stream.
delpi::Driver::ParseFileCore
virtual bool ParseFileCore(const std::string &filename)=0
Parse the input file.
delpi::Driver::ParseString
bool ParseString(std::string_view input, const std::string &sname="string stream")
Invoke the scanner and parser on an input string.
Definition
Driver.cpp:28
delpi::Driver::lp_solver_
LpSolver & lp_solver_
LP parser that will store the parsed data.
Definition
Driver.h:113
delpi::Driver::Driver
Driver(LpSolver &lp_solver, const std::string &class_name="Driver")
construct a new parser driver context
Definition
Driver.cpp:19
delpi::Driver::input_name_
std::string input_name_
The name of the stream being parsed.
Definition
Driver.h:111
delpi::Driver::ParseStringCore
virtual bool ParseStringCore(std::string_view input)=0
Parse the string.
delpi::Driver::Error
static void Error(const std::string &m)
General error handling.
Definition
Driver.cpp:39
delpi::Driver::ParseFile
virtual bool ParseFile(const std::string &filename)
Invoke the scanner and parser on a file.
Definition
Driver.cpp:34
delpi::Driver::Solve
void Solve()
Call context_.CheckSat() and print proper output messages to the standard output.
Definition
Driver.cpp:41
delpi::Driver::stats_
IterationStats stats_
Statistics for the driver.
Definition
Driver.h:115
delpi::Driver::ParseStream
bool ParseStream(std::istream &in, const std::string &sname="stream input")
Invoke the scanner and parser for a stream.
Definition
Driver.cpp:22
delpi::IterationStats
Dataclass collecting statistics about some operation or process.
Definition
Stats.h:71
delpi::LpSolver
Facade class that hides the underlying LP solver used by delpi.
Definition
LpSolver.h:60
delpi::Stats
Dataclass collecting statistics about some operation or process.
Definition
Stats.h:22
delpi
Global namespace for the delpi library.
delpi
parser
Driver.h
Generated by
1.17.0