PixelLightAPI
.
|
Abstract heap class template (priority queue) More...
#include <Heap.h>
Public Member Functions | |
virtual void | Clear ()=0 |
Clears the heap. | |
virtual bool | IsEmpty () const =0 |
Checks whether the heap is complete empty. | |
virtual uint32 | GetNumOfElements () const =0 |
Returns the number of elements. | |
virtual bool | Add (const KeyType &Key, const ValueType &Value)=0 |
Adds a new element to the heap. | |
virtual bool | GetTop (ValueType *pValue=nullptr, KeyType *pKey=nullptr) const =0 |
Returns the value of the top element. | |
virtual bool | ExtractTop (ValueType *pValue=nullptr, KeyType *pKey=nullptr)=0 |
Returns the value of the top element and removes it from the heap. |
Abstract heap class template (priority queue)
* Usage example: * // Create binary heap object with integer as key and pointer to characters * // as value * Heap<int, char*> cHeap; * // Fill heap * cHeap.Insert(1, "Second"); // Insert "Second" * cHeap.Insert(0, "First"); // Insert "First" * cHeap.Insert(2, "Third"); // Insert "Third" * // Read out heap * char *pT; * cHeap.Remove(pT, 0); // Returns "First" * cHeap.Remove(pT, 0); // Returns "Second" * cHeap.Remove(pT, 0); // Returns "Third" *
virtual void PLCore::Heap< KeyType, ValueType >::Clear | ( | ) | [pure virtual] |
Clears the heap.
Implemented in PLCore::BinaryHeap< KeyType, ValueType, Comparer >, PLCore::BinaryHeap< float, SceneHierarchyNode * >, PLCore::BinaryHeap< float, GraphNode * >, PLCore::BinaryHeap< float, SceneNode * >, PLCore::FibonacciHeap< KeyType, ValueType, Comparer >, and PLCore::BinominalHeap< KeyType, ValueType, Comparer >.
virtual bool PLCore::Heap< KeyType, ValueType >::IsEmpty | ( | ) | const [pure virtual] |
Checks whether the heap is complete empty.
Implemented in PLCore::BinaryHeap< KeyType, ValueType, Comparer >, PLCore::BinaryHeap< float, SceneHierarchyNode * >, PLCore::BinaryHeap< float, GraphNode * >, PLCore::BinaryHeap< float, SceneNode * >, PLCore::FibonacciHeap< KeyType, ValueType, Comparer >, and PLCore::BinominalHeap< KeyType, ValueType, Comparer >.
virtual uint32 PLCore::Heap< KeyType, ValueType >::GetNumOfElements | ( | ) | const [pure virtual] |
Returns the number of elements.
Implemented in PLCore::BinaryHeap< KeyType, ValueType, Comparer >, PLCore::BinaryHeap< float, SceneHierarchyNode * >, PLCore::BinaryHeap< float, GraphNode * >, PLCore::BinaryHeap< float, SceneNode * >, PLCore::FibonacciHeap< KeyType, ValueType, Comparer >, and PLCore::BinominalHeap< KeyType, ValueType, Comparer >.
virtual bool PLCore::Heap< KeyType, ValueType >::Add | ( | const KeyType & | Key, |
const ValueType & | Value | ||
) | [pure virtual] |
Adds a new element to the heap.
[in] | Key | The key of the new element |
[in] | Value | The value of the new element |
Implemented in PLCore::BinaryHeap< KeyType, ValueType, Comparer >, PLCore::BinaryHeap< float, SceneHierarchyNode * >, PLCore::BinaryHeap< float, GraphNode * >, PLCore::BinaryHeap< float, SceneNode * >, PLCore::FibonacciHeap< KeyType, ValueType, Comparer >, and PLCore::BinominalHeap< KeyType, ValueType, Comparer >.
virtual bool PLCore::Heap< KeyType, ValueType >::GetTop | ( | ValueType * | pValue = nullptr , |
KeyType * | pKey = nullptr |
||
) | const [pure virtual] |
Returns the value of the top element.
[out] | pValue | If not a null pointer, this will receive the value of the top element |
[out] | pKey | If not a null pointer, this will receive the key of the top element |
Implemented in PLCore::BinaryHeap< KeyType, ValueType, Comparer >, PLCore::BinaryHeap< float, SceneHierarchyNode * >, PLCore::BinaryHeap< float, GraphNode * >, PLCore::BinaryHeap< float, SceneNode * >, PLCore::FibonacciHeap< KeyType, ValueType, Comparer >, and PLCore::BinominalHeap< KeyType, ValueType, Comparer >.
virtual bool PLCore::Heap< KeyType, ValueType >::ExtractTop | ( | ValueType * | pValue = nullptr , |
KeyType * | pKey = nullptr |
||
) | [pure virtual] |
Returns the value of the top element and removes it from the heap.
[out] | pValue | If not a null pointer, this will receive the value of the top element |
[out] | pKey | If not a null pointer, this will receive the key of the top element |
Implemented in PLCore::BinaryHeap< KeyType, ValueType, Comparer >, PLCore::BinaryHeap< float, SceneHierarchyNode * >, PLCore::BinaryHeap< float, GraphNode * >, PLCore::BinaryHeap< float, SceneNode * >, PLCore::FibonacciHeap< KeyType, ValueType, Comparer >, and PLCore::BinominalHeap< KeyType, ValueType, Comparer >.
|