Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Namespace Members | Compound Members | File Members | Related Pages | Examples

P::Process Class Reference
[Core library]

Child process class. More...

#include <pprocess.h>

List of all members.

Public Types

typedef std::list< std::string > arg_list
 Argument list type.

enum  state_t { Stopped, Running, Stopping }
 Child process state. More...

enum  commMode_t {
  NoCommunication = 0, StdIn = 1, StdOut = 2, StdErr = 4,
  AllOutput = 6, All = 7
}
 Communication mode flags. More...


Public Member Functions

 Process (const char *path, const arg_list &args=arg_list()) throw (IOError)
 Process constructor.

 ~Process () throw ()
state_t state () const
 Returns the process state.

void addArg (const char *arg)
 Add argument.

void clearArgs ()
 Clear arguments.

void setWorkDir (const char *dir)
 Set working directory.

const std::string & workDir () const
void start (commMode_t mode=NoCommunication) throw (SystemError,IOError,LogicError)
 Run program.

void stop () throw (SystemError)
 Terminate process.

void kill () throw (SystemError)
 Kill process.

bool tryWait (int &exitCode) throw (SystemError)
 Try wait for program to finish.

int wait () throw (SystemError)
 Wait for program to finish.

ProcessIOprocessIO () const throw ()
 Return pointer to process i/o object.


Static Public Member Functions

ProcesstryWaitAny (int &exitCode) throw (SystemError)
 Try waiting for any child process to exit.

ProcesswaitAny (int &exitCode) throw (SystemError)
 Wait for any child process to exit.


Detailed Description

Child process class.

This class is used to concurrently execute child processes.

Todo:
Process Win32 implementation
Author:
Christian Prochnow <cproch@seculogix.de>

Definition at line 95 of file pprocess.h.


Member Typedef Documentation

typedef std::list<std::string> P::Process::arg_list
 

Argument list type.

Definition at line 115 of file pprocess.h.


Member Enumeration Documentation

enum P::Process::commMode_t
 

Communication mode flags.

Enumeration values:
NoCommunication  No input/output
StdIn  Standard input
StdOut  Standard output
StdErr  Standard error output
AllOutput  All output
All  All input/output

Definition at line 105 of file pprocess.h.

enum P::Process::state_t
 

Child process state.

Enumeration values:
Stopped 
Running 
Stopping 

Definition at line 98 of file pprocess.h.


Constructor & Destructor Documentation

P::Process::Process const char *  path,
const arg_list args = arg_list()
throw (IOError)
 

Process constructor.

P::Process::~Process  )  throw ()
 


Member Function Documentation

void P::Process::addArg const char *  arg  ) 
 

Add argument.

void P::Process::clearArgs  ) 
 

Clear arguments.

void P::Process::kill  )  throw (SystemError)
 

Kill process.

ProcessIO* P::Process::processIO  )  const throw () [inline]
 

Return pointer to process i/o object.

This method returns a pointer to the ProcessIO object that can be used to communicate with the child process's stdin, stdout and stderr. The pointer returned maybe NULL if no process is active.

Returns:
a pointer to the ProcessIO object, which maybe NULL

Definition at line 169 of file pprocess.h.

void P::Process::setWorkDir const char *  dir  ) 
 

Set working directory.

void P::Process::start commMode_t  mode = NoCommunication  )  throw (SystemError,IOError,LogicError)
 

Run program.

state_t P::Process::state  )  const [inline]
 

Returns the process state.

Definition at line 124 of file pprocess.h.

void P::Process::stop  )  throw (SystemError)
 

Terminate process.

bool P::Process::tryWait int &  exitCode  )  throw (SystemError)
 

Try wait for program to finish.

Process* P::Process::tryWaitAny int &  exitCode  )  throw (SystemError) [static]
 

Try waiting for any child process to exit.

int P::Process::wait  )  throw (SystemError)
 

Wait for program to finish.

Process* P::Process::waitAny int &  exitCode  )  throw (SystemError) [static]
 

Wait for any child process to exit.

const std::string& P::Process::workDir  )  const [inline]
 

Definition at line 136 of file pprocess.h.


The documentation for this class was generated from the following file:
Generated on Fri Mar 12 21:08:35 2004 for P::Classes by doxygen 1.3.3