MeVisLabToolboxReference
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 () const
 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 ( )

Standard constructor.

Definition at line 69 of file CSOObjectHeap.h.

template<class T >
ml::CSOObjectHeap< T >::~CSOObjectHeap ( )

Standard destructor.

Definition at line 76 of file CSOObjectHeap.h.

References ml::CSOObjectVector< T >::clear().


Member Function Documentation

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

Insert heap element, resort heap.

Definition at line 102 of file CSOObjectHeap.h.

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

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

Insert heap element and set value, resort heap.

Definition at line 116 of file CSOObjectHeap.h.

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

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

Remove heap element, resort heap.

Reimplemented from ml::CSOObjectVector< T >.

Definition at line 136 of file CSOObjectHeap.h.

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

template<class T >
T * ml::CSOObjectHeap< T >::root ( ) const

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

Definition at line 84 of file CSOObjectHeap.h.

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

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

Swap two heap elements and resort heap.

Reimplemented from ml::CSOObjectVector< T >.

Definition at line 92 of file CSOObjectHeap.h.

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

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

Update given heap element with new value, resort heap.

Definition at line 171 of file CSOObjectHeap.h.

References ml::CSOObjectVector< T >::num().


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