A priority queue, implemented as a binary heap
Inheritance:
Public Fields
-
static const priority_t min_priority
- Minimum allowable priority
Public Methods
-
pqueue()
- Creates a heap with initial capacity and incremental growth value
-
pqueue(unsigned capacity, unsigned grow = DEFAULT_CONTAINER_GROWTH)
-
void insert(object* obj, priority_t priority)
- Inserts a new item into the queue.
-
object* removeMinimum()
- Removes the element at the front of the queue
-
void adjust(const object &obj, priority_t new_priority)
- Repositions an item already in the queue.
-
priority_t getPriority(const object &obj) const
- Returns the priority of an enqueued item.
-
bool isEnqueued(const object &obj) const
- Returns true if the item has been enqueued, false otherwise
-
priority_t minPriority() const
- Returns the minimum priority.
-
inline unsigned getSize() const
- Returns the number of items in the queue
-
~pqueue()
- Destructor.
Inherited from object:
Public Methods
-
virtual bool operator==(const object &obj) const
-
virtual bool operator!=(const object &obj) const
-
virtual unsigned int hashcode() const
-
virtual object* clone() const
Documentation
A priority queue, implemented as a binary heap
static const priority_t min_priority
- Minimum allowable priority
pqueue()
- Creates a heap with initial capacity and incremental growth value
pqueue(unsigned capacity, unsigned grow = DEFAULT_CONTAINER_GROWTH)
void insert(object* obj, priority_t priority)
-
Inserts a new item into the queue. Inserting an object twice has
undefined effects.
object* removeMinimum()
- Removes the element at the front of the queue
void adjust(const object &obj, priority_t new_priority)
-
Repositions an item already in the queue. Undefined if an
item is not in the queue.
priority_t getPriority(const object &obj) const
-
Returns the priority of an enqueued item. Undefined item item is not
in the queue.
bool isEnqueued(const object &obj) const
- Returns true if the item has been enqueued, false otherwise
priority_t minPriority() const
-
Returns the minimum priority. Returns min_priority if the
queue is empty.
inline unsigned getSize() const
- Returns the number of items in the queue
~pqueue()
- Destructor. Does not destroy queued objects.
- This class has no child classes.
Alphabetic index HTML hierarchy of classes or Java
This page was generated with the help of DOC++.