A pointer based FIFO style Queue.
This is a basic single linked FIFO queue structure. All items in the queue must implement the QueueItem interface.
In theory you can add different types into the queue, as long as they all inherit QueueItem. However, you should not do this. Mixing different types in the queue, removes type information - such that the objects original type can not be restored later.
Best practice is therefore to use only one type in the queue. To help with this you should really use the GenericQueue class. This class uses C++ templating to keep type information and you do not need to manual type casting.
Construct an empty queue.
Add a new element to the back of the queue Insert a pointer to an element on the back of the queue.
Get the next element in the queue, after the one you provide.
NOTE: There is no check if the item belongs in the parent queue at all!
- The next element in the queue, after the item you provided.
A pointer to an item in the queue
Check that an object already exists in the queue. Because of the stack based nature of this queue, all objects can only exist one replace in the queue. You cannot add the same object to two different positions in the queue.
The element to search for in the queue
Return the length of the queue.
The length is the number of item currently present in the queue.
This method runs in O(n) (linear time)