Sourceforge.net - The VCF's Project Host
   The VCF Website Home   |   Online Discussion Forums   |   Sourceforge.net Project Page   

VCF::ProcessWithRedirectedIO Class Reference

This class represents a process that has it's IO redirected so that when there is new data available an event is fired to any registered event handlers. More...

#include <vcf/FoundationKit/ProcessWithRedirectedIO.h>

Inheritance diagram for VCF::ProcessWithRedirectedIO:

VCF::Object List of all members.

Public Member Functions

 ProcessWithRedirectedIO ()
 Constructs a ProcessWithRedirectedIO.
 ProcessWithRedirectedIO (const String &processName, const String &arguments)
 Constructs a ProcessWithRedirectedIO.
virtual ~ProcessWithRedirectedIO ()
int getID ()
 Returns the ID of the process.
int getThreadID ()
 returns the processes's main thread ID
bool createProcess (const String &processName, const String &arguments)
 creates/runs the process
String getName ()
 returns the name of the process including any commandline supplied.
ProcessIORedirectionPeergetPeer ()
 returns the current peer instance.
void addOutputReadyHandler (EventHandler *eventHandler)
 adds a new output ready handler.
void removeOutputReadyHandler (EventHandler *eventHandler)
uint32 terminate ()

Public Attributes

VCF::Delegate OutputReadyDelegate
 OutputReady

Protected Attributes

ProcessIORedirectionPeerprocessPeer_

Detailed Description

This class represents a process that has it's IO redirected so that when there is new data available an event is fired to any registered event handlers.

Currently only output is captured and redirected. You can register an event handler with the addOutputReadyHandler() method. To start the process either call createProcess() or construct the process and pass in a filename/commandline to the constructor.


Constructor & Destructor Documentation

VCF::ProcessWithRedirectedIO::ProcessWithRedirectedIO  ) 
 

Constructs a ProcessWithRedirectedIO.

Does NOT actually start the process.

VCF::ProcessWithRedirectedIO::ProcessWithRedirectedIO const String processName,
const String arguments
 

Constructs a ProcessWithRedirectedIO.

It will then call the createProcess() with the processName passed in. if createProcess() returns false then an RuntimeException will be thrown

virtual VCF::ProcessWithRedirectedIO::~ProcessWithRedirectedIO  )  [virtual]
 


Member Function Documentation

void VCF::ProcessWithRedirectedIO::addOutputReadyHandler EventHandler eventHandler  )  [inline]
 

adds a new output ready handler.

Please note (for at least Win32 implementations, when data is a ready and the the new event is fired, this will happen in the context of a different thread than the one in which the ProcessWithRedirectedIO was created in.

Deprecated:
  • use the OutputReady delegate directly.

bool VCF::ProcessWithRedirectedIO::createProcess const String processName,
const String arguments
 

creates/runs the process

Parameters:
String the name of the process to run. createProcess() will block till the process is finished running.
arguments the arguments, or command line, to pass to the process
Returns:
bool indicates wether the process creation was successful. If the process was successful then it returns true. If not then it returns false.

int VCF::ProcessWithRedirectedIO::getID  ) 
 

Returns the ID of the process.

String VCF::ProcessWithRedirectedIO::getName  ) 
 

returns the name of the process including any commandline supplied.

ProcessIORedirectionPeer* VCF::ProcessWithRedirectedIO::getPeer  )  [inline]
 

returns the current peer instance.

Should NEVER be NULL as the constructors should throw exceptions if a NULL peer is returned from the SystemToolkit

int VCF::ProcessWithRedirectedIO::getThreadID  ) 
 

returns the processes's main thread ID

void VCF::ProcessWithRedirectedIO::removeOutputReadyHandler EventHandler eventHandler  )  [inline]
 

Deprecated:
  • use the OutputReady delegate directly.

uint32 VCF::ProcessWithRedirectedIO::terminate  ) 
 


Member Data Documentation

VCF::ProcessWithRedirectedIO::OutputReady
 

VCF::Delegate VCF::ProcessWithRedirectedIO::OutputReadyDelegate
 

Event Delegate:
OutputReady fires an OutputReadyEvent. This is fired by the framework, specifically the ProcessIORedirectionPeer, whenever data has become available and read to read. The peer will allocate the data in the form of a string (it's assumed to be text format).
Note:
Please note that when data is a ready and the the new event is fired, at least in the Win32 implementation, this event will be fired in the context of a different thread than the one in which the ProcessWithRedirectedIO was created in.
event class: OutputReadyEvent
event type:

ProcessIORedirectionPeer* VCF::ProcessWithRedirectedIO::processPeer_ [protected]
 


The documentation for this class was generated from the following file:
   Comments or Suggestions?    License Information