queue< Kind > Class Template Reference

`#include <queue.h>`

## Public Member Functions

void | display ()
| queue ()
| ~queue ()
bool | isEmptyQueue ()
void | enQueue (Kind item)
Kind | front ()
void | deQueue ()
void | clear ()

## Private Attributes

node< Kind > * | queueFront
node< Kind > * | queueRear
int | size

## Detailed Description

### template<class Kind>
class queue< Kind >

Definition of the queue class

## Constructor & Destructor Documentation

## queue()

template<class Kind >

queue< Kind >::queue | ( |  | ) |

inline

Default constructor

{
queueFront = NULL;
queueRear = NULL;
size = 0;
}
queue::queueFront
node< Kind > * queueFront
Definition: queue.h:83
queue::queueRear
node< Kind > * queueRear
Definition: queue.h:84

## ~queue()

template<class Kind >

queue< Kind >::~queue | ( |  | ) |

inline

Destructor

{}

## Member Function Documentation

## clear()

template<class Kind >

void queue< Kind >::clear | ( |  | ) |

inline

Clear queue

{ queueFront = NULL; }

## deQueue()

template<class Kind >

void queue< Kind >::deQueue | ( |  | ) |

inline

Remove the top element of the queue

{
node<Kind> *temp;
if (!isEmptyQueue()) {
temp = queueFront;
queueFront = queueFront->next;
delete temp;
size--;
} else {
std::cout << "Queue is empty !" << std::endl;
}
}
std::cout
queue::isEmptyQueue
bool isEmptyQueue()
Definition: queue.h:42
std::endl
T endl(T... args)
node
Definition: avltree.cpp:13
Here is the call graph for this function:

## display()

template<class Kind >

void queue< Kind >::display | ( |  | ) |

inline

Show queue

{
node<Kind> *current = queueFront;
std::cout << "Front --> ";
while (current != NULL) {
std::cout << current->data << " ";
current = current->next;
}
std::cout << std::endl;
std::cout << "Size of queue: " << size << std::endl;
}
Here is the call graph for this function:

## enQueue()

template<class Kind >

void queue< Kind >::enQueue | ( | Kind | item | ) |

inline

Add new item to the queue

{
node<Kind> *newNode;
newNode = new node<Kind>;
newNode->data = item;
newNode->next = NULL;
if (queueFront == NULL) {
queueFront = newNode;
queueRear = newNode;
} else {
queueRear->next = newNode;
queueRear = queueRear->next;
}
size++;
}

## front()

template<class Kind >

Kind queue< Kind >::front | ( |  | ) |

inline

Return the first element of the queue

{
assert(queueFront != NULL);
return queueFront->data;
}

## isEmptyQueue()

template<class Kind >

bool queue< Kind >::isEmptyQueue | ( |  | ) |

inline

Determine whether the queue is empty

{ return (queueFront == NULL); }

## Member Data Documentation

## queueFront

template<class Kind >

node<Kind>* queue< Kind >::queueFront

private

Pointer to the front of the queue

## queueRear

template<class Kind >

node<Kind>* queue< Kind >::queueRear

private

Pointer to the rear of the queue

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

- data_structures/queue.h