The open heap used by all cost-based search algorithms. More...
#include <PriorityQueue.h>
Public Member Functions | |
| PriorityQueue (bool(*)(Node const *, Node const *)) | |
Constructs a new PriorityQueue that heap-sorts nodes using the specified comparator. | |
| bool | empty () const |
Returns true if the heap contains no nodes, false otherwise. | |
| void | clear () |
| Removes all nodes from the heap. More... | |
| size_t | size () const |
| Returns the number of nodes currently in the heap. | |
| void | push (Node *node) |
| Pushes the specified node onto the heap. More... | |
| Node * | front () const |
| Returns the least costly node in the heap. More... | |
| void | pop () |
| Removes the least costly node from the heap. More... | |
| void | remove (Node const *node) |
| Removes all instances of the specified node from the heap. | |
| void | enumerate (Common::Array< Node const *> &sorted) const |
| Enumerates all nodes in the heap so far. More... | |
The open heap used by all cost-based search algorithms.
This class template is basically a thin wrapper on top of both the std::deque class template and the STL heap operations.
| void Crab::PriorityQueue< Node >::clear | ( | ) |
Removes all nodes from the heap.
| void Crab::PriorityQueue< Node >::push | ( | Node * | node | ) |
Pushes the specified node onto the heap.
The heap will maintain the ordering of its nodes during this operation.
! empty() | Node * Crab::PriorityQueue< Node >::front | ( | ) | const |
Returns the least costly node in the heap.
! empty() | void Crab::PriorityQueue< Node >::pop | ( | ) |
Removes the least costly node from the heap.
The heap will maintain the ordering of its nodes during this operation.
! empty() | void Crab::PriorityQueue< Node >::enumerate | ( | Common::Array< Node const *> & | sorted | ) | const |
Enumerates all nodes in the heap so far.
| sorted | the container to which each node will be added. |
NULL pointers in the heap.