ml::CSOObjectHeap< T > Class Template Reference

Heap structure with property i>2*i+1 and i>2*i+2 Parent i has children 2*i+1 and 2*i+2 Smallest values are stored closer to root of tree Elements are sorted while inserting them in the heap. More...

#include <CSOObjectHeap.h>

Inheritance diagram for ml::CSOObjectHeap< T >:

ml::CSOObjectVector< T >

List of all members.

Public Member Functions

 CSOObjectHeap ()
 Standard constructor.
 ~CSOObjectHeap ()
 Standard destructor.
T * root ()
 Get root (fist) element of heap, typecast from CSOLiveWireNode to T.
void swap (unsigned int i, unsigned int j)
 Swap two heap elements and resort heap.
void insert (T *we)
 Insert heap element, resort heap.
void insert (T *we, float v)
 Insert heap element and set value, resort heap.
void update (T *we, float nv)
 Update given heap element with new value, resort heap.
int remove (T *we)
 Remove heap element, resort heap.
void sort ()
 Sort heap.


Detailed Description

template<class T>
class ml::CSOObjectHeap< T >

Heap structure with property i>2*i+1 and i>2*i+2 Parent i has children 2*i+1 and 2*i+2 Smallest values are stored closer to root of tree Elements are sorted while inserting them in the heap.

Definition at line 27 of file CSOObjectHeap.h.


Constructor & Destructor Documentation

template<class T >
ml::CSOObjectHeap< T >::CSOObjectHeap (  )  [inline]

Standard constructor.

Definition at line 69 of file CSOObjectHeap.h.

References ML_TRACE_IN_TIME_CRITICAL.

template<class T >
ml::CSOObjectHeap< T >::~CSOObjectHeap (  )  [inline]

Standard destructor.

Definition at line 77 of file CSOObjectHeap.h.

References ml::CSOObjectVector< T >::clear(), and ML_TRACE_IN_TIME_CRITICAL.


Member Function Documentation

template<class T>
void ml::CSOObjectHeap< T >::insert ( T *  we,
float  v 
) [inline]

template<class T>
void ml::CSOObjectHeap< T >::insert ( T *  we  )  [inline]

Insert heap element, resort heap.

Definition at line 109 of file CSOObjectHeap.h.

References ml::CSOObjectVector< T >::appendUnsafe(), int(), ml::CSOObjectVector< T >::last(), and ML_TRACE_IN_TIME_CRITICAL.

Referenced by ml::CSOObjectHeap< T >::sort().

template<class T>
int ml::CSOObjectHeap< T >::remove ( T *  we  )  [inline, virtual]

template<class T >
T * ml::CSOObjectHeap< T >::root (  )  [inline]

Get root (fist) element of heap, typecast from CSOLiveWireNode to T.

Definition at line 87 of file CSOObjectHeap.h.

References ml::CSOObjectVector< T >::firstBoundsCheck(), ML_TRACE_IN_TIME_CRITICAL, and T.

template<class T >
void ml::CSOObjectHeap< T >::sort (  )  [inline]

template<class T >
void ml::CSOObjectHeap< T >::swap ( unsigned int  i,
unsigned int  j 
) [inline, virtual]

Swap two heap elements and resort heap.

Reimplemented from ml::CSOObjectVector< T >.

Definition at line 97 of file CSOObjectHeap.h.

References ml::CSOObjectVector< T >::at(), and ML_TRACE_IN_TIME_CRITICAL.

Referenced by ml::CSOObjectHeap< T >::remove().

template<class T>
void ml::CSOObjectHeap< T >::update ( T *  we,
float  nv 
) [inline]

Update given heap element with new value, resort heap.

Definition at line 175 of file CSOObjectHeap.h.

References ML_TRACE_IN_TIME_CRITICAL, and ml::CSOObjectVector< T >::num().

Referenced by ml::CSOObjectHeap< T >::insert().


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

Generated on Sat Sep 3 18:39:42 2011 for MeVisLab Toolbox Reference by  doxygen 1.5.8