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 ()
 ~CSet ()
void add (T e)
void remove (T e)
bool contains (T e)
int32_t get_num_elements () const
get_element (int32_t index) const
operator[] (int32_t index) const
virtual const char * get_name () const

Protected Attributes

CDynamicArray< T > * array

Constructor & Destructor Documentation

CSet (  ) 

Default constructor

Definition at line 30 of file Set.h.

~CSet (  ) 

Default destructor

Definition at line 37 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 46 of file Set.h.

bool contains ( e  ) 

Remove an element from the set

Parameters:
e elemet to be removed

Definition at line 67 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 89 of file Set.h.

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

Implements CSGObject.

Definition at line 108 of file Set.h.

int32_t get_num_elements ( void   )  const

get number of elements

Returns:
number of elements

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 102 of file Set.h.

void remove ( e  ) 

Remove an element from the set

Parameters:
e elemet to be removed

Definition at line 56 of file Set.h.


Member Data Documentation

CDynamicArray<T>* array [protected]

dynamic array the set is based on

Definition at line 112 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