This class models a linear structure called a Queue. More...
#include <Queue.h>
Public Member Functions | |
Queue () | |
Initializes a new empty queue. More... | |
virtual | ~Queue ()=default |
Frees any heap storage associated with this queue. More... | |
void | clear () |
Removes all elements from the queue. More... | |
int | size () const |
bool | isEmpty () const |
void | enqueue (const ValueType &value) |
Adds value to the end of the queue. More... | |
ValueType | dequeue () |
Removes and returns the first item in the queue. More... | |
ValueType | peek () const |
ValueType & | getFront () |
ValueType & | getBack () |
Private Member Functions | |
void | expandRingBufferCapacity () |
This private method doubles the capacity of the ringBuffer vector. More... | |
Private Attributes | |
std::vector< ValueType > | ringBuffer |
Vector of ValueType for Circular Queue. More... | |
int | front |
index to front of the queue More... | |
int | rear |
index to rear of the queue More... | |
int | count |
number of value in the queue More... | |
int | capacity |
capacity of the queue More... | |
This class models a linear structure called a Queue.
In queue ,values are added at one end and removed from the other. This discipline gives rise to a first-in/first-out behavior (FIFO).
Frees any heap storage associated with this queue.
void Queue< ValueType >::clear |
ValueType Queue< ValueType >::dequeue |
void Queue< ValueType >::enqueue | ( | const ValueType & | value | ) |
|
private |
ValueType & Queue< ValueType >::getBack |
ValueType & Queue< ValueType >::getFront |
bool Queue< ValueType >::isEmpty |
ValueType Queue< ValueType >::peek |
int Queue< ValueType >::size |
|
private |
|
private |
|
private |
|
private |