Kicking it Olde Sküül! Burgerlib on Github Follow Olde Sküül on Twitter Burgerbecky on LinkedIn Burgerbecky on LinkedIn
Loading...
Searching...
No Matches
Classes | Public Member Functions | Private Attributes | List of all members
Burger::Queue< T > Class Template Reference

A simple first in first out queue. More...

Collaboration diagram for Burger::Queue< T >:
Collaboration graph
[legend]

Classes

struct  Element
 A single data chunk in the queue. More...
 

Public Member Functions

 Queue ()
 Initialize to defaults.
 
 ~Queue ()
 Dispose of all data remaining in the Queue.
 
void clear (void)
 Dispose of all data in the Queue.
 
const Tback (void) const
 Get a reference to the last element in the list.
 
Tback (void)
 Get a reference to the last element in the list.
 
const Tfront (void) const
 Get a reference to the first element in the list.
 
Tfront (void)
 Get a reference to the first element in the list.
 
void pop (void)
 Remove the first element in the list.
 
void push (const T &rData)
 Insert data at the end of the list.
 
uintptr_t size (void) const
 Get the number of entries in the queue.
 
uint_t empty (void) const
 Returns TRUE if the queue is empty.
 

Private Attributes

Elementm_pFirstElement
 Pointer to the first element in the linked list.
 
Elementm_pLastElement
 Pointer to the last element in the linked list.
 
uintptr_t m_uCount
 Number of entries in the linked list.
 

Detailed Description

template<class T>
class Burger::Queue< T >

A simple first in first out queue.


This class will put data into a singly linked list and insert at the end and extract from the beginning.

See also
RunQueue

Constructor & Destructor Documentation

◆ Queue()

template<class T >
Burger::Queue< T >::Queue ( )
inline

Initialize to defaults.


Creates an empty queue

See also
clear(void)

◆ ~Queue()

template<class T >
Burger::Queue< T >::~Queue ( )
inline

Dispose of all data remaining in the Queue.


Frees all data

See also
clear(void)

Member Function Documentation

◆ back() [1/2]

template<class T >
T & Burger::Queue< T >::back ( void )
inline

Get a reference to the last element in the list.


This will return a reference to the last entry in the list.

Note
It will crash if there is no data in the list. Call size(void) const or empty(void) const to determine if there is valid data to access.
Returns
A reference to the data at the end of the list.
See also
front(void), back(void) const, size(void) const or empty(void) const

◆ back() [2/2]

template<class T >
const T & Burger::Queue< T >::back ( void ) const
inline

Get a reference to the last element in the list.


This will return a reference to the last entry in the list.

Note
It will crash if there is no data in the list. Call size(void) const or empty(void) const to determine if there is valid data to access.
Returns
A constant reference to the data at the end of the list.
See also
front(void) const, back(void), size(void) const or empty(void) const

◆ clear()

template<class T >
void Burger::Queue< T >::clear ( void )
inline

Dispose of all data in the Queue.


Frees all data and clears out the queue. The queue is still valid, only empty.

See also
clear(void), size(void) const or empty(void) const

◆ empty()

template<class T >
uint_t Burger::Queue< T >::empty ( void ) const
inline

Returns TRUE if the queue is empty.


Returns
TRUE if there is no data in the queue.
See also
size(void) const or clear(void)

◆ front() [1/2]

template<class T >
T & Burger::Queue< T >::front ( void )
inline

Get a reference to the first element in the list.


This will return a reference to the first entry in the list.

Note
It will crash if there is no data in the list. Call size(void) const or empty(void) const to determine if there is valid data to access.
Returns
A reference to the data at the front of the list.
See also
back(void), front(void) const, size(void) const or empty(void) const

◆ front() [2/2]

template<class T >
const T & Burger::Queue< T >::front ( void ) const
inline

Get a reference to the first element in the list.


This will return a reference to the first entry in the list.

Note
It will crash if there is no data in the list. Call size(void) const or empty(void) const to determine if there is valid data to access.
Returns
A constant reference to the data at the front of the list.
See also
back(void) const, front(void), size(void) const or empty(void) const

◆ pop()

template<class T >
void Burger::Queue< T >::pop ( void )
inline

Remove the first element in the list.


This will dispose of the first entry in the list.

Note
It will crash if there is no data in the list. Call size(void) const or empty(void) const to determine if there is valid data to access.
See also
push(const T &), size(void) const or empty(void) const

◆ push()

template<class T >
void Burger::Queue< T >::push ( const T & rData)
inline

Insert data at the end of the list.


Allocate memory for a new entry and place it at the end of linked list.

Parameters
rDataReference to a data chunk to copy into the queue
See also
pop(void), front(void) const or back(void) const

◆ size()

template<class T >
uintptr_t Burger::Queue< T >::size ( void ) const
inline

Get the number of entries in the queue.


Returns
The number of entries remaining in the queue.
See also
empty(void) const or clear(void)

Member Data Documentation

◆ m_pFirstElement

template<class T >
Element* Burger::Queue< T >::m_pFirstElement
private

Pointer to the first element in the linked list.

◆ m_pLastElement

template<class T >
Element* Burger::Queue< T >::m_pLastElement
private

Pointer to the last element in the linked list.

◆ m_uCount

template<class T >
uintptr_t Burger::Queue< T >::m_uCount
private

Number of entries in the linked list.