seal::PriorityQueue< PrtType, DataType > Class Template Reference

#include <prtqueue.h>

Inheritance diagram for seal::PriorityQueue< PrtType, DataType >:

seal::Collection< DataType >

List of all members.

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


Detailed Description

template<typename PrtType, typename DataType>
class seal::PriorityQueue< PrtType, DataType >

This template class encapsulates a priorty queue. The template parameter 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.


Constructor & Destructor Documentation

template<typename PrtType, typename DataType>
seal::PriorityQueue< PrtType, DataType >::PriorityQueue ( void   )  [inline]

Constructor. Creates an empty queue.

template<typename PrtType, typename DataType>
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.

template<typename PrtType, typename DataType>
seal::PriorityQueue< PrtType, DataType >::~PriorityQueue (  )  [inline]

Destructor.


Member Function Documentation

template<typename PrtType, typename DataType>
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 >.

template<typename PrtType, typename 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 >.

template<typename PrtType, typename 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 >.

template<typename PrtType, typename 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 >.

template<typename PrtType, typename 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.

template<typename PrtType, typename DataType>
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.

template<typename PrtType, typename DataType>
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.

template<typename PrtType, typename DataType>
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.

template<typename PrtType, typename DataType>
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.

template<typename PrtType, typename DataType>
virtual bool seal::PriorityQueue< PrtType, DataType >::isEmpty ( void   )  const [inline, virtual]

Returns true is the queue is empty; False otherwise.

Implements seal::Collection< DataType >.

template<typename PrtType, typename 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 >.

template<typename PrtType, typename 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 >.

template<typename PrtType, typename DataType>
PriorityQueue<PrtType, DataType>::Iterator seal::PriorityQueue< PrtType, DataType >::iterator ( void   )  const [inline]

Returns an iterator object of the priority queue.

template<typename PrtType, typename DataType>
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.

Parameters:
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.

template<typename PrtType, typename DataType>
void seal::PriorityQueue< PrtType, DataType >::deque ( void   )  [inline]

Removes the first element from the queue.

template<typename PrtType, typename DataType>
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 >.

template<typename PrtType, typename 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.


The documentation for this class was generated from the following file:

Generated on Sat May 16 21:35:20 2009 for SEAL by  doxygen 1.5.5