- A Logic Circuit Simulation Library in C++





lcs::PriorityQueue< T, Order > Class Template Reference

#include <queue.h>

Inheritance diagram for lcs::PriorityQueue< T, Order >:

lcs::Queue< T > List of all members.

Detailed Description

template<typename T, SortOrder Order>
class lcs::PriorityQueue< T, Order >

This is a class which encapsulates a priority queue. An element can be queued up at the right place in the queue using a key value. Since the supported key values are integers, a higher value can have a higher priority or a lower priority. A user of this class can select the desired way using the template argument Order. This argument can either 1. take a value lcs::ASCENDING to indicate that lower key values have higher priority, or 2. take a value lcs::DESCENDING to indicate that higher key values have higher priority.

This class is inherited from the class lcs::Queue through protected inheritance. However, it supports all the member functions as in the class lcs::Queue.


Public Member Functions

void enQueue (T e, int key)
void removeLower (int key)


Member Function Documentation

template<typename T, SortOrder Order>
void lcs::PriorityQueue< T, Order >::enQueue ( e,
int  key 
)

Adds an element into the queue based on the priority indicated by the key argument.

Parameters:
e The element to be added into the queue.
key The key which indicates the priority.

template<typename T, SortOrder Order>
void lcs::PriorityQueue< T, Order >::removeLower ( int  key  ) 

Removes elements from the queue which have a priority equal and less than the one indicated by the key argument.

Parameters:
key Elements in the queue having lesser or equal priority than that indicated by this argument will be removed from the queue.


Copyright © 2006, 2007 Siva Chandra