Developer Documentation
RAVL, Recognition And Vision Library
USER HOME PAGE CLASS LIST CONTENTS
Ravl - OS - Exec - ChildOSProcessBodyC
 

  PUBLIC
ChildOSProcessBodyC::ChildOSProcessBodyC(void)
ChildOSProcessBodyC::ChildOSProcessBodyC(StringC,bool,bool,bool)
ChildOSProcessBodyC::ChildOSProcessBodyC(StringC,FilenameC,bool,bool)
ChildOSProcessBodyC::ChildOSProcessBodyC(StringListC)
ChildOSProcessBodyC::Run(StringListC,bool,bool,bool)
ChildOSProcessBodyC::Run(StringListC,FilenameC,bool,bool)
ChildOSProcessBodyC::StdOut(void)
ChildOSProcessBodyC::StdErr(void)
ChildOSProcessBodyC::StdIn(void)
ChildOSProcessBodyC::GetPID(void) const
ChildOSProcessBodyC::IsRunning(void)
ChildOSProcessBodyC::ExitedOk(void)
ChildOSProcessBodyC::Wait(void)
ChildOSProcessBodyC::Wait(double)
ChildOSProcessBodyC::ExitCode(void) const
ChildOSProcessBodyC::Terminate(double)
ChildOSProcessBodyC::GotExitCode(int)
ChildOSProcessBodyC::Exec(StringListC,int,int,int)
ChildOSProcessBodyC::SetupPipe(IStreamC &)
ChildOSProcessBodyC::SetupPipe(OStreamC &)
ChildOSProcessBodyC::CheckExit(bool)
OSProcessBodyC::Signal(IntT)
OSProcessBodyC::Kill(bool)
OSProcessBodyC::SigStop(void)
OSProcessBodyC::SigContinue(void)
OSProcessBodyC::Pid(void) const
OSProcessBodyC::Owner(void)
OSProcessBodyC::Hash(void) const
OSProcessBodyC::MemorySize(void)
OSProcessBodyC::ProcFile(void)
RCBodyC::References(void) const
RCBodyC::Copy(void) const
RCBodyC::DeepCopy(UIntT) const
RCBodyC::IncRefCounter(void)
RCBodyC::DecRefCounter(void)

   ChildOSProcessBodyC   
 
Child process body.
 
include "Ravl/OS/ChildOSProcess.hh"
Created:24/11/98 
Source file:Ravl/OS/Exec/ChildOSProcess.hh
User Level:Develop
Library:RavlOS
Example:exChild.cc
In Scope:RavlN

Comments:
This class forks off a child process.

Parent Classes: Variables:
IStreamC pstdout;

IStreamC pstderr;

OStreamC pstdin;

bool running;
Child process process running last time we looked ?

bool exitok;
Did child exit normally ?

int exitcode;

Methods:
ChildOSProcessBodyC()
Default constructor.

ChildOSProcessBodyC(StringC args,bool useStdOut = false,bool useStdErr = false,bool useStdIn = false)
Start a child process.

ChildOSProcessBodyC(StringC args,FilenameC out,bool redirectStderr = false,bool useStdIn = false)
Start a child process.

ChildOSProcessBodyC(StringListC args)
Start a child process.
where the first arg is the name of the program to run.

bool Run(StringListC args,bool useStdOut = false,bool useStdErr = false,bool useStdIn = false)
Run child process.
where the first arg is the name of the program to run. Will return false if failed, or if child is already running. NB. If StdErr or StdOut are false, the output will go to StdErr or StdOut of this process.

bool Run(StringListC args,FilenameC out,bool redirectStderr = false,bool useStdIn = false)
Run, sending output to a file.

IStreamC & StdOut()
Get the stdout of the process.
Is invalid, if output is not directed back to this process.

IStreamC & StdErr()
Get the stderr of the process.
Is invalid, if output is not directed back to this process.

OStreamC & StdIn()
Send to the stdin of the process.
Is invalid, if output is not directed back to this process.

int GetPID() const
Get the process ID.

bool IsRunning()
Test if child is still running.

bool ExitedOk()
Test eixted ok flag.
only valid if child has actual exited cleanly as apposed to a seg fault or signal.

bool Wait()
Wait for program to exit.
This function will not return until the program has exited.

bool Wait(double maxTime)
Wait for program to exit.
maxTime in the maximum time in seconds, if it is negative it won't time out.

IntT ExitCode() const
Get exit code.
Return the exit code of the program, if the program failed to exit normal this is set to the signal number which ended the program. This variable is only valid if program has exited.

bool Terminate(double maxTime = 10)
Terminate a process politely.

bool GotExitCode(int code)
Call if you get the exit code from OSProcessC::WaitForChild()
Returns TRUE as ExitedOk().

bool Exec(StringListC args,int infd,int outfd,int errfd)
Execute a program.
if infd,outfd or errfd are negative there not changed. otherwise they are used by the child process as standard input, output and error.

int SetupPipe(IStreamC & strm)
Setup input stream.
Connect strm to one end, and return a file descriptor for the other. If failed returns -1.

int SetupPipe(OStreamC & strm)
Setup output stream.
Connect strm to one end, and return a file descriptor for the other. If failed returns -1.

bool CheckExit(bool block = false)
Check exit status of child.
Returns TRUE if child has exited, and false if is still running or was never run.

#include "Ravl/OS/OSProcess.hh"
bool Signal(IntT signo)
Send a signal to the process.

bool Kill(bool hard = false)
Kill the child process.
If hard is FALSE, a SIGQUIT is sent.(This can be intercepted by the process) Otherwise a SIGKILL is sent.

bool SigStop()
Stop this process. (As Ctrl-z)

bool SigContinue()
Continue this process.
Restart the this process after a stop.

int Pid() const
Get process id.

UserInfoC Owner()
Find the owner of the process.

UIntT Hash() const
Hash on pid.

UIntT MemorySize()
Get the amount of memory this process is using.
Returns 0 if failed. 1 if special Will return ((UIntT) -1) if process size is bigger than 4Gb.

StringC ProcFile()
Generate filename for entry in /proc/

#include "Ravl/RefCounter.hh"
UIntT References() const
Access count of handles open to this object.

RCBodyC & Copy() const
Make copy of body.
This should be provided in derived classes. this funtion will issue an assertion failure if called.

RCBodyC & DeepCopy(UIntT levels = ((UIntT))) const
Make a deep copy of body.
This should be provided in derived classes. this funtion will issue an assertion failure if called.

void IncRefCounter()
Increment reference counter.

bool DecRefCounter()
Decrement reference counter.


Maintainer:Charles Galambos, Created: 24/11/98, Documentation by CxxDoc: Tue Aug 13 09:59:30 2002