![]() |
semf
|
LinkedQueue is an managed single linked queue implementation. More...
#include <linkedqueue.h>
Classes | |
class | ConstIterator |
Implementation of a forward constant iterator for LinkedQueue . More... | |
class | Iterator |
Implementation of a forward iterator for LinkedQueue . More... | |
class | Node |
Implements the next() functionality for every element in a queue. More... | |
Public Member Functions | |
T & | front () |
Returns a reference to the first element in the queue. More... | |
const T & | front () const |
Returns a reference to the first element in the queue. More... | |
T & | back () |
Returns a reference to the last element in the queue. More... | |
const T & | back () const |
Returns a reference to the last element in the queue. More... | |
Iterator | begin () |
Returns an iterator pointing to the first element in the queue. More... | |
ConstIterator | begin () const |
Returns an iterator pointing to the first element in the queue. More... | |
ConstIterator | cbegin () const |
Returns an iterator pointing to the first element in the queue. More... | |
Iterator | end () |
Returns an iterator referring to the past-the-end element in the queue. More... | |
ConstIterator | end () const |
Returns an iterator referring to the past-the-end element in the queue. More... | |
ConstIterator | cend () const |
Returns an iterator referring to the past-the-end element in the queue. More... | |
bool | empty () const |
Returns whether the queue is empty (i.e. whether its size is 0). More... | |
size_t | size () const |
Returns the number of elements in the queue. More... | |
void | push (T &element) |
Adds a new element to the end of the queue, after its current last element. More... | |
void | pop () |
Removes the first element in the queue, effectively reducing the queue size by one. More... | |
LinkedQueue< T > & | operator= (const LinkedQueue< T > &queue) |
Assigns new contents to the queue, replacing its current contents, and modifying its size accordingly. More... | |
LinkedQueue is an managed single linked queue implementation.
It is similar to std::queue, but works without dynamic storage allocation. Every element in the queue has to inherit from LinkedQueue::Node
and in case has the information of the next()
node.
The LinkedQueue class is a list that gives the programmer the functionality of a queue - specifically, a FIFO (first-in, first-out) data organization.
T | class type inherits from LinkedQueue::Node |
Definition at line 37 of file linkedqueue.h.
T & semf::LinkedQueue< T >::back |
Returns a reference to the last element in the queue.
This is the most recently pushed element. Calling this function on a not existing element causes undefined behavior.
Definition at line 423 of file linkedqueue.h.
const T & semf::LinkedQueue< T >::back |
Returns a reference to the last element in the queue.
This is the most recently pushed element. Calling this function on a not existing element causes undefined behavior.
Definition at line 429 of file linkedqueue.h.
LinkedQueue< T >::Iterator semf::LinkedQueue< T >::begin |
Returns an iterator pointing to the first element in the queue.
Definition at line 435 of file linkedqueue.h.
LinkedQueue< T >::ConstIterator semf::LinkedQueue< T >::begin |
Returns an iterator pointing to the first element in the queue.
Definition at line 441 of file linkedqueue.h.
LinkedQueue< T >::ConstIterator semf::LinkedQueue< T >::cbegin |
Returns an iterator pointing to the first element in the queue.
Definition at line 447 of file linkedqueue.h.
LinkedQueue< T >::ConstIterator semf::LinkedQueue< T >::cend |
Returns an iterator referring to the past-the-end element in the queue.
The past-the-end element is the theoretical element that would follow the last element in the queue. It does not point to any element, and thus shall not be dereferenced. This function is often used in combination with LinkedQueue::begin to specify a range including all the elements in the range. If LinkedQueue is empty, this function returns the same as LinkedQueue::begin.
Definition at line 465 of file linkedqueue.h.
bool semf::LinkedQueue< T >::empty |
Returns whether the queue is empty (i.e. whether its size is 0).
This function does not modify the queue in any way.
true
if the queue size is 0, false
otherwise. Definition at line 471 of file linkedqueue.h.
LinkedQueue< T >::Iterator semf::LinkedQueue< T >::end |
Returns an iterator referring to the past-the-end element in the queue.
The past-the-end element is the theoretical element that would follow the last element in the queue. It does not point to any element, and thus shall not be dereferenced. This function is often used in combination with LinkedQueue::begin to specify a range including all the elements in the range. If LinkedQueue is empty, this function returns the same as LinkedQueue::begin.
Definition at line 453 of file linkedqueue.h.
LinkedQueue< T >::ConstIterator semf::LinkedQueue< T >::end |
Returns an iterator referring to the past-the-end element in the queue.
The past-the-end element is the theoretical element that would follow the last element in the queue. It does not point to any element, and thus shall not be dereferenced. This function is often used in combination with LinkedQueue::begin to specify a range including all the elements in the range. If LinkedQueue is empty, this function returns the same as LinkedQueue::begin.
Definition at line 459 of file linkedqueue.h.
T & semf::LinkedQueue< T >::front |
Returns a reference to the first element in the queue.
This element will be the first element to be removed on a call to pop()
. Calling this function on a not existing element causes undefined behavior.
Definition at line 411 of file linkedqueue.h.
const T & semf::LinkedQueue< T >::front |
Returns a reference to the first element in the queue.
This element will be the first element to be removed on a call to pop()
. Calling this function on a not existing element causes undefined behavior.
Definition at line 417 of file linkedqueue.h.
LinkedQueue< T > & semf::LinkedQueue< T >::operator= | ( | const LinkedQueue< T > & | queue | ) |
Assigns new contents to the queue, replacing its current contents, and modifying its size accordingly.
queue | A queue object of the same type (i.e., with the same template parameter). |
Definition at line 521 of file linkedqueue.h.
void semf::LinkedQueue< T >::pop |
Removes the first element in the queue, effectively reducing the queue size by one.
Definition at line 505 of file linkedqueue.h.
void semf::LinkedQueue< T >::push | ( | T & | element | ) |
Adds a new element to the end of the queue, after its current last element.
The content of element is moved into the queue. This effectively increases the queue size by one.
element | Element to add to the end of the queue. |
Definition at line 483 of file linkedqueue.h.
size_t semf::LinkedQueue< T >::size |
Returns the number of elements in the queue.
Definition at line 477 of file linkedqueue.h.