|
MeVisLab Toolbox Reference
|
Heap structure with property i>2*i+1 and i>2*i+2. More...
#include <CSOObjectHeap.h>
Public Member Functions | |
| CSOObjectHeap () | |
| Standard constructor. | |
| ~CSOObjectHeap () override | |
| Standard destructor. | |
| T * | root () const |
| Returns the root (first) element of heap that is typecast from CSOLiveWireNode to T. | |
| void | swap (unsigned int i, unsigned int j) override |
| Swaps two heap elements and resorts the heap. | |
| void | insert (T *we) |
| Inserts heap element and resorts the heap. | |
| void | insert (T *we, float v) |
| Inserts heap element, sets the value, and resorts the heap. | |
| void | update (T *we, float nv) |
| Updates the specified heap element with the new value, and resorts the heap. | |
| int | remove (T *we) override |
| Removes the heap element, and resorts the heap. | |
| void | sort () |
| Sorts the 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 the number of elements in the vector. | |
| T * | atBoundsCheck (unsigned int pos) const |
| Returns the element at the specified position, and returns nullptr when out of range. | |
| T * | at (unsigned int pos) const |
| Returns the element at the specified position. | |
| T * | firstBoundsCheck () const |
| Returns the first element, and return nullptr if out of range. | |
| T * | first () const |
| Returns the first element. | |
| T * | lastBoundsCheck () const |
| Returns the last element, and returns nullptr if out of range. | |
| T * | last () const |
| Returns the last element. | |
| virtual unsigned int | append (T *elem) |
| Appends the element to the back of the vector and returns its position. | |
| virtual void | clear () |
| Clears all internal pointers. | |
| virtual void | deleteAt (unsigned int pos) |
| Deletes an element at the specified position. | |
| virtual void | deleteLast () |
| Deletes the last element of the vector. | |
| virtual int | lookup (T *elem) const |
| Searches for an element in the vector and returns its position. | |
| virtual int | removeUnSwapped (T *elem) |
| Deletes an element specified by its pointer and returns its position. | |
| virtual void | destroy () |
| Deletes all elements in the vector. | |
| virtual void | replace (T *elem, unsigned int pos) |
| Replaces the element at the specified position with the specified element. | |
| void | reserve (unsigned int init) |
| Reserves a number of elements. It copies old elements if needed. | |
Additional Inherited Members | |
Protected Member Functions inherited from ml::CSOObjectVector< T > | |
| virtual void | expand () |
| Grows vector by adding an extra block of size BLOCKSIZE. | |
| virtual unsigned int | appendUnsafe (T *elem) |
| Appends the element to back of vector. | |
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 74 of file CSOObjectHeap.h.
|
override |
Standard destructor.
Definition at line 81 of file CSOObjectHeap.h.
References ml::CSOObjectVector< T >::clear().
| void ml::CSOObjectHeap< T >::insert | ( | T * | we | ) |
Inserts heap element and resorts the heap.
Definition at line 107 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 | ||
| ) |
Inserts heap element, sets the value, and resorts the heap.
Definition at line 122 of file CSOObjectHeap.h.
References ml::CSOObjectVector< T >::appendUnsafe(), ml::CSOObjectVector< T >::last(), and ml::CSOObjectVector< T >::num().
|
overridevirtual |
Removes the heap element, and resorts the heap.
Returns the position where the element was remove or -1 if the element was not found.
Reimplemented from ml::CSOObjectVector< T >.
Definition at line 142 of file CSOObjectHeap.h.
References ml::CSOObjectVector< T >::at(), ml::CSOObjectVector< T >::deleteLast(), and ml::CSOObjectVector< T >::num().
| T * ml::CSOObjectHeap< T >::root | ( | ) | const |
Returns the root (first) element of heap that is typecast from CSOLiveWireNode to T.
Definition at line 89 of file CSOObjectHeap.h.
References ml::CSOObjectVector< T >::firstBoundsCheck(), and T.
| void ml::CSOObjectHeap< T >::sort | ( | ) |
Sorts the heap.
Definition at line 237 of file CSOObjectHeap.h.
References ml::CSOObjectVector< T >::append(), ml::CSOObjectVector< T >::clear(), and ml::CSOObjectVector< T >::num().
|
overridevirtual |
Swaps two heap elements and resorts the heap.
Reimplemented from ml::CSOObjectVector< T >.
Definition at line 97 of file CSOObjectHeap.h.
References ml::CSOObjectVector< T >::at(), and ml::CSOObjectVector< T >::swap().
| void ml::CSOObjectHeap< T >::update | ( | T * | we, |
| float | nv | ||
| ) |
Updates the specified heap element with the new value, and resorts the heap.
Definition at line 177 of file CSOObjectHeap.h.
References ml::CSOObjectVector< T >::num().