12 #ifndef _DYNAMIC_REFOBJECT_ARRAY_H_ 13 #define _DYNAMIC_REFOBJECT_ARRAY_H_ 15 #include <shogun/base/RefObject.h> 50 :
CSGObject(), m_array(dim1*dim2*dim3), name(
"Array")
65 :
CSGObject(), m_array(p_array, p_dim1_size, p_free_array, p_copy_array), name(
"Array")
67 dim1_size=p_dim1_size;
81 bool p_free_array=
true,
bool p_copy_array=
false)
82 :
CSGObject(), m_array(p_array, p_dim1_size*p_dim2_size, p_free_array, p_copy_array), name(
"Array")
84 dim1_size=p_dim1_size;
85 dim2_size=p_dim2_size;
99 int32_t p_dim3_size,
bool p_free_array=
true,
bool p_copy_array=
false)
100 :
CSGObject(), m_array(p_array, p_dim1_size*p_dim2_size*p_dim3_size, p_free_array, p_copy_array), name(
"Array")
102 dim1_size=p_dim1_size;
103 dim2_size=p_dim2_size;
104 dim3_size=p_dim3_size;
198 inline CRefObject*
element(int32_t idx1, int32_t idx2=0, int32_t idx3=0)
200 return get_element(idx1+dim1_size*(idx2+dim2_size*idx3));
236 inline bool set_element(CRefObject* e, int32_t idx1, int32_t idx2=0, int32_t idx3=0)
238 int32_t idx = idx1+dim1_size*(idx2+dim2_size*idx3);
239 CRefObject* old=NULL;
300 CRefObject* e=m_array.
back();
311 inline CRefObject*
back()
const 313 CRefObject* e=m_array.
back();
373 m_array=orig.m_array;
403 {
return "DynamicRefObjectArray"; }
407 inline void unref_all()
int32_t set_granularity(int32_t g)
int32_t find_element(T element) const
Dynamic array class for CRefObject pointers that creates an array that can be used like a list or an ...
Class SGRefObject is a reference count based memory management class.
void shuffle(CRandom *rand)
CRefObject * get_element(int32_t index) const
bool insert_element(T element, int32_t index)
bool append_element(T element)
bool set_element(CRefObject *e, int32_t idx1, int32_t idx2=0, int32_t idx3=0)
SGDynamicRefObjectArray(int32_t dim1, int32_t dim2=1, int32_t dim3=1)
int32_t get_num_elements() const
T get_element(int32_t index) const
int32_t get_num_elements() const
bool delete_element(int32_t idx)
int32_t set_granularity(int32_t g)
CRefObject * element(int32_t idx1, int32_t idx2=0, int32_t idx3=0)
bool append_element(CRefObject *e)
CRefObject * get_element_safe(int32_t index) const
SGDynamicRefObjectArray(CRefObject **p_array, int32_t p_dim1_size, int32_t p_dim2_size, bool p_free_array=true, bool p_copy_array=false)
T get_last_element() const
void get_array_size(int32_t &dim1, int32_t &dim2)
Class SGObject is the base class of all shogun objects.
void push_back(T element)
SGDynamicRefObjectArray & operator=(SGDynamicRefObjectArray &orig)
void set_array_name(const char *p_name)
T get_element_safe(int32_t index) const
Template Dynamic array class that creates an array that can be used like a list or an array...
void clear_array(T value)
virtual ~SGDynamicRefObjectArray()
bool set_element(T element, int32_t index)
void push_back(CRefObject *e)
CRefObject * get_last_element() const
CRefObject * back() const
: Pseudo random number geneartor
int32_t get_array_size() const
bool insert_element(CRefObject *e, int32_t index)
all of classes and functions are contained in the shogun namespace
virtual const char * get_name() const
const char * get_array_name() const
SGDynamicRefObjectArray()
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)
void get_array_size(int32_t &dim1, int32_t &dim2, int32_t &dim3)
T * get_element_ptr(int32_t index)
CRefObject ** get_array() const
int32_t find_element(CRefObject *elem) const
SGDynamicRefObjectArray(CRefObject **p_array, int32_t p_dim1_size, bool p_free_array=true, bool p_copy_array=false)
bool delete_element(int32_t idx)