cppcore
A small, portable C++ core library
Loading...
Searching...
No Matches
cppcore::TQueue< T, TAlloc > Class Template Reference

This template class implements a simple queue ( works FIFO ). More...

#include <TQueue.h>

Public Member Functions

 TQueue () noexcept=default
 The default class constructor.
 TQueue (const TQueue< T, TAlloc > &rhs)
 The class copy constructor.
 ~TQueue ()
 The destructor.
void enqueue (const T &item)
 A new item will be enqueued.
bool dequeue (T &item)
 Tries to dequeue the next item from the queue.
T front ()
 Returns the first item of the queue.
bool isEmpty () const
 Returns true, if the queue is empty.
size_t size ()
 The number of enqueued items will be returned.
void clear ()
 The queue will be cleared.
TQueue< T, TAlloc > & operator= (const TQueue< T, TAlloc > &rhs)
 The assignment operator.
bool operator== (const TQueue< T, TAlloc > &rhs) const
 The compare operator.

Detailed Description

template<class T, class TAlloc = TDefaultAllocator<T>>
class cppcore::TQueue< T, TAlloc >

This template class implements a simple queue ( works FIFO ).

Definition at line 37 of file TQueue.h.

Constructor & Destructor Documentation

◆ TQueue() [1/2]

template<class T, class TAlloc = TDefaultAllocator<T>>
cppcore::TQueue< T, TAlloc >::TQueue ( )
defaultnoexcept

The default class constructor.

References clear(), dequeue(), enqueue(), front(), isEmpty(), size(), and TQueue().

Referenced by operator=(), operator==(), TQueue(), and TQueue().

◆ TQueue() [2/2]

template<class T, class TAlloc>
cppcore::TQueue< T, TAlloc >::TQueue ( const TQueue< T, TAlloc > & rhs)
inline

The class copy constructor.

Parameters
rhs[in] The instance to copy from.

Definition at line 85 of file TQueue.h.

References TQueue().

◆ ~TQueue()

template<class T, class TAlloc>
cppcore::TQueue< T, TAlloc >::~TQueue ( )
inline

The destructor.

Definition at line 91 of file TQueue.h.

References clear().

Member Function Documentation

◆ clear()

template<class T, class TAlloc>
void cppcore::TQueue< T, TAlloc >::clear ( )
inline

The queue will be cleared.

Definition at line 127 of file TQueue.h.

Referenced by TQueue(), and ~TQueue().

◆ dequeue()

template<class T, class TAlloc>
bool cppcore::TQueue< T, TAlloc >::dequeue ( T & item)
inline

Tries to dequeue the next item from the queue.

If no more items are there, false will be returned. If the queue is empty, this will fail.

Parameters
item[ out ] The next item, if true was returned.
Returns
true, if an item was dequeued correctly, false if the queue was already empty.

Definition at line 101 of file TQueue.h.

References isEmpty().

Referenced by TQueue().

◆ enqueue()

template<class T, class TAlloc>
void cppcore::TQueue< T, TAlloc >::enqueue ( const T & item)
inline

A new item will be enqueued.

Parameters
item[in] The item to enqueue.

Definition at line 96 of file TQueue.h.

Referenced by TQueue().

◆ front()

template<class T, class TAlloc>
T cppcore::TQueue< T, TAlloc >::front ( )
inline

Returns the first item of the queue.

Returns
The first item.

Definition at line 112 of file TQueue.h.

Referenced by TQueue().

◆ isEmpty()

template<class T, class TAlloc>
bool cppcore::TQueue< T, TAlloc >::isEmpty ( ) const
inline

Returns true, if the queue is empty.

Returns
true, if the queue is empty, false if not.

Definition at line 117 of file TQueue.h.

Referenced by dequeue(), and TQueue().

◆ operator=()

template<class T, class TAlloc>
TQueue< T, TAlloc > & cppcore::TQueue< T, TAlloc >::operator= ( const TQueue< T, TAlloc > & rhs)
inline

The assignment operator.

Definition at line 132 of file TQueue.h.

References TQueue().

◆ operator==()

template<class T, class TAlloc>
bool cppcore::TQueue< T, TAlloc >::operator== ( const TQueue< T, TAlloc > & rhs) const
inline

The compare operator.

Definition at line 143 of file TQueue.h.

References TQueue().

◆ size()

template<class T, class TAlloc>
size_t cppcore::TQueue< T, TAlloc >::size ( )
inline

The number of enqueued items will be returned.

Returns
The number of enqueued items.

Definition at line 122 of file TQueue.h.

Referenced by TQueue().


The documentation for this class was generated from the following file: