16template <
class ValueT,
class KeyT >
39 this->maxLength = max ;
40 this->queueLength = 0 ;
41 this->valueQueue =
new ValueT* [ max ] ;
42 this->keyQueue =
new KeyT [ max ] ;
72 return ( this->queueLength == 0 ) ;
80 return ( this->queueLength == this->maxLength ) ;
86 void add ( ValueT * v, KeyT k )
90 printf(
"PRIORITY QUEUE FILLED UP !!! \n");
100 tind = ( ind + 1 ) / 2 - 1 ;
141 int ind = 0, tind, ind2, ind3 ;
144 ind2 = 2 * ( ind + 1 ) - 1 ;
Template class for a priority queue.
int queueLength
Number of elements in queue.
~PriorityQueue()
Destructor.
void remove(ValueT *&v, KeyT &k)
Remove an element.
PriorityQueue(int max)
Constructor.
void add(ValueT *v, KeyT k)
Add an element.
ValueT ** valueQueue
Queue of elements.
bool isFull()
Test whether full.
int getLength()
Get current length.
KeyT * keyQueue
Queue of keys.
int maxLength
Maximum number of elements int he queue.
bool isEmpty()
Test whether empty.