#include <Queue.h>
Public Member Functions | |
| Queue (int size=DEFAULT_PAGE_SIZE, int PageSize=DEFAULT_PAGE_SIZE) | |
| Constructor. PageSize is the chunks of memory allocated at run-time as needed. Size is just the inital queuesize if wanted. | |
| ~Queue () | |
| Destructor. | |
| Type | Enqueue (Type newData) |
| Add an element into the back of the queue. | |
| Type | Dequeue () |
| Remove an element from the front and return it. Returns the first element (even if garbage) if out of bounds or empty. | |
| int | GetSize () |
| Returns the current size. | |
| bool | IsEmpty () |
| Returns true if empty (No elements). | |
Private Attributes | |
| List< Type > | data |
| Data. | |
| int | front |
| Front queue index. | |
| int | back |
| Back queue index. | |
| int | count |
| The number of elements of the queue. | |
| int | pageSize |
| The size of a page of memory in the list (in elements). | |
Static Private Attributes | |
| static const int | DEFAULT_PAGE_SIZE = 16 |
| Define the default page size. | |
| Queue< Type >::Queue | ( | int | size = DEFAULT_PAGE_SIZE, |
|
| int | PageSize = DEFAULT_PAGE_SIZE | |||
| ) | [inline] |
Constructor. PageSize is the chunks of memory allocated at run-time as needed. Size is just the inital queuesize if wanted.
| Type Queue< Type >::Enqueue | ( | Type | newData | ) | [inline] |
Add an element into the back of the queue.
| Type Queue< Type >::Dequeue | ( | ) | [inline] |
Remove an element from the front and return it. Returns the first element (even if garbage) if out of bounds or empty.
| int Queue< Type >::GetSize | ( | ) | [inline] |
Returns the current size.
| bool Queue< Type >::IsEmpty | ( | ) | [inline] |
Returns true if empty (No elements).
const int Queue< Type >::DEFAULT_PAGE_SIZE = 16 [static, private] |
Define the default page size.
The size of a page of memory in the list (in elements).
1.5.5