This class is an abstract base class for data processing units. More...
#include <lliopipe.h>
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. |
This class is an abstract base class for data processing units.
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.
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.
LLIOPipe::LLIOPipe | ( | ) | [protected] |
Base Constructor.
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.
status | The status code for the error | |
pump | The pump which was calling process before the error was generated. |
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.
status | The status to check. |
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.
status | The status to check. |
std::string LLIOPipe::lookupStatusString | ( | EStatus | status | ) | [static] |
Helper function to turn status into a string.
status | The status to check. |
LLIOPipe::EStatus LLIOPipe::process | ( | const LLChannelDescriptors & | channels, | |
buffer_ptr_t & | buffer, | |||
bool & | eos, | |||
LLSD & | context, | |||
LLPumpIO * | pump | |||
) |
Process the data in buffer.
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. |