#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. | |
| unsigned int | length (void) const |
| Current available space. | |
| void | set (const TYPE &set_to, int howmany=-1) |
| Set to the given value. By default sets all values. | |
Methods to make sure there is enough space. | |
| void | ensure (unsigned int req_size) |
| Extend if needed, copying existing data. | |
| void | ensure (unsigned int req_size, bool copy) |
| Make sure there is enough space, copying if requested. | |
| void | ensure (unsigned int req_size, const TYPE &set_to, int howmany=-1) |
| Make sure there is enough space, setting to a known value. | |
Access to the memory itself. | |
| TYPE * | b (void) |
| Simple access as a pointer. | |
| const TYPE * | b (void) const |
| Read-only access when the EST_TBuffer is a constant. | |
| const TYPE & | operator() (unsigned int i) const |
| operator () is simple access | |
| TYPE & | operator[] (unsigned int i) |
| const TYPE & | 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.