CArray2< T > Class Template Reference
List of all members.
Detailed Description
template<class T>
class CArray2< T >
template class Array2 (two dimensional)
Definition at line 21 of file Array2.h.
|
Public Member Functions |
| CArray2 (INT dim1, INT dim2) |
| CArray2 (T *p_array, INT dim1, INT dim2, bool p_free_array=true, bool p_copy_array=false) |
| CArray2 (const T *p_array, INT dim1, INT dim2) |
| ~CArray2 () |
void | get_array_size (INT &dim1, INT &dim2) |
INT | get_dim1 () |
INT | get_dim2 () |
void | zero () |
T * | get_array () |
void | set_name (const char *p_name) |
void | set_array (T *p_array, INT dim1, INT dim2, bool p_free_array=true, bool copy_array=false) |
bool | resize_array (INT dim1, INT dim2) |
const T & | get_element (INT idx1, INT idx2) const |
bool | set_element (const T &p_element, INT idx1, INT idx2) |
const T & | element (INT idx1, INT idx2) const |
T & | element (INT idx1, INT idx2) |
T & | element (T *p_array, INT idx1, INT idx2) |
T & | element (T *p_array, INT idx1, INT idx2, INT p_dim1_size) |
CArray2< T > & | operator= (CArray2< T > &orig) |
void | display_array () const |
void | display_size () const |
const char * | get_name () const |
INT | get_array_size () const |
const T & | get_element (INT index) const |
bool | set_element (const T &p_element, INT index) |
const T & | element (INT idx1) const |
T & | element (INT index) |
T & | element (T *p_array, INT index) |
bool | resize_array (INT n) |
void | set_array (T *p_array, INT p_array_size, bool p_free_array=true, bool copy_array=false) |
void | set_array (const T *p_array, INT p_array_size) |
void | clear_array () |
const T & | operator[] (INT index) const |
T & | operator[] (INT index) |
Static Public Attributes |
static CParallel | parallel |
static CIO | io |
static CVersion | version |
Protected Attributes |
INT | dim1_size |
INT | dim2_size |
T * | array |
INT | array_size |
bool | free_array |
const char * | name |
| DECLARE_ARRAY_STATISTICS |
Constructor & Destructor Documentation
constructor
- Parameters:
-
| dim1 | dimension 1 |
| dim2 | dimension 2 |
Definition at line 29 of file Array2.h.
template<class T>
CArray2< T >::CArray2 |
( |
T * |
p_array, |
|
|
INT |
dim1, |
|
|
INT |
dim2, |
|
|
bool |
p_free_array = true , |
|
|
bool |
p_copy_array = false | |
|
) |
| | |
constructor
- Parameters:
-
| p_array | another array |
| dim1 | dimension 1 |
| dim2 | dimension 2 |
| p_free_array | if array must be freed |
| p_copy_array | if array must be copied |
Definition at line 42 of file Array2.h.
constructor
- Parameters:
-
| p_array | another array |
| dim1 | dimension 1 |
| dim2 | dimension 2 |
Definition at line 54 of file Array2.h.
Member Function Documentation
return total array size (including granularity buffer)
- Parameters:
-
| dim1 | dimension 1 will be stored here |
| dim2 | dimension 2 will be stored here |
Definition at line 66 of file Array2.h.
get dimension 1
- Returns:
- dimension 1
Reimplemented from CArray< T >.
Definition at line 76 of file Array2.h.
get dimension 2
- Returns:
- dimension 2
Definition at line 82 of file Array2.h.
get the array call get_array just before messing with it DO NOT call any [],resize/delete functions after get_array(), the pointer may become invalid !
- Returns:
- the array
Reimplemented from CArray< T >.
Definition at line 94 of file Array2.h.
template<class T>
void CArray2< T >::set_name |
( |
const char * |
p_name |
) |
|
template<class T>
void CArray2< T >::set_array |
( |
T * |
p_array, |
|
|
INT |
dim1, |
|
|
INT |
dim2, |
|
|
bool |
p_free_array = true , |
|
|
bool |
copy_array = false | |
|
) |
| | |
set the array pointer and free previously allocated memory
- Parameters:
-
| p_array | another array |
| dim1 | dimension 1 |
| dim2 | dimensino 2 |
| p_free_array | if array must be freed |
| copy_array | if array must be copied |
Definition at line 113 of file Array2.h.
resize array
- Parameters:
-
| dim1 | new dimension 1 |
| dim2 | new dimension 2 |
- Returns:
- if resizing was successful
Definition at line 126 of file Array2.h.
get array element at index
- Parameters:
-
| idx1 | index 1 |
| idx2 | index 2 |
- Returns:
- array element at index
Definition at line 139 of file Array2.h.
template<class T>
bool CArray2< T >::set_element |
( |
const T & |
p_element, |
|
|
INT |
idx1, |
|
|
INT |
idx2 | |
|
) |
| | |
set array element at index 'index'
- Parameters:
-
| p_element | array element |
| idx1 | index 1 |
| idx2 | index 2 |
- Returns:
- if setting was successful
Definition at line 153 of file Array2.h.
get array element at index
- Parameters:
-
| idx1 | index 1 |
| idx2 | index 2 |
- Returns:
- array element at index
Definition at line 166 of file Array2.h.
get array element at index
- Parameters:
-
| idx1 | index 1 |
| idx2 | index 2 |
- Returns:
- array element at index
Definition at line 177 of file Array2.h.
get element of given array at given index
- Parameters:
-
| p_array | another array |
| idx1 | index 1 |
| idx2 | index 2 |
- Returns:
- element of given array at given index
Definition at line 191 of file Array2.h.
get element of given array at given index
- Parameters:
-
| p_array | another array |
| idx1 | index 1 |
| idx2 | index 2 |
| p_dim1_size | size of dimension 1 |
- Returns:
- element of given array at given index
Definition at line 207 of file Array2.h.
operator overload for array assignment
- Parameters:
-
- Returns:
- new array
Definition at line 221 of file Array2.h.
template<class T>
void CArray2< T >::display_array |
( |
|
) |
const |
template<class T>
void CArray2< T >::display_size |
( |
|
) |
const |
template<class T>
const char* CArray< T >::get_name |
( |
|
) |
const [inherited] |
get name
- Returns:
- name
Definition at line 130 of file Array.h.
template<class T>
INT CArray< T >::get_array_size |
( |
|
) |
const [inherited] |
get array size (including granularity buffer)
- Returns:
- total array size
Definition at line 148 of file Array.h.
template<class T>
const T& CArray< T >::get_element |
( |
INT |
index |
) |
const [inherited] |
get array element at index
- Parameters:
-
- Returns:
- array element at index
Definition at line 174 of file Array.h.
template<class T>
bool CArray< T >::set_element |
( |
const T & |
p_element, |
|
|
INT |
index | |
|
) |
| | [inherited] |
set array element at index 'index' return false in case of trouble
- Parameters:
-
| p_element | array element to set |
| index | index |
- Returns:
- if setting was successful
Definition at line 187 of file Array.h.
template<class T>
const T& CArray< T >::element |
( |
INT |
idx1 |
) |
const [inherited] |
get element at given index
- Parameters:
-
- Returns:
- element at given index
Definition at line 200 of file Array.h.
template<class T>
T& CArray< T >::element |
( |
INT |
index |
) |
[inherited] |
get element at given index
- Parameters:
-
- Returns:
- element at given index
Definition at line 211 of file Array.h.
template<class T>
T& CArray< T >::element |
( |
T * |
p_array, |
|
|
INT |
index | |
|
) |
| | [inherited] |
get element of given array at given index
- Parameters:
-
| p_array | another array |
| index | index |
- Returns:
- element of given array at given index
Definition at line 226 of file Array.h.
template<class T>
bool CArray< T >::resize_array |
( |
INT |
n |
) |
[inherited] |
resize array
- Parameters:
-
- Returns:
- if resizing was successful
Definition at line 239 of file Array.h.
template<class T>
void CArray< T >::set_array |
( |
T * |
p_array, |
|
|
INT |
p_array_size, |
|
|
bool |
p_free_array = true , |
|
|
bool |
copy_array = false | |
|
) |
| | [inherited] |
set the array pointer and free previously allocated memory
- Parameters:
-
| p_array | another array |
| p_array_size | size of another array |
| p_free_array | if array must be freed |
| copy_array | if array must be copied |
Definition at line 273 of file Array.h.
template<class T>
void CArray< T >::set_array |
( |
const T * |
p_array, |
|
|
INT |
p_array_size | |
|
) |
| | [inherited] |
set the array pointer and free previously allocated memory
- Parameters:
-
| p_array | another array |
| p_array_size | size of another array |
Definition at line 295 of file Array.h.
template<class T>
void CArray< T >::clear_array |
( |
|
) |
[inherited] |
clear the array (with zeros)
Definition at line 306 of file Array.h.
template<class T>
const T& CArray< T >::operator[] |
( |
INT |
index |
) |
const [inherited] |
operator overload for array read only access use set_element() for write access (will also make the array dynamically grow)
DOES NOT DO ANY BOUNDS CHECKING
- Parameters:
-
- Returns:
- element at index
Definition at line 320 of file Array.h.
template<class T>
T& CArray< T >::operator[] |
( |
INT |
index |
) |
[inherited] |
operator overload for array read only access
DOES NOT DO ANY BOUNDS CHECKING
- Parameters:
-
- Returns:
- element at index
Definition at line 333 of file Array.h.
Member Data Documentation
size of array's dimension 1
Definition at line 253 of file Array2.h.
size of array's dimension 2
Definition at line 255 of file Array2.h.
memory for dynamic array
Definition at line 370 of file Array.h.
the number of potentially used elements in array
Definition at line 372 of file Array.h.
if array must be freed
Definition at line 374 of file Array.h.
template<class T>
const char* CArray< T >::name [protected, inherited] |
array's name
Definition at line 376 of file Array.h.
array statistics
Definition at line 378 of file Array.h.
The documentation for this class was generated from the following file: