Abstract base class for buffers. More...
#include <llbuffer.h>
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. |
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.
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.
segment | The contiguous buffer segment to test. |
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.
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 |
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()
.
segment | The contiguous buffer segment to reclaim. |
Implemented in LLHeapBuffer.