100       return data[thesize -1];
   106       return data[thesize -1];
   153          memmove(&(data[i+n]), &(data[i]), (
unsigned int) (j - i) * 
sizeof(T));
   162          for( 
int j = 0; j < n; j++ )
   173          memcpy(&(data[i]), t, (
unsigned int) n * 
sizeof(T));
   183          memcpy(&(data[i]), t.
data, (
unsigned int)t.
size() * 
sizeof(T));
   188    void remove(
int n = 0, 
int m = 1)
   190       assert(n < 
size() && n >= 0);
   193          memmove(&(data[n]), &(data[n + m]), (
unsigned int)(
size() - (n + m)) * 
sizeof(T));
   201       assert(m <= 
size() && m >= 0);
   225       assert(memFactor >= 1);
   226       if (newsize > themax)
   227          reMax(
int(memFactor * newsize), newsize);
   228       else if (newsize < 0)
   254    void reMax(
int newMax = 1, 
int newSize = -1)
   258       if (newMax < newSize)
   262       if (newMax == themax)
   280          memcpy(data, rhs.
data, (
unsigned int) 
size() * 
sizeof(T));
   290 #ifdef ENABLE_CONSISTENCY_CHECKS   293          || (themax < thesize)
   295          || (memFactor < 1.0))
   304       : thesize(old.thesize)
   305       , themax (old.themax)
   307       , memFactor (old.memFactor)
   311       assert(thesize >= 0);
   314          memcpy(data, old.
data, (
unsigned int)thesize * 
sizeof(T));
   332       thesize = (p_size < 0) ? 0 : p_size;
   336          themax = (thesize == 0) ? 1 : thesize;
   352 #endif // _DATAARRAY_H_ T & last()
reference last element. 
 
Safe arrays of data objects.Class DataArray provides safe arrays of Data Objects. For general C++ obj...
 
bool isConsistent() const
consistency check 
 
Memory allocation routines. 
 
DataArray & operator=(const DataArray &rhs)
assignment operator 
 
T * get_ptr()
get a C pointer to the data. 
 
void clear()
remove all elements. 
 
void insert(int i, int n, const T t[])
insert n elements from t before i 'the element. 
 
T * data
the array of elements 
 
void removeLast(int m=1)
remove m last elements. 
 
void spx_alloc(T &p, int n=1)
Allocate memory. 
 
int thesize
number of used elements in array data 
 
void insert(int i, const DataArray< T > &t)
insert all elements from t before i 'th element. 
 
void append(int n, const T t[])
append n elements from t. 
 
void append(const T &t)
append element t. 
 
int max() const
return maximum number of elements. 
 
const T * get_const_ptr() const
get a const C pointer to the data. 
 
void append(const DataArray< T > &t)
append all elements from t. 
 
int themax
the length of array data and 
 
DataArray(const DataArray &old)
copy constructor 
 
void append(int n, const T &t)
append n elements with value t. 
 
Debugging, floating point type and parameter definitions. 
 
void spx_realloc(T &p, int n)
Change amount of allocated memory. 
 
Everything should be within this namespace. 
 
int size() const
return nr. of elements. 
 
DataArray(int p_size=0, int p_max=0, Real p_fac=1.2)
default constructor. 
 
Real memFactor
memory extension factor. 
 
void insert(int i, int n, const T &t)
insert n elements with value t before i 'the element. 
 
#define MSGinconsistent(name)
 
void reMax(int newMax=1, int newSize=-1)
reset maximum number of elements. 
 
void insert(int i, int n)
insert n uninitialized elements before i 'th element. 
 
const T & operator[](int n) const
reference n 'th const element. 
 
T & operator[](int n)
reference n 'th element. 
 
void reSize(int newsize)
reset size to newsize. 
 
void spx_free(T &p)
Release memory. 
 
const T & last() const
reference last const element.