Loading...
Searching...
No Matches
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

## EST_TBuffer()

template<class T>

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

See also
  EST_old_buffers

Definition at line 49 of file EST_TBuffer.cc.

## ~EST_TBuffer()

template<class T>

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.

## Member Function Documentation

## length()

template<class TYPE>

unsigned int EST_TBuffer< TYPE >::length | ( | void |  | ) | const

inline

Current available space.

Definition at line 119 of file EST_TBuffer.h.

## set()

template<class TYPE>

void EST_TBuffer< T >::set | ( | const TYPE & | set_to,
|  | int | howmany = -1 )

Set to the given value. By default sets all values.

Definition at line 149 of file EST_TBuffer.cc.

## ensure() [1/3]

template<class TYPE>

void EST_TBuffer< TYPE >::ensure | ( | unsigned int | req_size | ) |

inline

Extend if needed, copying existing data.

Definition at line 128 of file EST_TBuffer.h.

## ensure() [2/3]

template<class TYPE>

void EST_TBuffer< TYPE >::ensure | ( | unsigned int | req_size,
|  | bool | copy )

inline

Make sure there is enough space, copying if requested.

Definition at line 132 of file EST_TBuffer.h.

## ensure() [3/3]

template<class TYPE>

void EST_TBuffer< TYPE >::ensure | ( | unsigned int | req_size,
|  | const TYPE & | set_to,
|  | int | howmany = -1 )

inline

Make sure there is enough space, setting to a known value.

Definition at line 136 of file EST_TBuffer.h.

## b() [1/2]

template<class TYPE>

TYPE * EST_TBuffer< TYPE >::b | ( | void |  | ) |

inline

Simple access as a pointer.

Definition at line 144 of file EST_TBuffer.h.

## b() [2/2]

template<class TYPE>

const TYPE * EST_TBuffer< TYPE >::b | ( | void |  | ) | const

inline

Read-only access when the EST_TBuffer is a constant.

Definition at line 146 of file EST_TBuffer.h.

## operator()()

template<class TYPE>

const TYPE & EST_TBuffer< TYPE >::operator() | ( | unsigned int | i | ) | const

inline

operator () is simple access

Definition at line 149 of file EST_TBuffer.h.

## operator[]() [1/2]

template<class TYPE>

TYPE & EST_TBuffer< TYPE >::operator[] | ( | unsigned int | i | ) |

inline

Definition at line 151 of file EST_TBuffer.h.

## operator[]() [2/2]

template<class TYPE>

const TYPE & EST_TBuffer< TYPE >::operator[] | ( | unsigned int | i | ) | const

inline

Definition at line 152 of file EST_TBuffer.h.

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

- include/EST_TBuffer.h
- base_class/EST_TBuffer.cc