SHOGUN
v3.2.0
|
Dynamic array class for CRefObject pointers that creates an array that can be used like a list or an array.
It grows and shrinks dynamically, while elements can be accessed via index. It only stores CRefObject pointers, which ARE automagically SG_REF'd/deleted.
This array is optimized to have very little (storage) overhead
在文件 SGDynamicRefObjectArray.h 第 31 行定义.
Public 成员函数 | |
SGDynamicRefObjectArray () | |
SGDynamicRefObjectArray (int32_t dim1, int32_t dim2=1, int32_t dim3=1) | |
SGDynamicRefObjectArray (CRefObject **p_array, int32_t p_dim1_size, bool p_free_array=true, bool p_copy_array=false) | |
SGDynamicRefObjectArray (CRefObject **p_array, int32_t p_dim1_size, int32_t p_dim2_size, bool p_free_array=true, bool p_copy_array=false) | |
SGDynamicRefObjectArray (CRefObject **p_array, int32_t p_dim1_size, int32_t p_dim2_size, int32_t p_dim3_size, bool p_free_array=true, bool p_copy_array=false) | |
virtual | ~SGDynamicRefObjectArray () |
int32_t | set_granularity (int32_t g) |
int32_t | get_array_size () |
void | get_array_size (int32_t &dim1, int32_t &dim2) |
void | get_array_size (int32_t &dim1, int32_t &dim2, int32_t &dim3) |
int32_t | get_dim1 () |
int32_t | get_dim2 () |
int32_t | get_dim3 () |
int32_t | get_num_elements () const |
CRefObject * | get_element (int32_t index) const |
CRefObject * | element (int32_t idx1, int32_t idx2=0, int32_t idx3=0) |
CRefObject * | get_last_element () const |
CRefObject * | get_element_safe (int32_t index) const |
bool | set_element (CRefObject *e, int32_t idx1, int32_t idx2=0, int32_t idx3=0) |
bool | insert_element (CRefObject *e, int32_t index) |
bool | append_element (CRefObject *e) |
void | push_back (CRefObject *e) |
void | pop_back () |
CRefObject * | back () const |
int32_t | find_element (CRefObject *elem) const |
bool | delete_element (int32_t idx) |
void | clear_array () |
void | reset_array () |
SGDynamicRefObjectArray & | operator= (SGDynamicRefObjectArray &orig) |
CRefObject ** | get_array () const |
void | shuffle () |
void | shuffle (CRandom *rand) |
void | set_array_name (const char *p_name) |
const char * | get_array_name () const |
virtual const char * | get_name () const |
default constructor
在文件 SGDynamicRefObjectArray.h 第 35 行定义.
SGDynamicRefObjectArray | ( | int32_t | dim1, |
int32_t | dim2 = 1 , |
||
int32_t | dim3 = 1 |
||
) |
constructor
dim1 | dimension 1 |
dim2 | dimension 2 |
dim3 | dimension 3 |
在文件 SGDynamicRefObjectArray.h 第 49 行定义.
SGDynamicRefObjectArray | ( | CRefObject ** | p_array, |
int32_t | p_dim1_size, | ||
bool | p_free_array = true , |
||
bool | p_copy_array = false |
||
) |
constructor
p_array | another array |
p_dim1_size | dimension 1 |
p_free_array | if array must be freed |
p_copy_array | if array must be copied |
在文件 SGDynamicRefObjectArray.h 第 64 行定义.
SGDynamicRefObjectArray | ( | CRefObject ** | p_array, |
int32_t | p_dim1_size, | ||
int32_t | p_dim2_size, | ||
bool | p_free_array = true , |
||
bool | p_copy_array = false |
||
) |
constructor
p_array | another array |
p_dim1_size | dimension 1 |
p_dim2_size | dimension 2 |
p_free_array | if array must be freed |
p_copy_array | if array must be copied |
在文件 SGDynamicRefObjectArray.h 第 80 行定义.
SGDynamicRefObjectArray | ( | CRefObject ** | p_array, |
int32_t | p_dim1_size, | ||
int32_t | p_dim2_size, | ||
int32_t | p_dim3_size, | ||
bool | p_free_array = true , |
||
bool | p_copy_array = false |
||
) |
constructor
p_array | another array |
p_dim1_size | dimension 1 |
p_dim2_size | dimension 2 |
p_dim3_size | dimension 3 |
p_free_array | if array must be freed |
p_copy_array | if array must be copied |
在文件 SGDynamicRefObjectArray.h 第 98 行定义.
|
virtual |
在文件 SGDynamicRefObjectArray.h 第 107 行定义.
bool append_element | ( | CRefObject * | e | ) |
append array element to the end of array
e | element to append |
在文件 SGDynamicRefObjectArray.h 第 275 行定义.
CRefObject* back | ( | ) | const |
STD VECTOR compatible. Return array element at the end of array.
在文件 SGDynamicRefObjectArray.h 第 311 行定义.
void clear_array | ( | ) |
clear the array (with zeros)
在文件 SGDynamicRefObjectArray.h 第 345 行定义.
bool delete_element | ( | int32_t | idx | ) |
delete array element at idx (does not call SG_FREE() or the like)
idx | index |
在文件 SGDynamicRefObjectArray.h 第 335 行定义.
CRefObject* element | ( | int32_t | idx1, |
int32_t | idx2 = 0 , |
||
int32_t | idx3 = 0 |
||
) |
get array element at index
idx1 | index 1 |
idx2 | index 2 |
idx3 | index 3 |
在文件 SGDynamicRefObjectArray.h 第 198 行定义.
int32_t find_element | ( | CRefObject * | elem | ) | const |
find first occurence of array element and return its index or -1 if not available
elem | element to search for |
在文件 SGDynamicRefObjectArray.h 第 324 行定义.
CRefObject** get_array | ( | ) | const |
在文件 SGDynamicRefObjectArray.h 第 378 行定义.
const char* get_array_name | ( | ) | const |
int32_t get_array_size | ( | ) |
get array size (including granularity buffer)
在文件 SGDynamicRefObjectArray.h 第 121 行定义.
void get_array_size | ( | int32_t & | dim1, |
int32_t & | dim2 | ||
) |
return 2d array size
dim1 | dimension 1 will be stored here |
dim2 | dimension 2 will be stored here |
在文件 SGDynamicRefObjectArray.h 第 131 行定义.
void get_array_size | ( | int32_t & | dim1, |
int32_t & | dim2, | ||
int32_t & | dim3 | ||
) |
return 3d array size
dim1 | dimension 1 will be stored here |
dim2 | dimension 2 will be stored here |
dim3 | dimension 3 will be stored here |
在文件 SGDynamicRefObjectArray.h 第 143 行定义.
int32_t get_dim1 | ( | ) |
int32_t get_dim2 | ( | ) |
int32_t get_dim3 | ( | ) |
CRefObject* get_element | ( | int32_t | index | ) | const |
get array element at index
(does NOT do bounds checking)
index | index |
在文件 SGDynamicRefObjectArray.h 第 184 行定义.
CRefObject* get_element_safe | ( | int32_t | index | ) | const |
get array element at index
(does bounds checking)
index | index |
在文件 SGDynamicRefObjectArray.h 第 221 行定义.
CRefObject* get_last_element | ( | ) | const |
|
virtual |
int32_t get_num_elements | ( | ) | const |
bool insert_element | ( | CRefObject * | e, |
int32_t | index | ||
) |
insert array element at index
e | element to insert |
index | index |
在文件 SGDynamicRefObjectArray.h 第 261 行定义.
SGDynamicRefObjectArray& operator= | ( | SGDynamicRefObjectArray & | orig | ) |
operator overload for array assignment
orig | original array |
在文件 SGDynamicRefObjectArray.h 第 363 行定义.
void pop_back | ( | ) |
STD VECTOR compatible. Delete array element at the end of array.
在文件 SGDynamicRefObjectArray.h 第 298 行定义.
void push_back | ( | CRefObject * | e | ) |
STD VECTOR compatible. Append array element to the end of array.
e | element to append |
在文件 SGDynamicRefObjectArray.h 第 289 行定义.
void reset_array | ( | ) |
resets the array
在文件 SGDynamicRefObjectArray.h 第 352 行定义.
void set_array_name | ( | const char * | p_name | ) |
bool set_element | ( | CRefObject * | e, |
int32_t | idx1, | ||
int32_t | idx2 = 0 , |
||
int32_t | idx3 = 0 |
||
) |
set array element at index
e | element to set |
idx1 | index 1 |
idx2 | index 2 |
idx3 | index 2 |
在文件 SGDynamicRefObjectArray.h 第 236 行定义.
int32_t set_granularity | ( | int32_t | g | ) |
set the resize granularity
g | new granularity |
在文件 SGDynamicRefObjectArray.h 第 114 行定义.
void shuffle | ( | ) |
shuffles the array (not thread safe!)
在文件 SGDynamicRefObjectArray.h 第 381 行定义.
void shuffle | ( | CRandom * | rand | ) |
shuffles the array with external random state
在文件 SGDynamicRefObjectArray.h 第 384 行定义.