ompl::BinaryHeap< _T, LessThan > Class Template Reference

This class provides an implementation of an updatable min-heap. Using it is a bit cumbersome, as it requires keeping track of the BinaryHeap::Element* type, however, it should be as fast as it gets with an updatable heap. More...

#include <ompl/datastructures/BinaryHeap.h>

Classes

class  Element
 When an element is added to the heap, an instance of Element* is created. This instance contains the data that was added and internal information about the position of the data in the heap's internal storage. More...
 

Public Types

using EventAfterInsert = void(*)(Element *, void *)
 Event that gets called after an insertion.
 
using EventBeforeRemove = void(*)(Element *, void *)
 Event that gets called just before a removal.
 

Public Member Functions

 BinaryHeap (LessThan lt)
 
void onAfterInsert (EventAfterInsert event, void *arg)
 Set the event that gets called after insertion.
 
void onBeforeRemove (EventBeforeRemove event, void *arg)
 Set the event that gets called before a removal.
 
void clear ()
 Clear the heap.
 
Elementtop () const
 Return the top element. nullptr for an empty heap.
 
void pop ()
 Remove the top element.
 
void remove (Element *element)
 Remove a specific element.
 
Elementinsert (const _T &data)
 Add a new element.
 
void insert (const std::vector< _T > &list)
 Add a set of elements to the heap.
 
void buildFrom (const std::vector< _T > &list)
 Clear the heap, add the set of elements list to it and rebuild it.
 
void rebuild ()
 Rebuild the heap.
 
void update (Element *element)
 Update an element in the heap.
 
bool empty () const
 Check if the heap is empty.
 
unsigned int size () const
 Get the number of elements in the heap.
 
void getContent (std::vector< _T > &content) const
 Get the data stored in this heap.
 
void sort (std::vector< _T > &list)
 Sort an array of elements. This does not affect the content of the heap.
 
LessThan & getComparisonOperator ()
 Return a reference to the comparison operator.
 

Detailed Description

template<typename _T, class LessThan = std::less<_T>>
class ompl::BinaryHeap< _T, LessThan >

This class provides an implementation of an updatable min-heap. Using it is a bit cumbersome, as it requires keeping track of the BinaryHeap::Element* type, however, it should be as fast as it gets with an updatable heap.

Definition at line 84 of file BinaryHeap.h.


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