mn::container::basic_atomic_queue< T, TMAXITEMS > Class Template Reference

A basic lockfree atomic queue. More...

#include <mn_atomic_queue.hpp>

+ Collaboration diagram for mn::container::basic_atomic_queue< T, TMAXITEMS >:

Classes

struct  node
 

Public Types

using value_type = T
 
using reference = T &
 
using lreference = T &&
 
using pointer = node *
 
using const_value_type = const T
 
using const_reference = const T &
 
using self_type = basic_atomic_queue< T, TMAXITEMS >
 

Public Member Functions

 basic_atomic_queue ()
 
 basic_atomic_queue (const self_type &other)=delete
 
 basic_atomic_queue (const self_type &&other)=delete
 
bool push (reference _Element) noexcept
 Push a element to the queue. More...
 
pointer pop_all (void) noexcept
 
constexpr void clear () noexcept
 Clear the queue. More...
 
constexpr bool empty () noexcept
 Check, if queue is empty. More...
 
constexpr bool full () noexcept
 
constexpr mn::size_t length () noexcept
 How many items can queue. More...
 
constexpr mn::size_t size () noexcept
 
constexpr mn::size_t left () noexcept
 
void swap (const self_type &other)
 
self_typeoperator= (const self_type &other)
 

Protected Attributes

mn::_atomic< pointerm_atHead
 
mn::atomic_size_t m_curItems
 

Detailed Description

template<class T, mn::size_t TMAXITEMS>
class mn::container::basic_atomic_queue< T, TMAXITEMS >

A basic lockfree atomic queue.

Template Parameters
TThe type of an element
TMAXITEMSMaximal items can queue

Class Documentation

◆ mn::container::basic_atomic_queue::node

struct mn::container::basic_atomic_queue::node

template<class T, mn::size_t TMAXITEMS>
struct mn::container::basic_atomic_queue< T, TMAXITEMS >::node

+ Collaboration diagram for mn::container::basic_atomic_queue< T, TMAXITEMS >::node:
Class Members
T data
node * next

Member Typedef Documentation

◆ const_reference

template<class T , mn::size_t TMAXITEMS>
using mn::container::basic_atomic_queue< T, TMAXITEMS >::const_reference = const T&

◆ const_value_type

template<class T , mn::size_t TMAXITEMS>
using mn::container::basic_atomic_queue< T, TMAXITEMS >::const_value_type = const T

◆ lreference

template<class T , mn::size_t TMAXITEMS>
using mn::container::basic_atomic_queue< T, TMAXITEMS >::lreference = T&&

◆ pointer

template<class T , mn::size_t TMAXITEMS>
using mn::container::basic_atomic_queue< T, TMAXITEMS >::pointer = node*

◆ reference

template<class T , mn::size_t TMAXITEMS>
using mn::container::basic_atomic_queue< T, TMAXITEMS >::reference = T&

◆ self_type

template<class T , mn::size_t TMAXITEMS>
using mn::container::basic_atomic_queue< T, TMAXITEMS >::self_type = basic_atomic_queue<T, TMAXITEMS>

◆ value_type

template<class T , mn::size_t TMAXITEMS>
using mn::container::basic_atomic_queue< T, TMAXITEMS >::value_type = T

Constructor & Destructor Documentation

◆ basic_atomic_queue() [1/3]

template<class T , mn::size_t TMAXITEMS>
mn::container::basic_atomic_queue< T, TMAXITEMS >::basic_atomic_queue ( )
inline

◆ basic_atomic_queue() [2/3]

template<class T , mn::size_t TMAXITEMS>
mn::container::basic_atomic_queue< T, TMAXITEMS >::basic_atomic_queue ( const self_type other)
delete

◆ basic_atomic_queue() [3/3]

template<class T , mn::size_t TMAXITEMS>
mn::container::basic_atomic_queue< T, TMAXITEMS >::basic_atomic_queue ( const self_type &&  other)
delete

Member Function Documentation

◆ clear()

template<class T , mn::size_t TMAXITEMS>
constexpr void mn::container::basic_atomic_queue< T, TMAXITEMS >::clear ( )
inlineconstexprnoexcept

Clear the queue.

◆ empty()

template<class T , mn::size_t TMAXITEMS>
constexpr bool mn::container::basic_atomic_queue< T, TMAXITEMS >::empty ( )
inlineconstexprnoexcept

Check, if queue is empty.

Returns
true The queue is empty and false when not

◆ full()

template<class T , mn::size_t TMAXITEMS>
constexpr bool mn::container::basic_atomic_queue< T, TMAXITEMS >::full ( )
inlineconstexprnoexcept

◆ left()

template<class T , mn::size_t TMAXITEMS>
constexpr mn::size_t mn::container::basic_atomic_queue< T, TMAXITEMS >::left ( )
inlineconstexprnoexcept

How many empty spaves are currently left in the queue.

Returns
the number of remaining spaces.

◆ length()

template<class T , mn::size_t TMAXITEMS>
constexpr mn::size_t mn::container::basic_atomic_queue< T, TMAXITEMS >::length ( )
inlineconstexprnoexcept

How many items can queue.

Returns
The maximal number of entries can queue

◆ operator=()

template<class T , mn::size_t TMAXITEMS>
self_type& mn::container::basic_atomic_queue< T, TMAXITEMS >::operator= ( const self_type other)
inline

◆ pop_all()

template<class T , mn::size_t TMAXITEMS>
pointer mn::container::basic_atomic_queue< T, TMAXITEMS >::pop_all ( void  )
inlinenoexcept

◆ push()

template<class T , mn::size_t TMAXITEMS>
bool mn::container::basic_atomic_queue< T, TMAXITEMS >::push ( reference  _Element)
inlinenoexcept

Push a element to the queue.

Parameters
pElementThe element

◆ size()

template<class T , mn::size_t TMAXITEMS>
constexpr mn::size_t mn::container::basic_atomic_queue< T, TMAXITEMS >::size ( )
inlineconstexprnoexcept

How many items are currently in the queue.

Returns
the number of items in the queue.

◆ swap()

template<class T , mn::size_t TMAXITEMS>
void mn::container::basic_atomic_queue< T, TMAXITEMS >::swap ( const self_type other)
inline

Member Data Documentation

◆ m_atHead

template<class T , mn::size_t TMAXITEMS>
mn::_atomic<pointer> mn::container::basic_atomic_queue< T, TMAXITEMS >::m_atHead
protected

◆ m_curItems

template<class T , mn::size_t TMAXITEMS>
mn::atomic_size_t mn::container::basic_atomic_queue< T, TMAXITEMS >::m_curItems
protected

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