CArray< T > Class Template Reference
List of all members.
|
Public Member Functions |
| CArray (int32_t initial_size=1) |
| CArray (T *p_array, int32_t p_array_size, bool p_free_array=true, bool p_copy_array=false) |
| CArray (const T *p_array, int32_t p_array_size) |
| ~CArray () |
const char * | get_name () const |
void | set_name (const char *p_name) |
int32_t | get_array_size () const |
int32_t | get_dim1 () |
void | zero () |
const T & | get_element (int32_t index) const |
bool | set_element (const T &p_element, int32_t index) |
const T & | element (int32_t idx1) const |
T & | element (int32_t index) |
T & | element (T *p_array, int32_t index) |
bool | resize_array (int32_t n) |
T * | get_array () |
void | set_array (T *p_array, int32_t p_array_size, bool p_free_array=true, bool copy_array=false) |
void | set_array (const T *p_array, int32_t p_array_size) |
void | clear_array () |
const T & | operator[] (int32_t index) const |
T & | operator[] (int32_t index) |
CArray< T > & | operator= (const CArray< T > &orig) |
void | display_size () const |
void | display_array () const |
Protected Attributes |
T * | array |
int32_t | array_size |
bool | free_array |
const char * | name |
| DECLARE_ARRAY_STATISTICS |
Detailed Description
template<class T>
class CArray< T >
Template class Array implements a dense one dimensional array.
Note that depending on compile options everything will be inlined, such that this is as high performance array implementation without error checking.
Definition at line 79 of file Array.h.
Constructor & Destructor Documentation
constructor
- Parameters:
-
| initial_size | initial size of array |
Definition at line 86 of file Array.h.
template<class T>
CArray< T >::CArray |
( |
T * |
p_array, |
|
|
int32_t |
p_array_size, |
|
|
bool |
p_free_array = true , |
|
|
bool |
p_copy_array = false | |
|
) |
| | |
constructor
- Parameters:
-
| p_array | another array |
| p_array_size | size of another array |
| p_free_array | if array must be freed |
| p_copy_array | if array must be copied |
Definition at line 102 of file Array.h.
template<class T>
CArray< T >::CArray |
( |
const T * |
p_array, |
|
|
int32_t |
p_array_size | |
|
) |
| | |
constructor
- Parameters:
-
| p_array | another array |
| p_array_size | size of another array |
Definition at line 115 of file Array.h.
Member Function Documentation
template<class T>
void CArray< T >::clear_array |
( |
|
) |
|
clear the array (with zeros)
Definition at line 311 of file Array.h.
template<class T>
void CArray< T >::display_array |
( |
|
) |
const |
template<class T>
void CArray< T >::display_size |
( |
|
) |
const |
template<class T>
T& CArray< T >::element |
( |
T * |
p_array, |
|
|
int32_t |
index | |
|
) |
| | |
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 231 of file Array.h.
template<class T>
T& CArray< T >::element |
( |
int32_t |
index |
) |
|
get element at given index
- Parameters:
-
- Returns:
- element at given index
Definition at line 216 of file Array.h.
template<class T>
const T& CArray< T >::element |
( |
int32_t |
idx1 |
) |
const |
get element at given index
- Parameters:
-
- Returns:
- element at given index
Definition at line 205 of file Array.h.
template<class T>
int32_t CArray< T >::get_array_size |
( |
|
) |
const |
get array size (including granularity buffer)
- Returns:
- total array size
Definition at line 153 of file Array.h.
template<class T>
int32_t CArray< T >::get_dim1 |
( |
|
) |
|
template<class T>
const T& CArray< T >::get_element |
( |
int32_t |
index |
) |
const |
get array element at index
- Parameters:
-
- Returns:
- array element at index
Definition at line 179 of file Array.h.
template<class T>
const char* CArray< T >::get_name |
( |
|
) |
const |
get name
- Returns:
- name
Definition at line 135 of file Array.h.
operator overload for array assignment
- Parameters:
-
- Returns:
- new array
Definition at line 349 of file Array.h.
template<class T>
T& CArray< T >::operator[] |
( |
int32_t |
index |
) |
|
operator overload for array read only access
DOES NOT DO ANY BOUNDS CHECKING
- Parameters:
-
- Returns:
- element at index
Definition at line 338 of file Array.h.
template<class T>
const T& CArray< T >::operator[] |
( |
int32_t |
index |
) |
const |
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 325 of file Array.h.
template<class T>
bool CArray< T >::resize_array |
( |
int32_t |
n |
) |
|
resize array
- Parameters:
-
- Returns:
- if resizing was successful
Definition at line 244 of file Array.h.
template<class T>
void CArray< T >::set_array |
( |
const T * |
p_array, |
|
|
int32_t |
p_array_size | |
|
) |
| | |
set the array pointer and free previously allocated memory
- Parameters:
-
| p_array | another array |
| p_array_size | size of another array |
Definition at line 300 of file Array.h.
template<class T>
void CArray< T >::set_array |
( |
T * |
p_array, |
|
|
int32_t |
p_array_size, |
|
|
bool |
p_free_array = true , |
|
|
bool |
copy_array = false | |
|
) |
| | |
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 278 of file Array.h.
template<class T>
bool CArray< T >::set_element |
( |
const T & |
p_element, |
|
|
int32_t |
index | |
|
) |
| | |
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 192 of file Array.h.
template<class T>
void CArray< T >::set_name |
( |
const char * |
p_name |
) |
|
Member Data Documentation
memory for dynamic array
Definition at line 375 of file Array.h.
the number of potentially used elements in array
Definition at line 377 of file Array.h.
array statistics
Definition at line 383 of file Array.h.
if array must be freed
Definition at line 379 of file Array.h.
array's name
Definition at line 381 of file Array.h.
The documentation for this class was generated from the following file: