Public Member Functions | Protected Attributes

CSet< T > Class Template Reference


Detailed Description

template<class T>
class shogun::CSet< T >

Template Set class.

Lazy implementation of a set. Set grows and shrinks dynamically and can be conveniently iterated through via the [] operator.

Definition at line 26 of file Set.h.

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

List of all members.

Public Member Functions

 CSet (bool traceable=true)
 ~CSet ()
void add (T e)
void remove (T e)
bool contains (T e)
int32_t index_of (T e)
int32_t get_num_elements () const
get_element (int32_t index) const
T * get_element_ptr (int32_t index)
operator[] (int32_t index) const
T * get_array ()
virtual const char * get_name () const

Protected Attributes

DynArray< T > * array

Constructor & Destructor Documentation

CSet ( bool  traceable = true  ) 

Default constructor

Definition at line 30 of file Set.h.

~CSet (  ) 

Default destructor

Definition at line 36 of file Set.h.


Member Function Documentation

void add ( e  ) 

Add an element to the set

Parameters:
e elemet to be added

Definition at line 45 of file Set.h.

bool contains ( e  ) 

Remove an element from the set

Parameters:
e element to be looked for

Definition at line 66 of file Set.h.

T* get_array ( void   ) 
Returns:
underlying array in memory

Definition at line 129 of file Set.h.

T get_element ( int32_t  index  )  const

get set element at index

(does NOT do bounds checking)

Parameters:
index index
Returns:
array element at index

Definition at line 98 of file Set.h.

T* get_element_ptr ( int32_t  index  ) 

get set element at index as reference

(does NOT do bounds checking)

Parameters:
index index
Returns:
array element at index

Definition at line 110 of file Set.h.

virtual const char* get_name ( void   )  const [virtual]
Returns:
object name

Implements CSGObject.

Definition at line 135 of file Set.h.

int32_t get_num_elements ( void   )  const

get number of elements

Returns:
number of elements

Definition at line 86 of file Set.h.

int32_t index_of ( e  ) 

Index of element in the set

Parameters:
e element to be removed
Returns:
index of the element or -1 if not found

Definition at line 77 of file Set.h.

T operator[] ( int32_t  index  )  const

operator overload for set read only access use add() for write access

DOES NOT DO ANY BOUNDS CHECKING

Parameters:
index index
Returns:
element at index

Definition at line 123 of file Set.h.

void remove ( e  ) 

Remove an element from the set

Parameters:
e element to be removed

Definition at line 55 of file Set.h.


Member Data Documentation

DynArray<T>* array [protected]

dynamic array the set is based on

Definition at line 139 of file Set.h.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

SHOGUN Machine Learning Toolbox - Documentation