KrisLibrary  1.0.0
Public Types | Public Member Functions | Public Attributes | List of all members
StreamTransport Class Reference

A transport protocol that uses STL streams. More...

#include <AsyncIO.h>

Inheritance diagram for StreamTransport:
TransportBase

Public Types

enum  Format { IntLengthPrepended, NullTerminated, Ascii, Base64 }
 

Public Member Functions

 StreamTransport (std::istream &in)
 
 StreamTransport (std::ostream &out)
 
 StreamTransport (std::istream &in, std::ostream &out)
 
virtual bool ReadReady ()
 Subclasses – can the object read?
 
virtual bool WriteReady ()
 Subclasses – can the object write?
 
virtual const std::string * DoRead ()
 
virtual bool DoWrite (const char *msg, int length)
 
- Public Member Functions inherited from TransportBase
virtual bool Start ()
 Subclasses – can the object read?
 
virtual bool Stop ()
 
virtual bool DoWrite (const char *msg)
 
virtual bool DoWrite (const std::string &msg)
 

Public Attributes

std::istream * in
 
std::ostream * out
 
Format format
 
std::string buffer
 

Detailed Description

A transport protocol that uses STL streams.

Stream format is controlled by the format member. By default uses IntLengthPrepended.

Member Function Documentation

const string * StreamTransport::DoRead ( )
virtual

Subclasses – in thread, do some I/O and processing (which may block), return the payload message. If NULL is returned, there is some error and the thread quits

Reimplemented from TransportBase.

References SafeInputString().

bool StreamTransport::DoWrite ( const char *  msg,
int  length 
)
virtual

Subclasses – in thread, do some I/O and processing (which may block) If false is returned, there is some error and the caller should quit or reopen the connection.

Reimplemented from TransportBase.

References SafeOutputString().


The documentation for this class was generated from the following files: