Edinburgh Speech Tools  2.4-release
 All Classes Functions Variables Typedefs Enumerations Enumerator Friends Pages
EST_TBuffer< TYPE > Class Template Reference

#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

Detailed Description

template<class TYPE>
class EST_TBuffer< TYPE >

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.

See Also
EST_TBuffer.h, Associated definitions.
EST_TVector, class to use for more general uses.
lpc_analyse, example of use.

Definition at line 86 of file EST_TBuffer.h.

Constructor & Destructor Documentation

template<class T >
EST_TBuffer< T >::EST_TBuffer ( unsigned int  size = TBUFFER_DEFAULT_SIZE,

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

See Also

Definition at line 49 of file EST_TBuffer.cc.

The documentation for this class was generated from the following files: