dlvhex
2.5.0
|
A wrapper process for the DLV/DLVDB ASP engine. More...
#include <include/dlvhex2/DLVProcess.h>
Public Member Functions | |
DLVProcess () | |
Constructor. | |
virtual | ~DLVProcess () |
Destructor. | |
virtual void | addOption (const std::string &) |
Adds an option to the commandline. | |
virtual void | setPath (const std::string &) |
virtual std::string | path () const |
Returns the executable command. | |
virtual std::vector< std::string > | commandline () const |
Returns the whole reasoner commandline call. | |
virtual void | spawn () |
Instantiates a new process spawned from this one. | |
virtual void | spawn (const std::vector< std::string > &) |
Instantiates a new process spawned from this one using a given commandline string. | |
virtual void | endoffile () |
Sends EOF to the process. | |
virtual int | close (bool kill=false) |
Waits for the process to terminate. | |
virtual std::ostream & | getOutput () |
Retrieve the output stream of the process. | |
virtual std::istream & | getInput () |
Retrieve the input stream of the process. | |
Protected Member Functions | |
void | setupStreams () |
Initialize in/out streams. | |
Protected Attributes | |
ProcessBuf | proc |
std::istream * | ipipe |
iostreams to the dlv process | |
std::ostream * | opipe |
Output pipe. | |
std::string | executable |
Executable path/name. | |
std::vector< std::string > | argv |
Command line options. |
A wrapper process for the DLV/DLVDB ASP engine.
Definition at line 56 of file DLVProcess.h.
Constructor.
Definition at line 50 of file DLVProcess.cpp.
DLVProcess::~DLVProcess | ( | ) | [virtual] |
Destructor.
Definition at line 54 of file DLVProcess.cpp.
References ProcessBuf::close(), ipipe, opipe, and proc.
void DLVProcess::addOption | ( | const std::string & | o | ) | [virtual] |
Adds an option to the commandline.
Implements Process.
Definition at line 63 of file DLVProcess.cpp.
References argv.
Referenced by SimpleEvaluator::solve().
int DLVProcess::close | ( | bool | kill = false | ) | [virtual] |
Waits for the process to terminate.
kill | If true the child process will be killed, otherwise the method waits. |
Implements Process.
Definition at line 154 of file DLVProcess.cpp.
References ProcessBuf::close(), ipipe, opipe, and proc.
std::vector< std::string > DLVProcess::commandline | ( | ) | const [virtual] |
void DLVProcess::endoffile | ( | ) | [virtual] |
Sends EOF to the process.
Implements Process.
Definition at line 147 of file DLVProcess.cpp.
References ProcessBuf::endoffile(), and proc.
Referenced by SimpleEvaluator::solve().
std::istream & DLVProcess::getInput | ( | ) | [virtual] |
Retrieve the input stream of the process.
Implements Process.
Definition at line 175 of file DLVProcess.cpp.
References ipipe.
Referenced by SimpleEvaluator::solve().
std::ostream & DLVProcess::getOutput | ( | ) | [virtual] |
Retrieve the output stream of the process.
Implements Process.
Definition at line 167 of file DLVProcess.cpp.
References opipe.
Referenced by SimpleEvaluator::solve().
std::string DLVProcess::path | ( | ) | const [virtual] |
Returns the executable command.
Implements Process.
Definition at line 77 of file DLVProcess.cpp.
References executable.
Referenced by commandline(), setPath(), and spawn().
void DLVProcess::setPath | ( | const std::string & | path | ) | [virtual] |
Definition at line 70 of file DLVProcess.cpp.
References executable, and path().
Referenced by SimpleEvaluator::solve().
void DLVProcess::setupStreams | ( | ) | [protected] |
Initialize in/out streams.
Definition at line 97 of file DLVProcess.cpp.
References Logger::DBG, DBGLOG, Logger::Instance(), ipipe, opipe, and proc.
Referenced by spawn().
void DLVProcess::spawn | ( | ) | [virtual] |
Instantiates a new process spawned from this one.
Implements Process.
Definition at line 128 of file DLVProcess.cpp.
References commandline(), ProcessBuf::open(), proc, and setupStreams().
Referenced by SimpleEvaluator::solve().
void DLVProcess::spawn | ( | const std::vector< std::string > & | c | ) | [virtual] |
Instantiates a new process spawned from this one using a given commandline string.
Commandline | executed by the new process. |
Implements Process.
Definition at line 136 of file DLVProcess.cpp.
References ProcessBuf::open(), path(), proc, and setupStreams().
std::vector<std::string> DLVProcess::argv [protected] |
Command line options.
Definition at line 72 of file DLVProcess.h.
Referenced by addOption(), and commandline().
std::string DLVProcess::executable [protected] |
Executable path/name.
Definition at line 69 of file DLVProcess.h.
std::istream* DLVProcess::ipipe [protected] |
iostreams to the dlv process
Input pipe.
Definition at line 64 of file DLVProcess.h.
Referenced by close(), getInput(), setupStreams(), and ~DLVProcess().
std::ostream* DLVProcess::opipe [protected] |
Output pipe.
Definition at line 66 of file DLVProcess.h.
Referenced by close(), getOutput(), setupStreams(), and ~DLVProcess().
ProcessBuf DLVProcess::proc [protected] |
Definition at line 60 of file DLVProcess.h.
Referenced by close(), endoffile(), setupStreams(), spawn(), and ~DLVProcess().