1 #ifndef CORE_Array2D_HPP 2 #define CORE_Array2D_HPP 53 }
catch(std::exception& e) {
56 "not enought memory for allocation");
58 if (newValues==
null) {
61 "not enought memory for allocation");
75 if (s>m) memset(p,0,(s-m)*
sizeof(*p));
200 if (nOld==n) return ;
216 tUIndex nElementsToTranslate=oldSize-(*rIndex)-nOld;
218 const T *ovs=&values[(*rIndex)+nOld];
222 for (
tUIndex i=0;i<nElementsToTranslate;i++) {
240 const T *ovs=&values[oldSize-1];
243 const T *lastRowElement=&values[(*rIndex)+nOld];
246 T* vs=&values[newSize-1];
249 while (ovs!=lastRowElement) {
272 typename vector<Q>::const_iterator iter=vs.
begin();
273 while (iter!=vs.
end()) {
286 typename vector<Q>::const_iterator iter=vs.begin();
287 while (iter!=vs.end()) {
301 const Q* iter=&vs[0];
355 for (i=0;i<nRows;i++) {
359 for (j=0;j<nCols;j++) {
const tUIndex & getRowsNumber() const
get the rows number
Definition: CORE_Array2D.h:306
void allocateRows(const tUIndex &n)
allocate the rows array indices
Definition: CORE_Array2D.hpp:40
const tUIndex & getSize() const
return the size of the array for reading
Definition: CORE_Array.h:1018
void reserve(const tUIndex &cap)
reserve the capacity
Definition: CORE_Array.h:147
void copy(const CORE_Array2D< T > &v)
copy the array 2D
Definition: CORE_Array2D.hpp:135
this class describes an array
Definition: CORE_Vector.h:19
virtual void fitToSize()
fit to size
Definition: CORE_Array2D.hpp:125
virtual ~CORE_Array2D()
destroy an array of T*
Definition: CORE_Array2D.hpp:22
tUIndex getRowSize(const tUIndex &i) const
return the size of the row at index i
Definition: CORE_Array2D.h:261
CORE_Array2D()
build an array of T*
Definition: CORE_Array2D.hpp:9
tUIndex mRowCapacity
Definition: CORE_Array2D.h:36
void setSize(const tUIndex &n)
set the size
Definition: CORE_Array.h:292
virtual tString toString() const
return the string associated to the string
Definition: CORE_String.h:223
tString toString() const
return the string associated to the integer
Definition: CORE_Integer.h:106
#define null
Definition: types.h:144
tBoolean setValuesByReference(const tUIndex &n, Q *array)
set the the values by reference
Definition: CORE_Array.h:405
void reserve(const tUIndex &nRows, const tUIndex &nCols)
reserve of the 2D array of size nRows x nCols
Definition: CORE_Array2D.hpp:100
#define tIndex
Definition: types.h:129
void desallocateRows()
desallocate the rows
Definition: CORE_Array2D.hpp:28
this class describes the exceptions raised for CORE package
Definition: CORE_Exception.h:15
const T * getValues() const
get the values
Definition: CORE_Array2D.h:288
tUIndex getSize() const
return the size of the vector
Definition: CORE_Vector.h:391
void setRowsNumber(const tUIndex &nRows)
set the rows number
Definition: CORE_Array2D.hpp:111
this class describes an array
Definition: CORE_Array.h:19
virtual void fitToSize()
fit the array alocation exactly to size fit the allocation of the array to its size ...
Definition: CORE_Array.hpp:128
this class describes an array of arrays ordered by rows The array like this 0 1 2 3 4 ...
Definition: CORE_Array2D.h:24
void setValues(const tUIndex &n, const Q *v)
set the values of the array by copying the n first values of pointer v
Definition: CORE_Array.h:445
#define tUIndex
Definition: types.h:126
void addRow(const tUIndex &rowSize)
add a row of size row size at end
Definition: CORE_Array2D.hpp:328
const tUIndex * getRowIndices() const
get the row indices
Definition: CORE_Array2D.h:300
#define tString
Definition: types.h:135
tUIndex mRowsNumber
Definition: CORE_Array2D.h:30
void setValues(const tUIndex &nvs, const T *vs, const tUIndex &nrs, const tUIndex *rs)
set the values
Definition: CORE_Array2D.hpp:161
void setRowSize(const tUIndex &i, const tUIndex &n)
the the size of the row at index i
Definition: CORE_Array2D.hpp:196
void setRowValue(const tUIndex &i, const tUIndex &p, const Q *vs)
set row value to vs array
Definition: CORE_Array2D.hpp:311
Definition: CORE_ArrayList.h:12
vector< T >::const_iterator begin() const
get iterator
Definition: CORE_Vector.h:331
void setValuesByReference(const tUIndex &nvs, T *vs, const tUIndex &nrs, tUIndex *rs)
set the values by reference
Definition: CORE_Array2D.hpp:179
tBoolean mIsPrivateRowAllocated
Definition: CORE_Array2D.h:35
void setSize(const tUIndex &nRows, const tUIndex &nCols)
set the size of the 2D array n rows of n columns
Definition: CORE_Array2D.hpp:90
vector< T >::const_iterator end() const
get iterator
Definition: CORE_Vector.h:341
tString toString() const
turn the array 2D into string
Definition: CORE_Array2D.hpp:339
const tUIndex & getValuesNumber() const
return the number of values
Definition: CORE_Array2D.h:253
tUIndex * mRowIndices
Definition: CORE_Array2D.h:37