LLIOPipe Class Reference

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

#include <lliopipe.h>

Inheritance diagram for LLIOPipe:

Inheritance graph
[legend]
List of all members.

Public Types

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.
typedef boost::shared_ptr<
LLBufferArray
buffer_ptr_t
 Scattered memory container.
 STATUS_OK = 0
 STATUS_STOP = 1
 STATUS_DONE = 2
 STATUS_BREAK = 3
 STATUS_NEED_PROCESS = 4
 STATUS_SUCCESS_COUNT = 5
 STATUS_ERROR = -1
 STATUS_NOT_IMPLEMENTED = -2
 STATUS_PRECONDITION_NOT_MET = -3
 STATUS_NO_CONNECTION = -4
 STATUS_EXPIRED = -5
 STATUS_ERROR_COUNT = 5
enum  EStatus {
  STATUS_OK = 0, STATUS_STOP = 1, STATUS_DONE = 2, STATUS_BREAK = 3,
  STATUS_NEED_PROCESS = 4, STATUS_SUCCESS_COUNT = 5, STATUS_ERROR = -1, STATUS_NOT_IMPLEMENTED = -2,
  STATUS_PRECONDITION_NOT_MET = -3, STATUS_NO_CONNECTION = -4, STATUS_EXPIRED = -5, STATUS_ERROR_COUNT = 5
}
 Enumeration for IO return codes. More...

Public Member Functions

EStatus process (const LLChannelDescriptors &channels, buffer_ptr_t &buffer, bool &eos, LLSD &context, LLPumpIO *pump)
 Process the data in buffer.
virtual EStatus handleError (EStatus status, LLPumpIO *pump)
 Give this pipe a chance to handle a generated error.
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.

Private Attributes

U32 mReferenceCount

Friends

void intrusive_ptr_add_ref (LLIOPipe *p)
void intrusive_ptr_release (LLIOPipe *p)

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.

Definition at line 82 of file lliopipe.h.


Member Typedef Documentation

typedef boost::shared_ptr<LLBufferArray> LLIOPipe::buffer_ptr_t

Scattered memory container.

Definition at line 96 of file lliopipe.h.

typedef boost::intrusive_ptr<LLIOPipe> 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.

Definition at line 91 of file lliopipe.h.


Member Enumeration Documentation

enum LLIOPipe::EStatus

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.

Enumerator:
STATUS_OK 
STATUS_STOP 
STATUS_DONE 
STATUS_BREAK 
STATUS_NEED_PROCESS 
STATUS_SUCCESS_COUNT 
STATUS_ERROR 
STATUS_NOT_IMPLEMENTED 
STATUS_PRECONDITION_NOT_MET 
STATUS_NO_CONNECTION 
STATUS_EXPIRED 
STATUS_ERROR_COUNT 

Definition at line 110 of file lliopipe.h.


Constructor & Destructor Documentation

LLIOPipe::~LLIOPipe (  )  [virtual]

Base Destructor - do not call delete directly.

Definition at line 75 of file lliopipe.cpp.

LLIOPipe::LLIOPipe (  )  [protected]

Base Constructor.

LLIOPipe

Definition at line 70 of file lliopipe.cpp.


Member Function Documentation

LLIOPipe::EStatus LLIOPipe::handleError ( 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.

Definition at line 110 of file lliopipe.cpp.

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.

Definition at line 167 of file lliopipe.h.

References S32.

Referenced by LLPumpIO::processChain().

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.

Definition at line 181 of file lliopipe.h.

References S32.

Referenced by LLPumpIO::handleChainError(), and LLPumpIO::processChain().

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.

Definition at line 81 of file lliopipe.cpp.

References S32, STATUS_ERROR_COUNT, STATUS_ERROR_NAMES, STATUS_SUCCESS_COUNT, and STATUS_SUCCESS_NAMES.

Referenced by LLPumpIO::handleChainError(), and LLPumpIO::processChain().

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.

Definition at line 99 of file lliopipe.cpp.

References process_impl().

virtual EStatus LLIOPipe::process_impl ( const LLChannelDescriptors channels,
buffer_ptr_t buffer,
bool &  eos,
LLSD context,
LLPumpIO pump 
) [protected, pure virtual]

Process the data in buffer.

Implemented in LLHTTPPipe, and LLPipeStringExtractor.

Referenced by process().


Friends And Related Function Documentation

void intrusive_ptr_add_ref ( LLIOPipe p  )  [friend]

void intrusive_ptr_release ( LLIOPipe p  )  [friend]


Member Data Documentation

U32 LLIOPipe::mReferenceCount [private]

Definition at line 252 of file lliopipe.h.


The documentation for this class was generated from the following files:
Generated on Thu Jul 1 06:11:26 2010 for Second Life Viewer by  doxygen 1.4.7