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
63 extern struct old_tbuffer EST_old_buffers[TBUFFER_N_OLD];
98 void init(
unsigned int size,
int step);
100 void expand_to(
unsigned int req_size,
bool cpy);
102 void expand_to(
unsigned int req_size,
const TYPE &set_to,
int howmany);
113 EST_TBuffer(
unsigned int size=TBUFFER_DEFAULT_SIZE,
int step=TBUFFER_DEFAULT_STEP);
119 unsigned int length(
void)
const {
return p_size;}
122 void set(
const TYPE &set_to,
int howmany=-1);
129 {
if (req_size > p_size) expand_to(req_size, (
bool)TRUE);}
132 void ensure(
unsigned int req_size,
bool copy)
133 {
if (req_size > p_size) expand_to(req_size, copy,-1);}
136 void ensure(
unsigned int req_size,
const TYPE &set_to,
int howmany=-1)
137 {
if (req_size > p_size) expand_to(req_size, set_to, howmany);}
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];}