ExternalDataSource Class Reference

Bidirectional stream to external data. More...

#include <ExternalDataSource.h>

Inheritance diagram for ExternalDataSource:

ExternalProgram

List of all members.

Public Member Functions

 ExternalDataSource (FILE *inputfile=0, FILE *outputfile=0)
virtual ~ExternalDataSource ()
bool send (const char *buffer, size_t length)
bool send (std::string s)
size_t receive (char *buffer, size_t length)
std::string receiveLine ()
std::string receiveUpto (char c)
void setBlocking (bool mode)
virtual int close ()
FILE * inputFile () const
FILE * outputFile () const

Protected Attributes

FILE * inputfile
FILE * outputfile

Private Attributes

char * linebuffer
size_t linebuffer_size


Detailed Description

Bidirectional stream to external data.

Constructor & Destructor Documentation

ExternalDataSource::ExternalDataSource ( FILE *  inputfile = 0,
FILE *  outputfile = 0 
)

Create a new instance.

Parameters:
inputfile The stream for reading
outputfile The stream for writing Either can be NULL if no reading/writing is allowed.

virtual ExternalDataSource::~ExternalDataSource (  )  [virtual]

Implicitly close the connection.


Member Function Documentation

bool ExternalDataSource::send ( const char *  buffer,
size_t  length 
)

Send some data to the output stream.

Parameters:
buffer The data to send
length The size of it

bool ExternalDataSource::send ( std::string  s  ) 

Send some data down the stream.

Parameters:
string The data to send

size_t ExternalDataSource::receive ( char *  buffer,
size_t  length 
)

Read some data from the input stream.

Parameters:
buffer Where to put the data
length How much to read at most Returns the amount actually received

std::string ExternalDataSource::receiveLine (  ) 

Read one line from the input stream. Returns the line read, including the terminator.

std::string ExternalDataSource::receiveUpto ( char  c  ) 

Read characters into a string until character c is read. C is put at the end of the string.

void ExternalDataSource::setBlocking ( bool  mode  ) 

Set the blocking mode of the input stream.

Parameters:
mode True if the reader should be blocked waiting for input. This is the initial default.

virtual int ExternalDataSource::close (  )  [virtual]

Close the input and output streams.

Reimplemented in ExternalProgram.

FILE* ExternalDataSource::inputFile (  )  const [inline]

Return the input stream.

FILE* ExternalDataSource::outputFile (  )  const [inline]

Return the output stream.


Member Data Documentation

FILE* ExternalDataSource::inputfile [protected]

FILE* ExternalDataSource::outputfile [protected]

char* ExternalDataSource::linebuffer [private]

size_t ExternalDataSource::linebuffer_size [private]


The documentation for this class was generated from the following file:
Generated on Fri Sep 21 22:35:03 2007 for liby2util by  doxygen 1.5.3