Developer Documentation
|
#include <OSG/Utils/HeapT.hh>
Public Member Functions | |
HeapT () | |
Constructor. More... | |
HeapT (const HeapInterface &_interface) | |
Construct with a given HeapIterface . More... | |
~HeapT () | |
Destructor. More... | |
HeapInterface & | getInterface () |
const HeapInterface & | getInterface () const |
void | clear () |
clear the heap More... | |
bool | empty () const |
is heap empty? More... | |
size_t | size () const |
returns the size of heap More... | |
void | reserve (size_t _n) |
reserve space for _n entries More... | |
void | reset_heap_position (HeapEntry _h) |
reset heap position to -1 (not in heap) More... | |
bool | is_stored (HeapEntry _h) |
is an entry in the heap? More... | |
void | insert (HeapEntry _h) |
insert the entry _h More... | |
HeapEntry | front () const |
get the first entry More... | |
void | pop_front () |
delete the first entry More... | |
void | remove (HeapEntry _h) |
remove an entry More... | |
void | update (HeapEntry _h) |
bool | check () |
check heap condition More... | |
Protected Attributes | |
HeapInterface | interface_ |
Instance of HeapInterface. More... | |
Private Types | |
typedef std::vector< HeapEntry > | Base |
typedef std::vector< HeapEntry > | HeapVector |
Private Member Functions | |
void | upheap (size_t _idx) |
Upheap. Establish heap property. More... | |
void | downheap (size_t _idx) |
Downheap. Establish heap property. More... | |
HeapEntry | entry (size_t _idx) const |
Get the entry at index _idx. More... | |
void | entry (size_t _idx, HeapEntry _h) |
Set entry _h to index _idx and update _h's heap position. More... | |
size_t | parent (size_t _i) |
Get parent's index. More... | |
size_t | left (size_t _i) |
Get left child's index. More... | |
size_t | right (size_t _i) |
Get right child's index. More... | |
An efficient, highly customizable heap.
The main difference (and performance boost) of this heap compared to e.g. the heap of the STL is that here the positions of the heap's elements are accessible from the elements themself. Therefore if one changes the priority of an element one does not have to remove and re-insert this element, but can just call the update(HeapEntry) method.
This heap class is parameterized by two template arguments:
HeapEntry
, that will be stored in the heap As an example how to use the class see declaration of class Decimater::DecimaterT.
|
private |
|
private |
|
inline |
|
inlineexplicit |
|
inline |
|
inline |
|
inline |
|
private |
|
inline |
|
inlineprivate |
|
inlineprivate |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inlineprivate |
|
inlineprivate |
|
inline |
|
inline |
|
inline |
|
inline |
|
inlineprivate |
|
inline |
|
inline |
|
private |
|
protected |