LLIOBuffer Class Reference

This class is an io class that represents an automtically resizing io buffer. More...

#include <lliobuffer.h>

Inheritance diagram for LLIOBuffer:

Inheritance graph
[legend]
Collaboration diagram for LLIOBuffer:

Collaboration graph
[legend]
List of all members.

Public Types

 READ
 WRITE
enum  EHead { READ, WRITE }
 Enumeration passed into the seek function. More...

Public Member Functions

 LLIOBuffer ()
virtual ~LLIOBuffer ()
U8data () const
 Return a raw pointer to the current data set.
S64 size () const
 Return the size of the buffer.
U8current () const
 Return a raw pointer to the current read position in the data.
S64 bytesLeft () const
 Return the number of unprocessed bytes in buffer.
void clear ()
 Move the buffer offsets back to the beginning.
EStatus seek (EHead head, S64 delta)
 Seek to a place in the buffer.

Protected Member Functions

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

Protected Attributes

U8mBuffer
S64 mBufferSize
U8mReadHead
U8mWriteHead

Detailed Description

This class is an io class that represents an automtically resizing io buffer.

See also:
LLIOPipe
This class is currently impelemented quick and dirty, but should be correct. This class should be extended to have a more flexible (and capped) memory allocation and usage scheme. Eventually, I would like to have the ability to share this buffer between different objects.

Definition at line 51 of file lliobuffer.h.


Member Enumeration Documentation

enum LLIOBuffer::EHead

Enumeration passed into the seek function.

The READ head is used for where to start processing data for the next link in the chain, while the WRITE head specifies where new data processed from the previous link in the chain will be written.

Enumerator:
READ 
WRITE 

Definition at line 102 of file lliobuffer.h.


Constructor & Destructor Documentation

LLIOBuffer::LLIOBuffer (  ) 

Definition at line 40 of file lliobuffer.cpp.

LLIOBuffer::~LLIOBuffer (  )  [virtual]

Definition at line 48 of file lliobuffer.cpp.

References mBuffer.


Member Function Documentation

S64 LLIOBuffer::bytesLeft (  )  const

Return the number of unprocessed bytes in buffer.

Definition at line 71 of file lliobuffer.cpp.

References mReadHead, and mWriteHead.

void LLIOBuffer::clear (  ) 

Move the buffer offsets back to the beginning.

This method effectively clears what has been stored here, without mucking around with memory allocation.

Definition at line 76 of file lliobuffer.cpp.

References mBuffer, mReadHead, and mWriteHead.

U8 * LLIOBuffer::current (  )  const

Return a raw pointer to the current read position in the data.

The pointer returned can be used for reading or even adjustment if you are a bit crazy up to bytesLeft() bytes into memory.

Returns:
A potentially NULL pointer to the buffer data starting at the read point

Definition at line 66 of file lliobuffer.cpp.

References mReadHead.

U8 * LLIOBuffer::data (  )  const

Return a raw pointer to the current data set.

The pointer returned can be used for reading or even adjustment if you are a bit crazy up to size() bytes into memory.

Returns:
A potentially NULL pointer to the raw buffer data

Definition at line 56 of file lliobuffer.cpp.

References mBuffer.

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

Process the data in buffer.

Definition at line 109 of file lliobuffer.cpp.

References llendl, llwarns, and LLIOPipe::STATUS_OK.

LLIOPipe::EStatus LLIOBuffer::seek ( EHead  head,
S64  delta 
)

Seek to a place in the buffer.

Parameters:
head The READ or WRITE head.
delta The offset from the current position to seek.
Returns:
The status of the operation. status >= if head moved.

Definition at line 82 of file lliobuffer.cpp.

References mBuffer, mBufferSize, mReadHead, mWriteHead, READ, LLIOPipe::STATUS_ERROR, LLIOPipe::STATUS_OK, and WRITE.

S64 LLIOBuffer::size (  )  const

Return the size of the buffer.

Definition at line 61 of file lliobuffer.cpp.

References mBufferSize.


Member Data Documentation

U8* LLIOBuffer::mBuffer [protected]

Definition at line 134 of file lliobuffer.h.

Referenced by clear(), data(), seek(), and ~LLIOBuffer().

S64 LLIOBuffer::mBufferSize [protected]

Definition at line 135 of file lliobuffer.h.

Referenced by seek(), and size().

U8* LLIOBuffer::mReadHead [protected]

Definition at line 136 of file lliobuffer.h.

Referenced by bytesLeft(), clear(), current(), and seek().

U8* LLIOBuffer::mWriteHead [protected]

Definition at line 137 of file lliobuffer.h.

Referenced by bytesLeft(), clear(), and seek().


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