PixelLightAPI  .
Public Member Functions
PLCore::Heap< KeyType, ValueType > Class Template Reference

Abstract heap class template (priority queue) More...

#include <Heap.h>

Inheritance diagram for PLCore::Heap< KeyType, ValueType >:
Inheritance graph
[legend]

List of all members.

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.

Detailed Description

template<class KeyType, class ValueType>
class PLCore::Heap< KeyType, ValueType >

Abstract heap class template (priority queue)

Remarks:
*    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"
*  

Member Function Documentation

template<class KeyType, class ValueType>
virtual void PLCore::Heap< KeyType, ValueType >::Clear ( ) [pure virtual]
template<class KeyType, class ValueType>
virtual bool PLCore::Heap< KeyType, ValueType >::IsEmpty ( ) const [pure virtual]
template<class KeyType, class ValueType>
virtual uint32 PLCore::Heap< KeyType, ValueType >::GetNumOfElements ( ) const [pure virtual]
template<class KeyType, class ValueType>
virtual bool PLCore::Heap< KeyType, ValueType >::Add ( const KeyType &  Key,
const ValueType &  Value 
) [pure virtual]

Adds a new element to the heap.

Parameters:
[in]KeyThe key of the new element
[in]ValueThe value of the new element
Returns:
'true' if all went fine, else 'false'
Note:
  • You have to check by yourself whether there's already such a key within 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 >.

template<class KeyType, class ValueType>
virtual bool PLCore::Heap< KeyType, ValueType >::GetTop ( ValueType *  pValue = nullptr,
KeyType *  pKey = nullptr 
) const [pure virtual]

Returns the value of the top element.

Parameters:
[out]pValueIf not a null pointer, this will receive the value of the top element
[out]pKeyIf not a null pointer, this will receive the key of the top element
Returns:
'true' if all went fine, else 'false'

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 >.

template<class KeyType, class ValueType>
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.

Parameters:
[out]pValueIf not a null pointer, this will receive the value of the top element
[out]pKeyIf not a null pointer, this will receive the key of the top element
Returns:
'true' if all went fine, else 'false'

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 >.


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


PixelLight PixelLight 0.9.11-R1
Copyright (C) 2002-2012 by The PixelLight Team
Last modified Thu Feb 23 2012 14:09:25
The content of this PixelLight document is published under the
Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported