#include <prtqueue.h>
Public Member Functions | |
PriorityQueue (void) | |
PriorityQueue (const PriorityQueue< PrtType, DataType > &q) | |
~PriorityQueue () | |
virtual DataType & | first (void) throw (EmptyCollectionException) |
virtual const DataType & | first (void) const throw (EmptyCollectionException) |
virtual DataType & | last (void) throw (EmptyCollectionException) |
virtual const DataType & | last (void) const throw (EmptyCollectionException) |
DataType & | first (const PrtType &p) throw (MissingPriorityException) |
const DataType & | first (const PrtType &p) const throw (MissingPriorityException) |
DataType & | last (const PrtType &p) throw (MissingPriorityException) |
const DataType & | last (const PrtType &p) const throw (MissingPriorityException) |
bool | hasPriority (const PrtType &prt) |
virtual bool | isEmpty (void) const |
virtual unsigned int | size (void) const |
virtual AbstractIterator < DataType > * | iteratorPtr (void) const |
PriorityQueue< PrtType, DataType >::Iterator | iterator (void) const |
void | enque (const PrtType &prt, const DataType &data) |
void | deque (void) |
void | purge (void) |
void | operator= (const PriorityQueue< PrtType, DataType > &map) |
Classes | |
class | Iterator |
PrtType
denotes the type of the queue priorities, and the template parameter DataType
denotes the type of the data elements in the queue.
It is assumed that lesser the value of the PrtType
variable, higher is the priority assigned to the corresponding data element.
seal::PriorityQueue< PrtType, DataType >::PriorityQueue | ( | void | ) | [inline] |
Constructor. Creates an empty queue.
seal::PriorityQueue< PrtType, DataType >::PriorityQueue | ( | const PriorityQueue< PrtType, DataType > & | q | ) | [inline] |
Copy constructor. The old and the new queue objects will share the same data elements.
seal::PriorityQueue< PrtType, DataType >::~PriorityQueue | ( | ) | [inline] |
Destructor.
DataType & seal::PriorityQueue< PrtType, DataType >::first | ( | void | ) | throw (EmptyCollectionException) [inline, virtual] |
Returns a reference to the first element in the queue. Throws an seal::EmptyCollectionException
if the queue is empty.
Implements seal::Collection< DataType >.
const DataType & seal::PriorityQueue< PrtType, DataType >::first | ( | void | ) | const throw (EmptyCollectionException) [inline, virtual] |
Returns a constant reference to the first element in the queue. Throws an seal::EmptyCollectionException
if the queue is empty.
Implements seal::Collection< DataType >.
DataType & seal::PriorityQueue< PrtType, DataType >::last | ( | void | ) | throw (EmptyCollectionException) [inline, virtual] |
Returns a reference to the last element in the queue. Throws an seal::EmptyCollectionException
if the queue is empty.
Implements seal::Collection< DataType >.
const DataType & seal::PriorityQueue< PrtType, DataType >::last | ( | void | ) | const throw (EmptyCollectionException) [inline, virtual] |
Returns a constant reference to the last element in the queue. Throws an seal::EmptyCollectionException
if the queue is empty.
Implements seal::Collection< DataType >.
DataType & seal::PriorityQueue< PrtType, DataType >::first | ( | const PrtType & | p | ) | throw (MissingPriorityException) [inline] |
Returns a reference to the first element in the queue with the specified priority. Throws a seal::MissingPriorityException
if the priority is absent.
const DataType & seal::PriorityQueue< PrtType, DataType >::first | ( | const PrtType & | p | ) | const throw (MissingPriorityException) [inline] |
Returns a constant reference to the first element in the queue with the specified priority. Throws a seal::MissingPriorityException
if the priority is absent.
DataType & seal::PriorityQueue< PrtType, DataType >::last | ( | const PrtType & | p | ) | throw (MissingPriorityException) [inline] |
Returns a reference to the last element in the queue with the specified priority. Throws a seal::MissingPriorityException
if the priority is absent.
const DataType & seal::PriorityQueue< PrtType, DataType >::last | ( | const PrtType & | p | ) | const throw (MissingPriorityException) [inline] |
Returns a constant reference to the last element in the queue with the specified priority. Throws a seal::MissingPriorityException
if the priority is absent.
bool seal::PriorityQueue< PrtType, DataType >::hasPriority | ( | const PrtType & | prt | ) | [inline] |
Returns true if there exists atleast one element with the specified priority; Returns false otherwise.
virtual bool seal::PriorityQueue< PrtType, DataType >::isEmpty | ( | void | ) | const [inline, virtual] |
Returns true is the queue is empty; False otherwise.
Implements seal::Collection< DataType >.
virtual unsigned int seal::PriorityQueue< PrtType, DataType >::size | ( | void | ) | const [inline, virtual] |
Returns the size (i.e. the number of elements in the queue) of the queue.
Implements seal::Collection< DataType >.
virtual AbstractIterator<DataType>* seal::PriorityQueue< PrtType, DataType >::iteratorPtr | ( | void | ) | const [inline, virtual] |
Returns a pointer to an iterator object of the priority queue. The client of this function is responsible to delete the returned iterator object using delete
.
Implements seal::Collection< DataType >.
PriorityQueue<PrtType, DataType>::Iterator seal::PriorityQueue< PrtType, DataType >::iterator | ( | void | ) | const [inline] |
Returns an iterator object of the priority queue.
void seal::PriorityQueue< PrtType, DataType >::enque | ( | const PrtType & | prt, | |
const DataType & | data | |||
) | [inline] |
Adds an element into the queue at the appriorate location indicated by the priority. Lesser the value of the argument prt
, higher will be the priority assigned to the data element.
prt | The priority of the new data element to be added into the queue. | |
data | The data element which is to be added into the queue. |
void seal::PriorityQueue< PrtType, DataType >::deque | ( | void | ) | [inline] |
Removes the first element from the queue.
void seal::PriorityQueue< PrtType, DataType >::purge | ( | void | ) | [inline, virtual] |
Removes all the elements from the queue. The size of the queue will be zero after a call to this function.
Implements seal::Collection< DataType >.
void seal::PriorityQueue< PrtType, DataType >::operator= | ( | const PriorityQueue< PrtType, DataType > & | map | ) | [inline] |
Assignment operator. The LHS object and the RHS object both share the data of the RHS object after the assignment operation.