#include <lliopipe.h>
Inheritance diagram for LLIOPipe:
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) |
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.
typedef boost::shared_ptr<LLBufferArray> LLIOPipe::buffer_ptr_t |
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.
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.
Definition at line 110 of file lliopipe.h.
LLIOPipe::~LLIOPipe | ( | ) | [virtual] |
LLIOPipe::LLIOPipe | ( | ) | [protected] |
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.
status | The status code for the error | |
pump | The pump which was calling process before the error was generated. |
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.
status | The status to check. |
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.
status | The status to check. |
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.
status | The status to check. |
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.
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. |
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().
U32 LLIOPipe::mReferenceCount [private] |
Definition at line 252 of file lliopipe.h.