Extending buffer class. More...
#include <include/EST_TBuffer.h>
Public Member Functions | |
EST_TBuffer (unsigned int size=TBUFFER_DEFAULT_SIZE, int step=TBUFFER_DEFAULT_STEP) | |
~EST_TBuffer (void) | |
Destructor. Places the memory in EST_old_buffers[] for re-use if there is room. More... | |
unsigned int | length (void) const |
Current available space. More... | |
void | set (const T &set_to, int howmany=-1) |
Set to the given value. By default sets all values. More... | |
Methods to make sure there is enough space. | |
void | ensure (unsigned int req_size) |
Extend if needed, copying existing data. More... | |
void | ensure (unsigned int req_size, bool copy) |
Make sure there is enough space, copying if requested. More... | |
void | ensure (unsigned int req_size, const T &set_to, int howmany=-1) |
Make sure there is enough space, setting to a known value. More... | |
Access to the memory itself. | |
T * | b (void) |
Simple access as a pointer. More... | |
const T * | b (void) const |
Read-only access when the EST_TBuffer is a constant. More... | |
const T & | operator() (unsigned int i) const |
operator () is simple access More... | |
T & | operator[] (unsigned int i) |
const T & | operator[] (unsigned int i) const |
Extending buffer class.
This class provides the convenience of arrays which change in size at run time rather more efficiently than the full EST_TVector class would.
Buffers can only be expanded and when a buffer is no longer needed (i.e. when the variable goes out of scope) the memory is not deleted, rather it is saved for re-use as a new buffer.
A typical use would be a buffer to hold a windowed section of a signal inside a signal processing loop where the size of the window changes from iteration to iteration.
Definition at line 86 of file EST_TBuffer.h.
EST_TBuffer< T >::EST_TBuffer | ( | unsigned int | size = TBUFFER_DEFAULT_SIZE , |
int | step = TBUFFER_DEFAULT_STEP |
||
) |
Create with size and increment. Increment can be negative for percentage growth.
Tries to use a buffer from EST_old_buffers[] if there is one which is suitable
Definition at line 49 of file EST_TBuffer.cc.
EST_TBuffer< T >::~EST_TBuffer | ( | void | ) |
Destructor. Places the memory in EST_old_buffers[] for re-use if there is room.
Definition at line 56 of file EST_TBuffer.cc.
|
inline |
Current available space.
Definition at line 119 of file EST_TBuffer.h.
void EST_TBuffer< T >::set | ( | const T & | set_to, |
int | howmany = -1 |
||
) |
Set to the given value. By default sets all values.
Definition at line 149 of file EST_TBuffer.cc.
|
inline |
Extend if needed, copying existing data.
Definition at line 128 of file EST_TBuffer.h.
|
inline |
Make sure there is enough space, copying if requested.
Definition at line 132 of file EST_TBuffer.h.
|
inline |
Make sure there is enough space, setting to a known value.
Definition at line 136 of file EST_TBuffer.h.
|
inline |
Simple access as a pointer.
Definition at line 144 of file EST_TBuffer.h.
|
inline |
Read-only access when the EST_TBuffer is a constant.
Definition at line 146 of file EST_TBuffer.h.
|
inline |
operator () is simple access
Definition at line 149 of file EST_TBuffer.h.
|
inline |
Definition at line 151 of file EST_TBuffer.h.
|
inline |
Definition at line 152 of file EST_TBuffer.h.