MeVisLab Toolbox 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>
Public Member Functions | |
CSOObjectHeap () | |
Standard constructor. | |
~CSOObjectHeap () override | |
Standard destructor. | |
T * | root () const |
Get root (first) element of heap, typecast from CSOLiveWireNode to T. | |
void | swap (unsigned int i, unsigned int j) override |
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) override |
Remove heap element, resort heap. | |
void | sort () |
Sort heap. | |
Public Member Functions inherited from ml::CSOObjectVector< T > | |
CSOObjectVector (unsigned int init=0, unsigned int bs=65535) | |
Standard constructor. | |
virtual | ~CSOObjectVector () |
Standard destructor. | |
unsigned int | num () const |
Returns number of elements in the vector. | |
T * | atBoundsCheck (unsigned int pos) const |
Returns element at given position, return NULL when out of range. | |
T * | at (unsigned int pos) const |
Returns element at given position. | |
T * | firstBoundsCheck () const |
Returns first element, return NULL when out of range. | |
T * | first () const |
Returns first element. | |
T * | lastBoundsCheck () const |
Returns last element, return NULL when out of range. | |
T * | last () const |
Returns last element. | |
virtual unsigned int | append (T *elem) |
Appends element to back of vector. | |
virtual void | clear () |
Clears all internal pointers This does not delete the elements in the vector!! | |
virtual void | deleteAt (unsigned int pos) |
Deletes element at given position. | |
virtual void | deleteLast () |
Deletes last element of vector. | |
virtual int | lookup (T *elem) const |
Searches for element in vector and return its position. | |
virtual int | removeUnSwapped (T *elem) |
Deletes element given by its pointer, search element and delete, keep order of elements! | |
virtual void | destroy () |
Deletes all elements in the vector This does not reset the number of elements!! | |
virtual void | replace (T *elem, unsigned int pos) |
Replaces the given position with the given element. | |
void | reserve (unsigned int init) |
Reserves num elements, copy old ones if needed. | |
Additional Inherited Members | |
Protected Member Functions inherited from ml::CSOObjectVector< T > | |
virtual void | expand () |
Grows vector, add extra block of size BLOCKSIZE. | |
virtual unsigned int | appendUnsafe (T *elem) |
Appends element to back of vector, don't check on element being non-NULL Don't use this function directly!! | |
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 31 of file CSOObjectHeap.h.
ml::CSOObjectHeap< T >::CSOObjectHeap | ( | ) |
Standard constructor.
Definition at line 73 of file CSOObjectHeap.h.
|
override |
Standard destructor.
Definition at line 80 of file CSOObjectHeap.h.
References ml::CSOObjectVector< T >::clear().
Insert heap element, resort heap.
Definition at line 106 of file CSOObjectHeap.h.
References ml::CSOObjectVector< T >::appendUnsafe(), ml::CSOObjectVector< T >::last(), mlrange_cast(), and ml::CSOObjectVector< T >::num().
Insert heap element and set value, resort heap.
Definition at line 121 of file CSOObjectHeap.h.
References ml::CSOObjectVector< T >::appendUnsafe(), ml::CSOObjectVector< T >::last(), mlrange_cast(), and ml::CSOObjectVector< T >::num().
Remove heap element, resort heap.
Reimplemented from ml::CSOObjectVector< T >.
Definition at line 141 of file CSOObjectHeap.h.
References ml::CSOObjectVector< T >::at(), ml::CSOObjectVector< T >::deleteLast(), mlrange_cast(), and ml::CSOObjectVector< T >::num().
T * ml::CSOObjectHeap< T >::root | ( | ) | const |
Get root (first) element of heap, typecast from CSOLiveWireNode to T.
Definition at line 88 of file CSOObjectHeap.h.
References ml::CSOObjectVector< T >::firstBoundsCheck(), and T.
void ml::CSOObjectHeap< T >::sort | ( | ) |
Sort heap.
Definition at line 236 of file CSOObjectHeap.h.
References ml::CSOObjectVector< T >::clear(), mlrange_cast(), and ml::CSOObjectVector< T >::num().
Swap two heap elements and resort heap.
Reimplemented from ml::CSOObjectVector< T >.
Definition at line 96 of file CSOObjectHeap.h.
References ml::CSOObjectVector< T >::at(), mlrange_cast(), and ml::CSOObjectVector< T >::swap().
Update given heap element with new value, resort heap.
Definition at line 176 of file CSOObjectHeap.h.
References mlrange_cast(), and ml::CSOObjectVector< T >::num().