template<class priority_t,class element_t,class hash_func=id<element_t> > class adevs_pqueue
A priority queue, implemented as a binary heap.
Public Methods
-
adevs_pqueue()
- Creates a heap with initial capacity and incremental growth value
-
adevs_pqueue(int capacity, int grow = PQUEUE_DEFAULT_GROW)
-
adevs_pqueue(const adevs_pqueue<priority_t, element_t, hash_func>& src)
-
const adevs_pqueue<priority_t,element_t,hash_func> & operator=(const adevs_pqueue<priority_t, element_t, hash_func>& src)
-
void insert(const element_t& e, const priority_t& priority)
-
Inserts a new item into the queue.
-
void remove(const element_t& e)
-
Removes an arbitrary element from the queue.
-
const element_t& getMinimum()
- Get the element at the front of the queue
-
void removeMinimum()
- Removes the element at the front of the queue
-
bool isEnqueued(const element_t& e)
- Returns true if the item has been enqueued, false otherwise
-
const priority_t& minPriority()
-
Returns the minimum priority.
-
int getSize() const
- Returns the number of items in the queue
-
bool isEmpty() const
- Returns true if the queue is empty, false otherwise
-
void clear()
- Removes all items in the queue
-
~adevs_pqueue()
- Destructor
Documentation
A priority queue, implemented as a binary heap. Priority comparison use the
<, >, >=, <=, and == operators. Elements are sorted with the smallest at the top.
Priority types and elements types should support the assignment operator.
A hashing function must also be provided for the element types (default is to
use the id() function).
adevs_pqueue()
- Creates a heap with initial capacity and incremental growth value
adevs_pqueue(int capacity, int grow = PQUEUE_DEFAULT_GROW)
adevs_pqueue(const adevs_pqueue<priority_t, element_t, hash_func>& src)
const adevs_pqueue<priority_t,element_t,hash_func> & operator=(const adevs_pqueue<priority_t, element_t, hash_func>& src)
void insert(const element_t& e, const priority_t& priority)
-
Inserts a new item into the queue. If the item is already in the
queue, the item is reprioritized.
void remove(const element_t& e)
-
Removes an arbitrary element from the queue. Returns without doing anything
if the requested element in not in the queue.
const element_t& getMinimum()
- Get the element at the front of the queue
void removeMinimum()
- Removes the element at the front of the queue
bool isEnqueued(const element_t& e)
- Returns true if the item has been enqueued, false otherwise
const priority_t& minPriority()
-
Returns the minimum priority.
int getSize() const
- Returns the number of items in the queue
bool isEmpty() const
- Returns true if the queue is empty, false otherwise
void clear()
- Removes all items in the queue
~adevs_pqueue()
- Destructor
- This class has no child classes.
Alphabetic index HTML hierarchy of classes or Java
This page was generated with the help of DOC++.