SHOGUN  3.2.1
 全部  命名空间 文件 函数 变量 类型定义 枚举 枚举值 友元 宏定义  
所有成员列表 | Public 成员函数
SGDynamicRefObjectArray类 参考

详细描述

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.h33 行定义.

类 SGDynamicRefObjectArray 继承关系图:
Inheritance graph
[图例]

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 ()
 
SGDynamicRefObjectArrayoperator= (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.h37 行定义.

SGDynamicRefObjectArray ( int32_t  dim1,
int32_t  dim2 = 1,
int32_t  dim3 = 1 
)

constructor

参数
dim1dimension 1
dim2dimension 2
dim3dimension 3

在文件 SGDynamicRefObjectArray.h51 行定义.

SGDynamicRefObjectArray ( CRefObject **  p_array,
int32_t  p_dim1_size,
bool  p_free_array = true,
bool  p_copy_array = false 
)

constructor

参数
p_arrayanother array
p_dim1_sizedimension 1
p_free_arrayif array must be freed
p_copy_arrayif array must be copied

在文件 SGDynamicRefObjectArray.h66 行定义.

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_arrayanother array
p_dim1_sizedimension 1
p_dim2_sizedimension 2
p_free_arrayif array must be freed
p_copy_arrayif array must be copied

在文件 SGDynamicRefObjectArray.h82 行定义.

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_arrayanother array
p_dim1_sizedimension 1
p_dim2_sizedimension 2
p_dim3_sizedimension 3
p_free_arrayif array must be freed
p_copy_arrayif array must be copied

在文件 SGDynamicRefObjectArray.h100 行定义.

virtual ~SGDynamicRefObjectArray ( )
virtual

在文件 SGDynamicRefObjectArray.h109 行定义.

成员函数说明

bool append_element ( CRefObject *  e)

append array element to the end of array

参数
eelement to append
返回
if setting was successful

在文件 SGDynamicRefObjectArray.h277 行定义.

CRefObject* back ( ) const

STD VECTOR compatible. Return array element at the end of array.

返回
element at the end of array

在文件 SGDynamicRefObjectArray.h313 行定义.

void clear_array ( )

clear the array (with zeros)

在文件 SGDynamicRefObjectArray.h347 行定义.

bool delete_element ( int32_t  idx)

delete array element at idx (does not call SG_FREE() or the like)

参数
idxindex
返回
if deleting was successful

在文件 SGDynamicRefObjectArray.h337 行定义.

CRefObject* element ( int32_t  idx1,
int32_t  idx2 = 0,
int32_t  idx3 = 0 
)

get array element at index

参数
idx1index 1
idx2index 2
idx3index 3
返回
array element at index

在文件 SGDynamicRefObjectArray.h200 行定义.

int32_t find_element ( CRefObject *  elem) const

find first occurence of array element and return its index or -1 if not available

参数
elemelement to search for
返回
index of element or -1

在文件 SGDynamicRefObjectArray.h326 行定义.

CRefObject** get_array ( ) const
返回
underlying array of pointers

在文件 SGDynamicRefObjectArray.h380 行定义.

const char* get_array_name ( ) const

get array's name

返回
array's name

在文件 SGDynamicRefObjectArray.h401 行定义.

int32_t get_array_size ( )

get array size (including granularity buffer)

返回
total array size (including granularity buffer)

在文件 SGDynamicRefObjectArray.h123 行定义.

void get_array_size ( int32_t &  dim1,
int32_t &  dim2 
)

return 2d array size

参数
dim1dimension 1 will be stored here
dim2dimension 2 will be stored here

在文件 SGDynamicRefObjectArray.h133 行定义.

void get_array_size ( int32_t &  dim1,
int32_t &  dim2,
int32_t &  dim3 
)

return 3d array size

参数
dim1dimension 1 will be stored here
dim2dimension 2 will be stored here
dim3dimension 3 will be stored here

在文件 SGDynamicRefObjectArray.h145 行定义.

int32_t get_dim1 ( )

get dimension 1

返回
dimension 1

在文件 SGDynamicRefObjectArray.h156 行定义.

int32_t get_dim2 ( )

get dimension 2

返回
dimension 2

在文件 SGDynamicRefObjectArray.h162 行定义.

int32_t get_dim3 ( )

get dimension 3

返回
dimension 3

在文件 SGDynamicRefObjectArray.h168 行定义.

CRefObject* get_element ( int32_t  index) const

get array element at index

(does NOT do bounds checking)

参数
indexindex
返回
array element at index

在文件 SGDynamicRefObjectArray.h186 行定义.

CRefObject* get_element_safe ( int32_t  index) const

get array element at index

(does bounds checking)

参数
indexindex
返回
array element at index

在文件 SGDynamicRefObjectArray.h223 行定义.

CRefObject* get_last_element ( ) const

get last array element

返回
last array element

在文件 SGDynamicRefObjectArray.h209 行定义.

virtual const char* get_name ( ) const
virtual
返回
object name

实现了 SGRefObject.

在文件 SGDynamicRefObjectArray.h404 行定义.

int32_t get_num_elements ( ) const

get number of elements

返回
number of elements

在文件 SGDynamicRefObjectArray.h174 行定义.

bool insert_element ( CRefObject *  e,
int32_t  index 
)

insert array element at index

参数
eelement to insert
indexindex
返回
if setting was successful

在文件 SGDynamicRefObjectArray.h263 行定义.

operator overload for array assignment

参数
origoriginal array
返回
new array

在文件 SGDynamicRefObjectArray.h365 行定义.

void pop_back ( )

STD VECTOR compatible. Delete array element at the end of array.

在文件 SGDynamicRefObjectArray.h300 行定义.

void push_back ( CRefObject *  e)

STD VECTOR compatible. Append array element to the end of array.

参数
eelement to append

在文件 SGDynamicRefObjectArray.h291 行定义.

void reset_array ( )

resets the array

在文件 SGDynamicRefObjectArray.h354 行定义.

void set_array_name ( const char *  p_name)

set array's name

参数
p_namenew name

在文件 SGDynamicRefObjectArray.h392 行定义.

bool set_element ( CRefObject *  e,
int32_t  idx1,
int32_t  idx2 = 0,
int32_t  idx3 = 0 
)

set array element at index

参数
eelement to set
idx1index 1
idx2index 2
idx3index 2
返回
if setting was successful

在文件 SGDynamicRefObjectArray.h238 行定义.

int32_t set_granularity ( int32_t  g)

set the resize granularity

参数
gnew granularity
返回
what has been set (minimum is 128)

在文件 SGDynamicRefObjectArray.h116 行定义.

void shuffle ( )

shuffles the array (not thread safe!)

在文件 SGDynamicRefObjectArray.h383 行定义.

void shuffle ( CRandom rand)

shuffles the array with external random state

在文件 SGDynamicRefObjectArray.h386 行定义.


该类的文档由以下文件生成:

SHOGUN 机器学习工具包 - 项目文档