Made to Order Software Corporation Logo

LLChatLib: LLIOPipe Class Reference

LLIOPipe Class Reference

This class is an abstract base class for data processing units. More...

#include <lliopipe.h>

Inheritance diagram for LLIOPipe:

List of all members.

Public Types

typedef boost::shared_ptr
< LLBufferArray
buffer_ptr_t
 Scattered memory container.

enum  EStatus
 

Enumeration for IO return codes.

More...

typedef boost::intrusive_ptr
< LLIOPipe
ptr_t
 I have decided that IO objects should have a reference count. In general, you can pass bald LLIOPipe pointers around as you need, but if you need to maintain a reference to one, you need to hold a ptr_t.

Public Member Functions

virtual EStatus handleError (EStatus status, LLPumpIO *pump)
 Give this pipe a chance to handle a generated error.

EStatus process (const LLChannelDescriptors &channels, buffer_ptr_t &buffer, bool &eos, LLSD &context, LLPumpIO *pump)
 Process the data in buffer.

virtual ~LLIOPipe ()
 Base Destructor - do not call delete directly.

Static Public Member Functions

static bool isError (EStatus status)
 Helper function to check status.

static bool isSuccess (EStatus status)
 Helper function to check status.

static std::string lookupStatusString (EStatus status)
 Helper function to turn status into a string.

Protected Member Functions

 LLIOPipe ()
 Base Constructor.

virtual EStatus process_impl (const LLChannelDescriptors &channels, buffer_ptr_t &buffer, bool &eos, LLSD &context, LLPumpIO *pump)=0
 Process the data in buffer.


Detailed Description

This class is an abstract base class for data processing units.

See also:
LLPumpIO

The LLIOPipe is a base class for implementing the basic non-blocking processing of data subsystem in our system.

Implementations of this class should behave like a stateful or stateless signal processor. Each call to process() hands the pipe implementation a buffer and a set of channels in the buffer to process, and the pipe returns the status of the operation. This is an abstract base class and developer created concrete implementations provide block or stream based processing of data to implement a particular protocol.


Member Enumeration Documentation

Enumeration for IO return codes.

A status code a positive integer value is considered a success, but may indicate special handling for future calls, for example, issuing a STATUS_STOP to an LLIOSocketReader instance will tell the instance to stop reading the socket. A status code with a negative value means that a problem has been encountered which will require further action on the caller or a developer to correct. Some mechanisms, such as the LLPumpIO may depend on this definition of success and failure.


Constructor & Destructor Documentation

LLIOPipe::LLIOPipe (  )  [protected]

Base Constructor.

LLIOPipe


Member Function Documentation

LLIOPipe::EStatus LLIOPipe::handleError ( LLIOPipe::EStatus  status,
LLPumpIO pump 
) [virtual]

Give this pipe a chance to handle a generated error.

If this pipe is in a chain being processed by a pump, and one of the pipes generates an error, the pump will rewind through the chain to see if any of the links can handle the error. For example, if a connection is refused in a socket connection, the socket client can try to find a new destination host. Return an error code if this pipe does not handle the error passed in.

Parameters:
status The status code for the error
pump The pump which was calling process before the error was generated.
Returns:
Returns a status code from the operation. Returns an error code if the error passed in was not handled. Returns STATUS_OK to indicate the error has been handled.

Reimplemented in LLURLRequest.

static bool LLIOPipe::isError ( EStatus  status  )  [inline, static]

Helper function to check status.

When writing code to check status codes, if you do not specifically check a particular value, use this method for checking an error condition.

Parameters:
status The status to check.
Returns:
Returns true if the code indicates an error occurred.
static bool LLIOPipe::isSuccess ( EStatus  status  )  [inline, static]

Helper function to check status.

When writing code to check status codes, if you do not specifically check a particular value, use this method for checking an error condition.

Parameters:
status The status to check.
Returns:
Returns true if the code indicates no error was generated.
std::string LLIOPipe::lookupStatusString ( EStatus  status  )  [static]

Helper function to turn status into a string.

Parameters:
status The status to check.
Returns:
Returns the name of the status code or empty string on failure.
LLIOPipe::EStatus LLIOPipe::process ( const LLChannelDescriptors channels,
buffer_ptr_t buffer,
bool &  eos,
LLSD context,
LLPumpIO pump 
)

Process the data in buffer.

Parameters:
data The data processed
eos True if this function call is the last because end of stream.
pump The pump which is calling process. May be NULL.
context Shared meta-data for the process.
Returns:
Returns a status code from the operation.

Here is the call graph for this function:


The documentation for this class was generated from the following files:
  • /home/doug/src/oss/slitechat/trunk/LLChatLib/llmessage/lliopipe.h
  • /home/doug/src/oss/slitechat/trunk/LLChatLib/llmessage/lliopipe.cpp
Generated on Thu Sep 23 17:18:42 2010 for LLChatLib by  doxygen 1.6.3