Definition at line 30 of file DynamicArray.h.
Public Member Functions | |
CDynamicArray (INT p_resize_granularity=128) | |
~CDynamicArray () | |
INT | set_granularity (INT g) |
INT | get_array_size () |
INT | get_num_elements () const |
T | get_element (INT index) const |
bool | set_element (T element, INT index) |
bool | insert_element (T element, INT index) |
bool | append_element (T element) |
bool | delete_element (INT idx) |
bool | resize_array (INT n) |
T * | get_array () |
void | set_array (T *p_array, INT p_num_elements, INT array_size) |
void | clear_array () |
T | operator[] (INT index) const |
CDynamicArray< T > & | operator= (CDynamicArray< T > &orig) |
Static Public Attributes | |
static CParallel | parallel |
static CIO | io |
static CVersion | version |
Protected Attributes | |
INT | resize_granularity |
T * | array |
INT | num_elements |
INT | last_element_idx |
CDynamicArray< T >::CDynamicArray | ( | INT | p_resize_granularity = 128 |
) |
constructor
p_resize_granularity | resize granularity |
Definition at line 37 of file DynamicArray.h.
CDynamicArray< T >::~CDynamicArray | ( | ) |
Definition at line 49 of file DynamicArray.h.
INT CDynamicArray< T >::set_granularity | ( | INT | g | ) |
set the resize granularity
g | new granularity |
Definition at line 56 of file DynamicArray.h.
INT CDynamicArray< T >::get_array_size | ( | ) |
get array size (including granularity buffer)
Definition at line 67 of file DynamicArray.h.
INT CDynamicArray< T >::get_num_elements | ( | ) | const |
T CDynamicArray< T >::get_element | ( | INT | index | ) | const |
get array element at index
index | index |
Definition at line 87 of file DynamicArray.h.
bool CDynamicArray< T >::set_element | ( | T | element, | |
INT | index | |||
) |
set array element at index
element | element to set | |
index | index |
Definition at line 98 of file DynamicArray.h.
bool CDynamicArray< T >::insert_element | ( | T | element, | |
INT | index | |||
) |
insert array element at index
element | element to insert | |
index | index |
Definition at line 130 of file DynamicArray.h.
bool CDynamicArray< T >::append_element | ( | T | element | ) |
append array element to the end of array
element | element to append |
Definition at line 151 of file DynamicArray.h.
bool CDynamicArray< T >::delete_element | ( | INT | idx | ) |
delete array element at idx (does not call delete[] or the like)
idx | index |
Definition at line 162 of file DynamicArray.h.
bool CDynamicArray< T >::resize_array | ( | INT | n | ) |
resize the array
n | new size |
Definition at line 186 of file DynamicArray.h.
T* CDynamicArray< T >::get_array | ( | ) |
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 !
Definition at line 217 of file DynamicArray.h.
void CDynamicArray< T >::set_array | ( | T * | p_array, | |
INT | p_num_elements, | |||
INT | array_size | |||
) |
set the array pointer and free previously allocated memory
p_array | new array | |
p_num_elements | last element index + 1 | |
array_size | number of elements in array |
Definition at line 228 of file DynamicArray.h.
void CDynamicArray< T >::clear_array | ( | ) |
clear the array (with zeros)
Definition at line 237 of file DynamicArray.h.
T CDynamicArray< T >::operator[] | ( | INT | 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
index | index |
Definition at line 252 of file DynamicArray.h.
CDynamicArray<T>& CDynamicArray< T >::operator= | ( | CDynamicArray< T > & | orig | ) |
operator overload for array assignment
orig | original array |
Definition at line 262 of file DynamicArray.h.
INT CDynamicArray< T >::resize_granularity [protected] |
shrink/grow step size
Definition at line 274 of file DynamicArray.h.
T* CDynamicArray< T >::array [protected] |
memory for dynamic array
Definition at line 277 of file DynamicArray.h.
INT CDynamicArray< T >::num_elements [protected] |
the number of potentially used elements in array
Definition at line 280 of file DynamicArray.h.
INT CDynamicArray< T >::last_element_idx [protected] |
the element in the array that has largest index
Definition at line 283 of file DynamicArray.h.
CParallel CSGObject::parallel [static, inherited] |
Definition at line 105 of file SGObject.h.
CIO CSGObject::io [static, inherited] |
Definition at line 106 of file SGObject.h.
CVersion CSGObject::version [static, inherited] |
Definition at line 107 of file SGObject.h.