WvStreams
|
A buffer that wraps a pre-allocated array and provides read-write access to its elements. More...
#include <wvbufbase.h>
Public Member Functions | |
WvInPlaceBufBase (T *_data, size_t _avail, size_t _size, bool _autofree=false) | |
Creates a new buffer backed by the supplied array. More... | |
WvInPlaceBufBase (size_t _size) | |
Creates a new empty buffer backed by a new array. More... | |
WvInPlaceBufBase () | |
Creates a new empty buffer with no backing array. | |
virtual | ~WvInPlaceBufBase () |
Destroys the buffer. More... | |
T * | ptr () const |
Returns the underlying array pointer. More... | |
size_t | size () const |
Returns the total size of the buffer. More... | |
bool | get_autofree () const |
Returns the autofree flag. More... | |
void | set_autofree (bool _autofree) |
Sets or clears the autofree flag. More... | |
void | reset (T *_data, size_t _avail, size_t _size, bool _autofree=false) |
Resets the underlying buffer pointer and properties. More... | |
void | setavail (size_t _avail) |
Sets the amount of available data using the current buffer and resets the read index to the beginning of the buffer. More... | |
Protected Types | |
typedef T | Elem |
Protected Attributes | |
WvInPlaceBufStore | mystore |
A buffer that wraps a pre-allocated array and provides read-write access to its elements.
"T" is the type of object to store, must be a primitive or a struct without special initialization, copy, or assignment semantics
Definition at line 603 of file wvbufbase.h.
|
inline |
Creates a new buffer backed by the supplied array.
"_data" is the array of data to wrap "_avail" is the amount of data available for reading "_size" is the size of the array "_autofree" is if true, the array will be freed when discarded
Definition at line 619 of file wvbufbase.h.
|
inlineexplicit |
Creates a new empty buffer backed by a new array.
"_size" is the size of the array
Definition at line 630 of file wvbufbase.h.
|
inlinevirtual |
Destroys the buffer.
Frees the underlying array if autofree().
Definition at line 645 of file wvbufbase.h.
|
inline |
Returns the underlying array pointer.
Returns: the element pointer
Definition at line 652 of file wvbufbase.h.
|
inline |
Returns the total size of the buffer.
Returns: the number of elements
Definition at line 662 of file wvbufbase.h.
|
inline |
|
inline |
Sets or clears the autofree flag.
"_autofree" is if true, the array will be freed when discarded
Definition at line 682 of file wvbufbase.h.
|
inline |
Resets the underlying buffer pointer and properties.
If the old and new buffer pointers differ and the old buffer was specified as autofree, the old buffer is destroyed.
"_data" is the array of data to wrap "_avail" is the amount of data available for reading "_size" is the size of the array "_autofree" is if true, the array will be freed when discarded
Definition at line 698 of file wvbufbase.h.
|
inline |
Sets the amount of available data using the current buffer and resets the read index to the beginning of the buffer.
"_avail" is the amount of data available for reading
Definition at line 711 of file wvbufbase.h.