SHOGUN  v1.1.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
List of all members | Public Member Functions
CDynamicObjectArray< T > Class Template Reference

Detailed Description

template<class T>
class shogun::CDynamicObjectArray< T >

Template Dynamic array class 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 CSGObject pointers, which ARE automagically SG_REF'd/deleted.

Note that this array is generic, but only takes pointers to objects which implement the CSGObject interface, so only put these in here. T specifies the type of the pointers

Definition at line 32 of file DynamicObjectArray.h.

Inheritance diagram for CDynamicObjectArray< T >:
Inheritance graph
[legend]

Public Member Functions

 CDynamicObjectArray (int32_t p_resize_granularity=128)
virtual ~CDynamicObjectArray ()
int32_t set_granularity (int32_t g)
int32_t get_num_elements () const
T * get_element (int32_t index) const
T * get_element_safe (int32_t index) const
bool set_element (T *element, int32_t index)
bool insert_element (T *element, int32_t index)
bool append_element (T *element)
void push_back (T *element)
void pop_back ()
T * back () const
int32_t find_element (T *element) const
bool delete_element (int32_t idx)
void clear_array ()
CDynamicObjectArray< T > & operator= (CDynamicObjectArray< T > &orig)
T ** get_array () const
void shuffle ()
virtual const char * get_name () const
- Public Member Functions inherited from CSGObject
 CSGObject ()
 CSGObject (const CSGObject &orig)
virtual ~CSGObject ()
virtual bool is_generic (EPrimitiveType *generic) const
template<class T >
void set_generic ()
void unset_generic ()
virtual void print_serializable (const char *prefix="")
virtual bool save_serializable (CSerializableFile *file, const char *prefix="")
virtual bool load_serializable (CSerializableFile *file, const char *prefix="")
void set_global_io (SGIO *io)
SGIOget_global_io ()
void set_global_parallel (Parallel *parallel)
Parallelget_global_parallel ()
void set_global_version (Version *version)
Versionget_global_version ()
SGVector< char * > get_modelsel_names ()
char * get_modsel_param_descr (const char *param_name)
index_t get_modsel_param_index (const char *param_name)

Additional Inherited Members

- Public Attributes inherited from CSGObject
SGIOio
Parallelparallel
Versionversion
Parameterm_parameters
Parameterm_model_selection_parameters
- Protected Member Functions inherited from CSGObject
virtual void load_serializable_pre () throw (ShogunException)
virtual void load_serializable_post () throw (ShogunException)
virtual void save_serializable_pre () throw (ShogunException)
virtual void save_serializable_post () throw (ShogunException)

Constructor & Destructor Documentation

CDynamicObjectArray ( int32_t  p_resize_granularity = 128)

constructor

Parameters
p_resize_granularityresize granularity

Definition at line 39 of file DynamicObjectArray.h.

virtual ~CDynamicObjectArray ( )
virtual

Definition at line 52 of file DynamicObjectArray.h.

Member Function Documentation

bool append_element ( T *  element)

append array element to the end of array

Parameters
elementelement to append
Returns
if setting was successful

Definition at line 144 of file DynamicObjectArray.h.

T* back ( ) const

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

Returns
element at the end of array

Definition at line 182 of file DynamicObjectArray.h.

void clear_array ( )

clear the array (with zeros)

Definition at line 216 of file DynamicObjectArray.h.

bool delete_element ( int32_t  idx)

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

Parameters
idxindex
Returns
if deleting was successful

Definition at line 207 of file DynamicObjectArray.h.

int32_t find_element ( T *  element) const

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

Parameters
elementelement to search for
Returns
index of element or -1

Definition at line 196 of file DynamicObjectArray.h.

T** get_array ( ) const
Returns
underlying array of pointers

Definition at line 242 of file DynamicObjectArray.h.

T* get_element ( int32_t  index) const

get array element at index

(does NOT do bounds checking)

Parameters
indexindex
Returns
array element at index

Definition at line 78 of file DynamicObjectArray.h.

T* get_element_safe ( int32_t  index) const

get array element at index

(does bounds checking)

Parameters
indexindex
Returns
array element at index

Definition at line 93 of file DynamicObjectArray.h.

virtual const char* get_name ( ) const
virtual
Returns
object name

Implements CSGObject.

Definition at line 248 of file DynamicObjectArray.h.

int32_t get_num_elements ( ) const

get number of elements

Returns
number of elements

Definition at line 66 of file DynamicObjectArray.h.

bool insert_element ( T *  element,
int32_t  index 
)

insert array element at index

Parameters
elementelement to insert
indexindex
Returns
if setting was successful

Definition at line 129 of file DynamicObjectArray.h.

CDynamicObjectArray<T>& operator= ( CDynamicObjectArray< T > &  orig)

operator overload for array assignment

Parameters
origoriginal array
Returns
new array

Definition at line 227 of file DynamicObjectArray.h.

void pop_back ( )

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

Definition at line 169 of file DynamicObjectArray.h.

void push_back ( T *  element)

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

Parameters
elementelement to append

Definition at line 159 of file DynamicObjectArray.h.

bool set_element ( T *  element,
int32_t  index 
)

set array element at index

Parameters
elementelement to set
indexindex
Returns
if setting was successful

Definition at line 107 of file DynamicObjectArray.h.

int32_t set_granularity ( int32_t  g)

set the resize granularity

Parameters
gnew granularity
Returns
what has been set (minimum is 128)

Definition at line 59 of file DynamicObjectArray.h.

void shuffle ( )

shuffles the array

Definition at line 245 of file DynamicObjectArray.h.


The documentation for this class was generated from the following file:

SHOGUN Machine Learning Toolbox - Documentation