nlib
nn::nlib::ReallocQueue< T > Class Template Reference

The class for realloc-based implementations of queues with POD-type elements. More...

#include "nn/nlib/ReallocVec.h"

Public Types

typedef ReallocVec< T >::ReallocFunc ReallocFunc
 The type for functions corresponding to realloc.
 

Public Member Functions

ReallocFunc GetRealloc () const noexcept
 Gets the specified realloc function. More...
 
size_t size () const noexcept
 Gets the size of the queue. More...
 
bool empty () const noexcept
 Determines whether the queue is empty. More...
 
bool push (const T &val) noexcept
 Adds an element to the queue. More...
 
bool pop () noexcept
 Deletes the first element in the queue. More...
 
T & front ()
 Gets the first element in the queue. More...
 
bool pop (T *v) noexcept
 Gets the first element in the queue and then deletes it. More...
 
Constructor, Destructor, and Initialization
 ReallocQueue () noexcept
 Instantiates the object with default parameters (default constructor). Uses std::realloc.
 
 ReallocQueue (ReallocFunc func) noexcept
 Enables the user to specify the realloc function with the constructor. More...
 
 ReallocQueue (ReallocQueue &&rhs) noexcept
 Instantiates the object (move constructor).
 
ReallocQueueoperator= (ReallocQueue &&rhs) noexcept
 Move assignment operator.
 

Detailed Description

template<class T>
class nn::nlib::ReallocQueue< T >

The class for realloc-based implementations of queues with POD-type elements.

Template Parameters
TThe element type. This type must be POD.
Description
T must be aligned to an alignment guaranteed by realloc.

Definition at line 200 of file ReallocVec.h.

Constructor & Destructor Documentation

◆ ReallocQueue()

template<class T >
nn::nlib::ReallocQueue< T >::ReallocQueue ( ReallocFunc  func)
inlineexplicitnoexcept

Enables the user to specify the realloc function with the constructor.

Parameters
[in]funcThe realloc function.

Definition at line 204 of file ReallocVec.h.

Member Function Documentation

◆ empty()

template<class T >
nn::nlib::ReallocQueue< T >::empty ( ) const
inlinenoexcept

Determines whether the queue is empty.

Returns
Returns true if empty.

Definition at line 237 of file ReallocVec.h.

◆ front()

template<class T >
nn::nlib::ReallocQueue< T >::front ( )
inline

Gets the first element in the queue.

Returns
The reference to the first element in the queue.

Definition at line 252 of file ReallocVec.h.

◆ GetRealloc()

template<class T >
nn::nlib::ReallocQueue< T >::GetRealloc ( ) const
inlinenoexcept

Gets the specified realloc function.

Returns
The realloc function.

Definition at line 235 of file ReallocVec.h.

◆ pop() [1/2]

template<class T >
nn::nlib::ReallocQueue< T >::pop ( )
inlinenoexcept

Deletes the first element in the queue.

Returns
Returns true when successful.

Definition at line 241 of file ReallocVec.h.

◆ pop() [2/2]

template<class T >
nn::nlib::ReallocQueue< T >::pop ( T *  v)
inlinenoexcept

Gets the first element in the queue and then deletes it.

Parameters
[in]vThe pointer to where the first element in the queue is stored.
Returns
Returns true when successful.

Definition at line 262 of file ReallocVec.h.

◆ push()

template<class T >
nn::nlib::ReallocQueue< T >::push ( const T &  val)
inlinenoexcept

Adds an element to the queue.

Parameters
[in]valThe element to add.
Returns
Returns true when successful.

Definition at line 240 of file ReallocVec.h.

◆ size()

template<class T >
nn::nlib::ReallocQueue< T >::size ( ) const
inlinenoexcept

Gets the size of the queue.

Returns
The size of the queue.

Definition at line 236 of file ReallocVec.h.


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