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. More... | |
~CSOObjectHeap () override | |
Standard destructor. More... | |
T * | root () const |
Get root (first) element of heap, typecast from CSOLiveWireNode to T. More... | |
void | swap (unsigned int i, unsigned int j) override |
Swap two heap elements and resort heap. More... | |
void | insert (T *we) |
Insert heap element, resort heap. More... | |
void | insert (T *we, float v) |
Insert heap element and set value, resort heap. More... | |
void | update (T *we, float nv) |
Update given heap element with new value, resort heap. More... | |
int | remove (T *we) override |
Remove heap element, resort heap. More... | |
void | sort () |
Sort heap. More... | |
![]() | |
CSOObjectVector (unsigned int init=0, unsigned int bs=65535) | |
Standard constructor. More... | |
virtual | ~CSOObjectVector () |
Standard destructor. More... | |
unsigned int | num () const |
Returns number of elements in the vector. More... | |
T * | atBoundsCheck (unsigned int pos) const |
Returns element at given position, return NULL when out of range. More... | |
T * | at (unsigned int pos) const |
Returns element at given position. More... | |
T * | firstBoundsCheck () const |
Returns first element, return NULL when out of range. More... | |
T * | first () const |
Returns first element. More... | |
T * | lastBoundsCheck () const |
Returns last element, return NULL when out of range. More... | |
T * | last () const |
Returns last element. More... | |
virtual unsigned int | append (T *elem) |
Appends element to back of vector. More... | |
virtual void | clear () |
Clears all internal pointers This does not delete the elements in the vector!! More... | |
virtual void | deleteAt (unsigned int pos) |
Deletes element at given position. More... | |
virtual void | deleteLast () |
Deletes last element of vector. More... | |
virtual int | lookup (T *elem) const |
Searches for element in vector and return its position. More... | |
virtual int | removeUnSwapped (T *elem) |
Deletes element given by its pointer, search element and delete, keep order of elements! More... | |
virtual void | destroy () |
Deletes all elements in the vector This does not reset the number of elements!! More... | |
virtual void | replace (T *elem, unsigned int pos) |
Replaces the given position with the given element. More... | |
void | reserve (unsigned int init) |
Reserves num elements, copy old ones if needed. More... | |
Additional Inherited Members | |
![]() | |
virtual void | expand () |
Grows vector, add extra block of size BLOCKSIZE. More... | |
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!! More... | |
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().
void ml::CSOObjectHeap< T >::insert | ( | T * | we | ) |
Insert heap element, resort heap.
Definition at line 106 of file CSOObjectHeap.h.
References ml::CSOObjectVector< T >::appendUnsafe(), ml::CSOObjectVector< T >::last(), and ml::CSOObjectVector< T >::num().
void ml::CSOObjectHeap< T >::insert | ( | T * | we, |
float | v | ||
) |
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(), and ml::CSOObjectVector< T >::num().
|
overridevirtual |
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(), and ml::CSOObjectVector< T >::num().
T * ml::CSOObjectHeap< T >::root |
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 >::append(), ml::CSOObjectVector< T >::clear(), and ml::CSOObjectVector< T >::num().
|
overridevirtual |
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(), and ml::CSOObjectVector< T >::swap().
void ml::CSOObjectHeap< T >::update | ( | T * | we, |
float | nv | ||
) |
Update given heap element with new value, resort heap.
Definition at line 176 of file CSOObjectHeap.h.
References ml::CSOObjectVector< T >::num().