Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

PipeStreamBuf Class Reference

#include <pfstreamBuf.h>

List of all members.

Public Types

enum  Direction { Input, Output }

Public Member Functions

 PipeStreamBuf (Direction)
virtual ~PipeStreamBuf (void)
void flush ()
void command (const string)

Protected Member Functions

virtual int overflow (int c)
virtual int sync (void)
virtual int underflow (void)

Private Member Functions

void init_pipe ()
 Initializes whatever data structures store the child process information.

bool is_open () const
 Returns true if the pipe has been opened, false otherwise.

bool eof_pipe () const
 Returns true if there is an end-of-file condition on the input, or if the pipe was never opened.

bool open_pipe (const string &cmd)
 Forks a child to run the indicated command, and according to the setting of _dir, binds either its input or output to this process for writing or reading.

void close_pipe ()
 Closes the pipe opened previously.

size_t write_pipe (const char *data, size_t len)
 Writes the indicated data out to the child process opened previously.

size_t read_pipe (char *data, size_t len)
 Reads the indicated amount of data from the child process opened previously.

void write_chars (const char *, int, bool)

Private Attributes

Direction _dir
string _line_buffer
FILE * _pipe


Member Enumeration Documentation

enum PipeStreamBuf::Direction
 

Enumeration values:
Input 
Output 

Definition at line 51 of file pfstreamBuf.h.


Constructor & Destructor Documentation

PipeStreamBuf::PipeStreamBuf PipeStreamBuf::Direction  dir  ) 
 

Definition at line 25 of file pfstreamBuf.cxx.

PipeStreamBuf::~PipeStreamBuf void   )  [virtual]
 

Definition at line 44 of file pfstreamBuf.cxx.


Member Function Documentation

void PipeStreamBuf::close_pipe  )  [private]
 

Closes the pipe opened previously.

Definition at line 248 of file pfstreamBuf.cxx.

References _pipe, and size_t.

void PipeStreamBuf::command const  string  ) 
 

Definition at line 59 of file pfstreamBuf.cxx.

bool PipeStreamBuf::eof_pipe  )  const [private]
 

Returns true if there is an end-of-file condition on the input, or if the pipe was never opened.

Definition at line 210 of file pfstreamBuf.cxx.

References _dir, _pipe, NULL, and Output.

void PipeStreamBuf::flush  ) 
 

Definition at line 52 of file pfstreamBuf.cxx.

void PipeStreamBuf::init_pipe  )  [private]
 

Initializes whatever data structures store the child process information.

This function is only called once at startup, by the constructor.

Definition at line 180 of file pfstreamBuf.cxx.

References _pipe, and NULL.

bool PipeStreamBuf::is_open  )  const [private]
 

Returns true if the pipe has been opened, false otherwise.

Definition at line 195 of file pfstreamBuf.cxx.

References _pipe, and NULL.

bool PipeStreamBuf::open_pipe const string &  cmd  )  [private]
 

Forks a child to run the indicated command, and according to the setting of _dir, binds either its input or output to this process for writing or reading.

Returns true on success, false on failure.

Definition at line 233 of file pfstreamBuf.cxx.

References _pipe, and size_t.

int PipeStreamBuf::overflow int  c  )  [protected, virtual]
 

Definition at line 64 of file pfstreamBuf.cxx.

References streamsize.

size_t PipeStreamBuf::read_pipe char *  data,
size_t  len
[private]
 

Reads the indicated amount of data from the child process opened previously.

Returns the number of bytes read.

Definition at line 285 of file pfstreamBuf.cxx.

int PipeStreamBuf::sync void   )  [protected, virtual]
 

Definition at line 80 of file pfstreamBuf.cxx.

References streamsize.

int PipeStreamBuf::underflow void   )  [protected, virtual]
 

Definition at line 98 of file pfstreamBuf.cxx.

void PipeStreamBuf::write_chars const char *  ,
int  ,
bool 
[private]
 

Definition at line 136 of file pfstreamBuf.cxx.

References _line_buffer.

size_t PipeStreamBuf::write_pipe const char *  data,
size_t  len
[private]
 

Writes the indicated data out to the child process opened previously.

Returns the number of bytes read.

Definition at line 266 of file pfstreamBuf.cxx.


Member Data Documentation

Direction PipeStreamBuf::_dir [private]
 

Definition at line 72 of file pfstreamBuf.h.

Referenced by eof_pipe().

string PipeStreamBuf::_line_buffer [private]
 

Definition at line 73 of file pfstreamBuf.h.

Referenced by write_chars().

FILE* PipeStreamBuf::_pipe [private]
 

Definition at line 76 of file pfstreamBuf.h.

Referenced by close_pipe(), eof_pipe(), init_pipe(), is_open(), and open_pipe().


The documentation for this class was generated from the following files:
Generated on Thu May 1 22:13:44 2003 for DTool by doxygen1.3