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 T &set_to,
int howmany);
119 unsigned int length(
void)
const {
return p_size;}
122 void set(
const T &set_to,
int howmany=-1);
129 {
if (req_size > p_size) expand_to(req_size, (
bool)
TRUE);}
133 {
if (req_size > p_size) expand_to(req_size, copy,-1);}
136 void ensure(
unsigned int req_size,
const T &set_to,
int howmany=-1)
137 {
if (req_size > p_size) expand_to(req_size, set_to, howmany);}
144 T *
b(
void) {
return p_buffer;}
146 const T *
b(
void)
const {
return p_buffer;}
149 const T &operator() (
unsigned int i)
const {
return p_buffer[i];}
151 T &operator[] (
unsigned int i) {
return p_buffer[i];}
152 const T &operator[] (
unsigned int i)
const {
return p_buffer[i];}
unsigned int length(void) const
Current available space.
void ensure(unsigned int req_size)
Extend if needed, copying existing data.
#define TBUFFER_DEFAULT_STEP
Amount to increment buffer size by.
T * b(void)
Simple access as a pointer.
void ensure(unsigned int req_size, const T &set_to, int howmany=-1)
Make sure there is enough space, setting to a known value.
EST_TVector< T > & copy(EST_TVector< T > a, const EST_TList< T > &in)
const T * b(void) const
Read-only access when the EST_TBuffer is a constant.
#define TBUFFER_DEFAULT_SIZE
Initial size for buffers created with no size specified.
void ensure(unsigned int req_size, bool copy)
Make sure there is enough space, copying if requested.