|
Pakman
|
#include <AbstractWorkerHandler.h>


Public Member Functions | |
| AbstractWorkerHandler (const Command &simulator, const std::string &input_string) | |
| virtual | ~AbstractWorkerHandler ()=default |
| virtual bool | isDone ()=0 |
| std::string | getOutput () |
| int | getErrorCode () |
Protected Attributes | |
| const Command | m_simulator |
| const std::string | m_input_string |
| std::string | m_output_buffer |
| int | m_error_code = -1 |
An abstract class for representing Workers.
Workers are instantiations of the simulator user executable. Since they can be implemented as forked processes or MPI processes, this abstract class was made to provide an interface to both types.
When an AbstractWorkerHandler is constructed, the simulation is initiated immediately. Hence, there are no member functions to start the simulation, only functions to check whether the simulation has finished (isDone()) and to obtain the results (getOutput() and getErrorCode()).
The destructor of a WorkerHandler ensures that the simulation is terminated, but the Worker process may persist, as in the case of MPIWorkerHandler.
Definition at line 23 of file AbstractWorkerHandler.h.
| AbstractWorkerHandler::AbstractWorkerHandler | ( | const Command & | simulator, |
| const std::string & | input_string | ||
| ) |
Construct from simulator string and input string.
| simulator | command to run simulation. |
| input_string | input string to simulator. |
Definition at line 7 of file AbstractWorkerHandler.cc.
|
virtualdefault |
Default destructor does nothing.
| int AbstractWorkerHandler::getErrorCode | ( | ) |
Definition at line 22 of file AbstractWorkerHandler.cc.
| std::string AbstractWorkerHandler::getOutput | ( | ) |
Definition at line 15 of file AbstractWorkerHandler.cc.
|
pure virtual |
Implemented in MPIWorkerHandler, and ForkedWorkerHandler.
|
protected |
Error code received from simulator.
Definition at line 68 of file AbstractWorkerHandler.h.
|
protected |
Input string to simulator.
Definition at line 62 of file AbstractWorkerHandler.h.
|
protected |
Buffer to contain simulator output.
Definition at line 65 of file AbstractWorkerHandler.h.
|
protected |
Command to run simulation.
Definition at line 59 of file AbstractWorkerHandler.h.