43#ifndef __EST_TBUFFER_H__
44#define __EST_TBUFFER_H__
49#define TBUFFER_N_OLD (10)
52#define TBUFFER_DEFAULT_SIZE 0
55#define TBUFFER_DEFAULT_STEP 100
63extern struct old_tbuffer EST_old_buffers[TBUFFER_N_OLD];
98 void init(
unsigned int size,
int step);
113 EST_TBuffer(
unsigned int size=TBUFFER_DEFAULT_SIZE,
int step=TBUFFER_DEFAULT_STEP);
119 unsigned int length(
void)
const {
return p_size;}
144 TYPE *
b(
void) {
return p_buffer;}
146 const TYPE *
b(
void)
const {
return p_buffer;}
149 const TYPE &
operator() (
unsigned int i)
const {
return p_buffer[i];}
151 TYPE &
operator[] (
unsigned int i) {
return p_buffer[i];}
152 const TYPE &
operator[] (
unsigned int i)
const {
return p_buffer[i];}
void ensure(unsigned int req_size, bool copy)
Make sure there is enough space, copying if requested.
void ensure(unsigned int req_size)
Extend if needed, copying existing data.
void ensure(unsigned int req_size, const TYPE &set_to, int howmany=-1)
Make sure there is enough space, setting to a known value.
~EST_TBuffer(void)
Destructor. Places the memory in EST_old_buffers[] for re-use if there is room.
TYPE * b(void)
Simple access as a pointer.
const TYPE * b(void) const
Read-only access when the EST_TBuffer is a constant.
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.
const TYPE & operator()(unsigned int i) const
operator () is simple access