delpi  0.0.1
DElta-complete LP solver
Loading...
Searching...
No Matches
delpi::Driver Class Referenceabstract

The Driver is the base class for all the parsers. More...

#include <Driver.h>

Public Member Functions

 Driver (LpSolver &lp_solver, const std::string &class_name="Driver")
 construct a new parser driver context
bool ParseStream (std::istream &in, const std::string &sname="stream input")
 Invoke the scanner and parser for a stream.
bool ParseString (std::string_view input, const std::string &sname="string stream")
 Invoke the scanner and parser on an input string.
virtual bool ParseFile (const std::string &filename)
 Invoke the scanner and parser on a file.
void Solve ()
 Call context_.CheckSat() and print proper output messages to the standard output.

Static Public Member Functions

static void Error (const std::string &m)
 General error handling.

Protected Member Functions

virtual bool ParseStreamCore (std::istream &in)=0
 Parse the stream.
virtual bool ParseFileCore (const std::string &filename)=0
 Parse the input file.
virtual bool ParseStringCore (std::string_view input)=0
 Parse the string.

Protected Attributes

std::string input_name_
 The name of the stream being parsed.
LpSolverlp_solver_
 LP parser that will store the parsed data.
IterationStats stats_
 Statistics for the driver.

Detailed Description

The Driver is the base class for all the parsers.

It contains the common logic to allow the parsed data to be saved in the context. It coordinates the communication between the parser (bison) and the scanner (flex).

Definition at line 22 of file Driver.h.

Member Function Documentation

◆ ParseFile()

bool delpi::Driver::ParseFile ( const std::string & filename)
virtual

Invoke the scanner and parser on a file.

Use parse_stream with a std::ifstream if detection of file reading errors is required.

Parameters
filenameinput file name
Returns
true if successfully parsed
false if an error occurred

Definition at line 34 of file Driver.cpp.

◆ ParseFileCore()

virtual bool delpi::Driver::ParseFileCore ( const std::string & filename)
protectedpure virtual

Parse the input file.

Parameters
filenamepath to the file to parse
Returns
true if successfully parsed
false if an error occurred

◆ ParseStream()

bool delpi::Driver::ParseStream ( std::istream & in,
const std::string & sname = "stream input" )

Invoke the scanner and parser for a stream.

Parameters
ininput stream
snamestream name for error messages
Returns
true if successfully parsed
false if an error occurred

Definition at line 22 of file Driver.cpp.

◆ ParseStreamCore()

virtual bool delpi::Driver::ParseStreamCore ( std::istream & in)
protectedpure virtual

Parse the stream.

Parameters
ininput stream
Returns
true if successfully parsed
false if an error occurred

◆ ParseString()

bool delpi::Driver::ParseString ( std::string_view input,
const std::string & sname = "string stream" )

Invoke the scanner and parser on an input string.

Parameters
inputinput string
snamestream name for error messages
Returns
true if successfully parsed
false if an error occurred

Definition at line 28 of file Driver.cpp.

◆ ParseStringCore()

virtual bool delpi::Driver::ParseStringCore ( std::string_view input)
protectedpure virtual

Parse the string.

Parameters
inputinput string
Returns
true if successfully parsed
false if an error occurred

The documentation for this class was generated from the following files: