ocra-recipes
Doxygen documentation for the ocra-recipes repository
|
#include <Buffer.h>
Public Types | |
typedef T | value_type |
typedef T * | ptr_type |
Public Member Functions | |
Buffer (size_t size) | |
~Buffer () | |
void | resize (size_t size) |
void | reset () |
ptr_type | allocate (size_t n) |
size_t | size () const |
size_t | freeSize () const |
This class acts as a memory pool for objects of type T. Upon request it returns a pointer to an array of T of size specified by the caller, provided it owns enough memory for that. It allocates contiguous memory blocks and ensures memory release when resizing or dying. Thus, you need not free the memory obtained via this class.
typedef T* ocra::Buffer< T >::ptr_type |
typedef T ocra::Buffer< T >::value_type |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Resize the memory buffer to a size greater or equal to the parameter size. Wether there is really a buffer resizing or not, the previously returned buffer need to be considered as invalid, since calls to allocate subsequent to a resize will return buffers starting from the beginning of the memory pool again.
|
inline |