RSC  0.16.0
rsc::subprocess::Subprocess Class Reference

A wrapper to call a different command as a subprocess and control its lifecycle. More...

#include <Subprocess.h>

Inheritance diagram for rsc::subprocess::Subprocess:
Inheritance graph
Collaboration diagram for rsc::subprocess::Subprocess:
Collaboration graph

Public Member Functions

virtual ~Subprocess ()
 

Static Public Member Functions

static SubprocessPtr newInstance (const std::string &command, const std::vector< std::string > &args=std::vector< std::string >())
 Creates a new subprocess for the given command with the specified arguments. More...
 

Protected Member Functions

 Subprocess ()
 

Detailed Description

A wrapper to call a different command as a subprocess and control its lifecycle.

This class uses the RAII idiom to manage the subprocces. This means that the called process will be terminated on destruction of an instance of this class.

This class is intended to provide a platform-independent way of controlling a command. Hence, a factory method is used instead of a normal constructor to automatically instantiate the platform-specific implementations.

Subclasses ensure that the process is started in the constructor and terminated in the destructor.

Author
jwienke

Definition at line 58 of file Subprocess.h.

Constructor & Destructor Documentation

rsc::subprocess::Subprocess::~Subprocess ( )
virtual

Definition at line 45 of file Subprocess.cpp.

rsc::subprocess::Subprocess::Subprocess ( )
protected

Definition at line 42 of file Subprocess.cpp.

Member Function Documentation

SubprocessPtr rsc::subprocess::Subprocess::newInstance ( const std::string &  command,
const std::vector< std::string > &  args = std::vector<std::string>() 
)
static

Creates a new subprocess for the given command with the specified arguments.

Parameters
commandcommand to call
argsarguments for the command. The command itself must not be given. It is automatically passed by this class.
Returns
subprocess instance
Exceptions
std::runtime_errorerror starting the command

Definition at line 48 of file Subprocess.cpp.


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