class pqueue

A priority queue, implemented as a binary heap

Inheritance:


Public Fields

[more]static const priority_t min_priority
Minimum allowable priority

Public Methods

[more] pqueue()
Creates a heap with initial capacity and incremental growth value
[more] pqueue(unsigned capacity, unsigned grow = DEFAULT_CONTAINER_GROWTH)
[more]void insert(object* obj, priority_t priority)
Inserts a new item into the queue.
[more]object* removeMinimum()
Removes the element at the front of the queue
[more]void adjust(const object &obj, priority_t new_priority)
Repositions an item already in the queue.
[more]priority_t getPriority(const object &obj) const
Returns the priority of an enqueued item.
[more]bool isEnqueued(const object &obj) const
Returns true if the item has been enqueued, false otherwise
[more]priority_t minPriority() const
Returns the minimum priority.
[more]inline unsigned getSize() const
Returns the number of items in the queue
[more] ~pqueue()
Destructor.


Inherited from object:

Public Methods

ovirtual bool operator==(const object &obj) const
ovirtual bool operator!=(const object &obj) const
ovirtual unsigned int hashcode() const
ovirtual object* clone() const


Documentation

A priority queue, implemented as a binary heap
ostatic const priority_t min_priority
Minimum allowable priority

o pqueue()
Creates a heap with initial capacity and incremental growth value

o pqueue(unsigned capacity, unsigned grow = DEFAULT_CONTAINER_GROWTH)

ovoid insert(object* obj, priority_t priority)
Inserts a new item into the queue. Inserting an object twice has undefined effects.

oobject* removeMinimum()
Removes the element at the front of the queue

ovoid adjust(const object &obj, priority_t new_priority)
Repositions an item already in the queue. Undefined if an item is not in the queue.

opriority_t getPriority(const object &obj) const
Returns the priority of an enqueued item. Undefined item item is not in the queue.

obool isEnqueued(const object &obj) const
Returns true if the item has been enqueued, false otherwise

opriority_t minPriority() const
Returns the minimum priority. Returns min_priority if the queue is empty.

oinline unsigned getSize() const
Returns the number of items in the queue

o ~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++.