libcommonc++
0.7
|
An abstract base class for buffers. More...
#include <AbstractBuffer.h++>
Public Member Functions | |
virtual | ~AbstractBuffer () |
Destructor. More... | |
virtual void | setSize (uint_t newSize) |
Resize the buffer. More... | |
virtual void | clear () |
Clear the buffer. More... | |
uint_t | getSize () const |
Get the size of the buffer. More... | |
virtual uint_t | getRemaining () const =0 |
Get the number of elements remaining in the buffer. More... | |
virtual bool | hasRemaining () const |
Test if the buffer has elements available to be read or written. More... | |
T * | getBase () |
Get a pointer to the base of the buffer. More... | |
const T * | getBase () const |
Get a pointer to the base of the buffer. More... | |
Protected Member Functions | |
AbstractBuffer (uint_t size) | |
Construct a new buffer with the given size. More... | |
AbstractBuffer (T *data, size_t size, bool takeOwnership=true) | |
Construct a new buffer to wrap a raw byte buffer. More... | |
Protected Attributes | |
T * | _data |
A pointer to the raw buffer. More... | |
uint_t | _size |
The size of the buffer. More... | |
bool | _owner |
Whether this object owns the raw buffer. More... | |
An abstract base class for buffers.
|
virtual |
Destructor.
|
protected |
Construct a new buffer with the given size.
size | The capacity of the buffer, in elements. |
|
protected |
Construct a new buffer to wrap a raw byte buffer.
size | The capacity of the buffer, in elements. |
|
virtual |
Clear the buffer.
Reimplemented in Buffer< T >, Buffer< char >, CircularBuffer< T >, CircularBuffer< C >, and CircularBuffer< byte_t >.
|
inline |
Get a pointer to the base of the buffer.
|
inline |
Get a pointer to the base of the buffer.
|
pure virtual |
Get the number of elements remaining in the buffer.
Implemented in Buffer< T >, Buffer< char >, CircularBuffer< T >, CircularBuffer< C >, and CircularBuffer< byte_t >.
|
inline |
Get the size of the buffer.
|
inlinevirtual |
Test if the buffer has elements available to be read or written.
Reimplemented in Buffer< T >, and Buffer< char >.
|
virtual |
Resize the buffer.
newSize | The new size, in elements. |
UnsupportedOperationException | If this object does not own the underlying byte buffer. |
Reimplemented in CircularBuffer< T >, CircularBuffer< C >, and CircularBuffer< byte_t >.
|
protected |
A pointer to the raw buffer.
|
protected |
Whether this object owns the raw buffer.
|
protected |
The size of the buffer.