Made to Order Software Corporation Logo

LLChatLib: LLBuffer Class Reference

LLBuffer Class Reference

Abstract base class for buffers. More...

#include <llbuffer.h>

Inheritance diagram for LLBuffer:

List of all members.

Public Member Functions

virtual S32 capacity () const =0
 Return the current number of bytes allocated.

virtual bool containsSegment (const LLSegment &segment) const =0
 Test if a segment is inside this buffer.

virtual bool createSegment (S32 channel, S32 size, LLSegment &segment)=0
 Generate a segment for this buffer.

virtual bool reclaimSegment (const LLSegment &segment)=0
 Reclaim a segment from this buffer.

virtual ~LLBuffer ()
 The buffer base class should have no responsibilities other than an interface.


Detailed Description

Abstract base class for buffers.

This class declares the interface necessary for buffer arrays. A buffer is not necessarily a single contiguous memory chunk, so please do not circumvent the segment API.


Member Function Documentation

virtual S32 LLBuffer::capacity (  )  const [pure virtual]

Return the current number of bytes allocated.

This was implemented as a debugging tool, and it is not necessarily a good idea to use it for anything else.

Implemented in LLHeapBuffer.

virtual bool LLBuffer::containsSegment ( const LLSegment segment  )  const [pure virtual]

Test if a segment is inside this buffer.

Parameters:
segment The contiguous buffer segment to test.
Returns:
Returns true if the segment is in the bufffer.

Implemented in LLHeapBuffer.

virtual bool LLBuffer::createSegment ( S32  channel,
S32  size,
LLSegment segment 
) [pure virtual]

Generate a segment for this buffer.

The segment returned is always contiguous memory. This call can fail if no contiguous memory is available, eg, offset is past the end. The segment returned may be smaller than the requested size. The segment will never be larger than the requested size.

Parameters:
channel The channel for the segment.
offset The offset from zero in the buffer.
size The requested size of the segment.
segment[out] The out-value from the operation
Returns:
Returns true if a segment was found.

Implemented in LLHeapBuffer.

virtual bool LLBuffer::reclaimSegment ( const LLSegment segment  )  [pure virtual]

Reclaim a segment from this buffer.

This method is called on a buffer object when a caller is done with a contiguous segment of memory inside this buffer. Since segments can be cut arbitrarily outside of the control of the buffer, this segment may not match any segment returned from createSegment().

Parameters:
segment The contiguous buffer segment to reclaim.
Returns:
Returns true if the call was successful.

Implemented in LLHeapBuffer.


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