ml::WEMHeap< 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 Largest values are stored closer to root of tree. More...

#include <WEMHeap.h>

Inheritance diagram for ml::WEMHeap< T >:

ml::WEMVector< WEMPrimitive >

List of all members.

Public Member Functions

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


Detailed Description

template<class T>
class ml::WEMHeap< 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 Largest values are stored closer to root of tree.

Elements are sorted while inserting them in the heap.

Definition at line 31 of file WEMHeap.h.


Constructor & Destructor Documentation

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

Standard constructor.

Definition at line 74 of file WEMHeap.h.

References ML_TRACE_IN_TIME_CRITICAL.

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

Standard destructor.

Definition at line 82 of file WEMHeap.h.

References ml::WEMVector< WEMPrimitive >::clear(), and ML_TRACE_IN_TIME_CRITICAL.


Member Function Documentation

template<class T >
void ml::WEMHeap< T >::insert ( WEMPrimitive wp,
double  v 
) [inline]

template<class T >
void ml::WEMHeap< T >::insert ( WEMPrimitive wp  )  [inline]

template<class T >
int ml::WEMHeap< T >::remove ( WEMPrimitive wp  )  [inline, virtual]

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

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

Definition at line 106 of file WEMHeap.h.

References ML_TRACE_IN_TIME_CRITICAL, and ml::WEMHeap< T >::root().

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

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

Definition at line 92 of file WEMHeap.h.

References ml::WEMVector< WEMPrimitive >::first(), ML_TRACE_IN_TIME_CRITICAL, and T.

Referenced by ml::WEMHeap< T >::root().

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

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

Swap two heap elements and resort heap.

Reimplemented from ml::WEMVector< WEMPrimitive >.

Definition at line 115 of file WEMHeap.h.

References ml::WEMVector< WEMPrimitive >::at(), ML_TRACE_IN_TIME_CRITICAL, and ml::WEMPrimitive::setHeapPosition().

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

template<class T >
void ml::WEMHeap< T >::update ( WEMPrimitive wp,
double  nv 
) [inline]


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

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