OpenMesh::Utils::HeapT< HeapEntry, HeapInterface > Class Template Reference
#include <OSG/Utils/HeapT.hh>
List of all members.
Public Member Functions |
| bool | check () |
| | check heap condition
|
| void | clear () |
| | clear the heap
|
| bool | empty () const |
| | is heap empty?
|
| HeapEntry | front () const |
| | get the first entry
|
| | HeapT (const HeapInterface &_interface) |
| | Construct with a given HeapIterface.
|
| | HeapT () |
| | Constructor.
|
| void | insert (HeapEntry _h) |
| | insert the entry _h
|
| bool | is_stored (HeapEntry _h) |
| | is an entry in the heap?
|
| void | pop_front () |
| | delete the first entry
|
| void | remove (HeapEntry _h) |
| | remove an entry
|
| void | reserve (unsigned int _n) |
| | reserve space for _n entries
|
| void | reset_heap_position (HeapEntry _h) |
| | reset heap position to -1 (not in heap)
|
| unsigned int | size () const |
| | returns the size of heap
|
| void | update (HeapEntry _h) |
| | ~HeapT () |
| | Destructor.
|
Protected Attributes |
| HeapInterface | interface_ |
| | Instance of HeapInterface.
|
Private Types |
| typedef std::vector< HeapEntry > | Base |
| typedef std::vector< HeapEntry > | HeapVector |
Private Member Functions |
| void | downheap (unsigned int _idx) |
| | Downheap. Establish heap property.
|
| void | entry (unsigned int _idx, HeapEntry _h) |
| | Set entry _h to index _idx and update _h's heap position.
|
| HeapEntry | entry (unsigned int _idx) const |
| | Get the entry at index _idx.
|
| unsigned int | left (unsigned int _i) |
| | Get left child's index.
|
| unsigned int | parent (unsigned int _i) |
| | Get parent's index.
|
| unsigned int | right (unsigned int _i) |
| | Get right child's index.
|
| void | upheap (unsigned int _idx) |
| | Upheap. Establish heap property.
|
Detailed Description
template<class HeapEntry, class HeapInterface = HeapEntry>
class OpenMesh::Utils::HeapT< HeapEntry, HeapInterface >
An efficient, highly customizable heap.
The main difference (and performace boost) of this heap compared to e.g. the heap of the STL is that here to 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:
- the class
HeapEntry, that will be stored in the heap
- the HeapInterface telling the heap how to compare heap entries and how to store the heap positions in the heap entries.
As an example how to use the class see declaration of class Decimater::DecimaterT.
- See also:
- HeapInterfaceT
Definition at line 127 of file HeapT.hh.
Member Typedef Documentation
template<class HeapEntry , class HeapInterface = HeapEntry>
template<class HeapEntry , class HeapInterface = HeapEntry>
Constructor & Destructor Documentation
template<class HeapEntry , class HeapInterface = HeapEntry>
template<class HeapEntry , class HeapInterface = HeapEntry>
Construct with a given HeapIterface.
Definition at line 138 of file HeapT.hh.
template<class HeapEntry , class HeapInterface = HeapEntry>
Member Function Documentation
template<class HeapEntry , class HeapInterface = HeapEntry>
check heap condition
Definition at line 233 of file HeapT.hh.
template<class HeapEntry , class HeapInterface = HeapEntry>
clear the heap
Definition at line 147 of file HeapT.hh.
template<class HeapEntry , class HeapInterface >
Downheap. Establish heap property.
Definition at line 327 of file HeapT.hh.
template<class HeapEntry , class HeapInterface = HeapEntry>
is heap empty?
Definition at line 150 of file HeapT.hh.
template<class HeapEntry , class HeapInterface = HeapEntry>
| void OpenMesh::Utils::HeapT< HeapEntry, HeapInterface >::entry |
( |
unsigned int |
_idx, |
|
|
HeapEntry |
_h | |
|
) |
| | [inline, private] |
Set entry _h to index _idx and update _h's heap position.
Definition at line 279 of file HeapT.hh.
template<class HeapEntry , class HeapInterface = HeapEntry>
| HeapEntry OpenMesh::Utils::HeapT< HeapEntry, HeapInterface >::entry |
( |
unsigned int |
_idx |
) |
const [inline, private] |
Get the entry at index _idx.
Definition at line 271 of file HeapT.hh.
template<class HeapEntry , class HeapInterface = HeapEntry>
get the first entry
Definition at line 174 of file HeapT.hh.
template<class HeapEntry , class HeapInterface = HeapEntry>
insert the entry _h
Definition at line 167 of file HeapT.hh.
template<class HeapEntry , class HeapInterface = HeapEntry>
is an entry in the heap?
Definition at line 163 of file HeapT.hh.
template<class HeapEntry , class HeapInterface = HeapEntry>
Get left child's index.
Definition at line 290 of file HeapT.hh.
template<class HeapEntry , class HeapInterface = HeapEntry>
Get parent's index.
Definition at line 288 of file HeapT.hh.
template<class HeapEntry , class HeapInterface = HeapEntry>
delete the first entry
Definition at line 181 of file HeapT.hh.
template<class HeapEntry , class HeapInterface = HeapEntry>
remove an entry
Definition at line 198 of file HeapT.hh.
template<class HeapEntry , class HeapInterface = HeapEntry>
reserve space for _n entries
Definition at line 156 of file HeapT.hh.
template<class HeapEntry , class HeapInterface = HeapEntry>
reset heap position to -1 (not in heap)
Definition at line 159 of file HeapT.hh.
template<class HeapEntry , class HeapInterface = HeapEntry>
Get right child's index.
Definition at line 292 of file HeapT.hh.
template<class HeapEntry , class HeapInterface = HeapEntry>
returns the size of heap
Definition at line 153 of file HeapT.hh.
template<class HeapEntry , class HeapInterface = HeapEntry>
update an entry: change the key and update the position to reestablish the heap property.
Definition at line 223 of file HeapT.hh.
template<class HeapEntry , class HeapInterface >
Upheap. Establish heap property.
Definition at line 305 of file HeapT.hh.
Member Data Documentation
template<class HeapEntry , class HeapInterface = HeapEntry>
Instance of HeapInterface.
Definition at line 255 of file HeapT.hh.
The documentation for this class was generated from the following file: