|
| Heap () |
| Default constructor.
|
|
| Heap (const HeapInterface &i) |
| Constructs a heap with a given HeapInterface .
|
|
| ~Heap ()=default |
| Destructor.
|
|
void | clear () |
| Clears the heap.
|
|
bool | empty () |
| Checks if the heap is empty.
|
|
unsigned int | size () |
| Returns the size of the heap.
|
|
void | reserve (unsigned int n) |
| Reserves space for n entries.
|
|
void | reset_heap_position (HeapEntry h) |
| Resets the heap position of an entry to -1 (not in heap).
|
|
bool | is_stored (HeapEntry h) |
| Checks if an entry is stored in the heap.
|
|
void | insert (HeapEntry h) |
| Inserts an entry into the heap.
|
|
HeapEntry | front () |
| Retrieves the first entry in the heap.
|
|
void | pop_front () |
| Deletes the first entry in the heap.
|
|
void | remove (HeapEntry h) |
| Removes an entry from the heap.
|
|
void | update (HeapEntry h) |
| Updates an entry in the heap.
|
|
bool | check () |
| Checks the heap condition.
|
|
template<class HeapEntry, class HeapInterface>
class easy3d::Heap< HeapEntry, HeapInterface >
A class implementing a heap.
This class provides methods to manage a heap data structure, including insertion, removal, and updating of elements.
- Template Parameters
-
HeapEntry | The type of the elements stored in the heap. |
HeapInterface | The interface class that provides methods for comparing and managing heap positions. |
An example of heap interface
class HeapInterface {
public:
: prio_(prio), pos_(pos) {
}
bool greater(SurfaceMesh::Vertex v0, SurfaceMesh::Vertex v1) { return prio_[v0] > prio_[v1]; }
int get_heap_position(SurfaceMesh::Vertex v) { return pos_[v]; }
void set_heap_position(SurfaceMesh::Vertex v, int pos) { pos_[v] = pos; }
private:
SurfaceMesh::VertexProperty<float> prio_;
SurfaceMesh::VertexProperty<int> pos_;
};
Vertex property of type T.
Definition surface_mesh.h:255
This type represents a vertex (internally it is basically an index).
Definition surface_mesh.h:135