Support Class Library
A set of tools providing classes and utility
Public Types | Public Member Functions | Protected Attributes | List of all members
scl::async::AsyncQueue< T, Lock, Guard, Container > Class Template Reference

#include "AsyncQueue.h"

Collaboration diagram for scl::async::AsyncQueue< T, Lock, Guard, Container >:
Collaboration graph
[legend]

Public Types

using queue_type = std::queue< T, Container >
 
using size_type = typename queue_type::size_type
 
using value_type = typename queue_type::value_type
 
using guarded_type = Mutexed< queue_type, Lock, Guard >
 
using optional_type = scl::utils::Optional< value_type >
 

Public Member Functions

 AsyncQueue ()
 
 AsyncQueue (AsyncQueue &&) noexcept=default
 
AsyncQueueoperator= (AsyncQueue &&) noexcept=default
 
 AsyncQueue (const AsyncQueue &)=delete
 
AsyncQueueoperator= (const AsyncQueue &)=delete
 
 AsyncQueue (std::initializer_list< value_type > list)
 
size_type size () const
 Determine the size of the queue. More...
 
size_type length () const
 Alias for AsyncQueue::size. More...
 
bool isEmpty () const
 Determine whether or not the queue is empty. More...
 
optional_type front () const
 Retrieve the front element of the queue. More...
 
optional_type back () const
 Retrieve the back element of the queue. More...
 
optional_type first () const
 Alias for AsyncQueue::front. More...
 
optional_type head () const
 
optional_type last () const
 Alias for AsyncQueue::back. More...
 
optional_type tail () const
 
AsyncQueuepush (const value_type &elem)
 Add an element to the queue by copy. More...
 
AsyncQueuepush (value_type &&elem)
 Add an element to the queue by move. More...
 
template<class... Args>
AsyncQueuepushEmplace (Args &&... args)
 Construct and add an element to the queue. More...
 
optional_type pop ()
 Removes the first element of the queue. More...
 
AsyncQueuequeue (const value_type &elem)
 Alias for AsyncQueue::push. More...
 
AsyncQueueenqueue (const value_type &elem)
 
AsyncQueuequeue (value_type &&elem)
 
AsyncQueueenqueue (value_type &&elem)
 
optional_type dequeue ()
 Alias for AsyncQueue::pop. More...
 

Protected Attributes

guarded_type queue_
 

Detailed Description

template<class T, class Lock = std::mutex, template< class > class Guard = std::lock_guard, class Container = std::deque<T>>
class scl::async::AsyncQueue< T, Lock, Guard, Container >

Definition at line 11 of file AsyncQueue.h.

Member Typedef Documentation

◆ guarded_type

template<class T , class Lock = std::mutex, template< class > class Guard = std::lock_guard, class Container = std::deque<T>>
using scl::async::AsyncQueue< T, Lock, Guard, Container >::guarded_type = Mutexed<queue_type, Lock, Guard>

Definition at line 17 of file AsyncQueue.h.

◆ optional_type

template<class T , class Lock = std::mutex, template< class > class Guard = std::lock_guard, class Container = std::deque<T>>
using scl::async::AsyncQueue< T, Lock, Guard, Container >::optional_type = scl::utils::Optional<value_type>

Definition at line 18 of file AsyncQueue.h.

◆ queue_type

template<class T , class Lock = std::mutex, template< class > class Guard = std::lock_guard, class Container = std::deque<T>>
using scl::async::AsyncQueue< T, Lock, Guard, Container >::queue_type = std::queue<T, Container>

Definition at line 13 of file AsyncQueue.h.

◆ size_type

template<class T , class Lock = std::mutex, template< class > class Guard = std::lock_guard, class Container = std::deque<T>>
using scl::async::AsyncQueue< T, Lock, Guard, Container >::size_type = typename queue_type::size_type

Definition at line 14 of file AsyncQueue.h.

◆ value_type

template<class T , class Lock = std::mutex, template< class > class Guard = std::lock_guard, class Container = std::deque<T>>
using scl::async::AsyncQueue< T, Lock, Guard, Container >::value_type = typename queue_type::value_type

Definition at line 15 of file AsyncQueue.h.

Constructor & Destructor Documentation

◆ AsyncQueue() [1/4]

template<class T , class Lock = std::mutex, template< class > class Guard = std::lock_guard, class Container = std::deque<T>>
scl::async::AsyncQueue< T, Lock, Guard, Container >::AsyncQueue ( )
inline

Definition at line 24 of file AsyncQueue.h.

◆ AsyncQueue() [2/4]

template<class T , class Lock = std::mutex, template< class > class Guard = std::lock_guard, class Container = std::deque<T>>
scl::async::AsyncQueue< T, Lock, Guard, Container >::AsyncQueue ( AsyncQueue< T, Lock, Guard, Container > &&  )
defaultnoexcept

◆ AsyncQueue() [3/4]

template<class T , class Lock = std::mutex, template< class > class Guard = std::lock_guard, class Container = std::deque<T>>
scl::async::AsyncQueue< T, Lock, Guard, Container >::AsyncQueue ( const AsyncQueue< T, Lock, Guard, Container > &  )
delete

◆ AsyncQueue() [4/4]

template<class T , class Lock = std::mutex, template< class > class Guard = std::lock_guard, class Container = std::deque<T>>
scl::async::AsyncQueue< T, Lock, Guard, Container >::AsyncQueue ( std::initializer_list< value_type list)
inline

Definition at line 32 of file AsyncQueue.h.

Member Function Documentation

◆ back()

template<class T , class Lock = std::mutex, template< class > class Guard = std::lock_guard, class Container = std::deque<T>>
optional_type scl::async::AsyncQueue< T, Lock, Guard, Container >::back ( ) const
inline

Retrieve the back element of the queue.

Returns
NONE if there is none, the element otherwise

Definition at line 79 of file AsyncQueue.h.

◆ dequeue()

template<class T , class Lock = std::mutex, template< class > class Guard = std::lock_guard, class Container = std::deque<T>>
optional_type scl::async::AsyncQueue< T, Lock, Guard, Container >::dequeue ( )
inline

Alias for AsyncQueue::pop.

Definition at line 159 of file AsyncQueue.h.

◆ enqueue() [1/2]

template<class T , class Lock = std::mutex, template< class > class Guard = std::lock_guard, class Container = std::deque<T>>
AsyncQueue& scl::async::AsyncQueue< T, Lock, Guard, Container >::enqueue ( const value_type elem)
inline

Definition at line 152 of file AsyncQueue.h.

◆ enqueue() [2/2]

template<class T , class Lock = std::mutex, template< class > class Guard = std::lock_guard, class Container = std::deque<T>>
AsyncQueue& scl::async::AsyncQueue< T, Lock, Guard, Container >::enqueue ( value_type &&  elem)
inline

Definition at line 154 of file AsyncQueue.h.

◆ first()

template<class T , class Lock = std::mutex, template< class > class Guard = std::lock_guard, class Container = std::deque<T>>
optional_type scl::async::AsyncQueue< T, Lock, Guard, Container >::first ( ) const
inline

Alias for AsyncQueue::front.

Definition at line 88 of file AsyncQueue.h.

◆ front()

template<class T , class Lock = std::mutex, template< class > class Guard = std::lock_guard, class Container = std::deque<T>>
optional_type scl::async::AsyncQueue< T, Lock, Guard, Container >::front ( ) const
inline

Retrieve the front element of the queue.

Returns
NONE if there is none, the element otherwise

Definition at line 69 of file AsyncQueue.h.

◆ head()

template<class T , class Lock = std::mutex, template< class > class Guard = std::lock_guard, class Container = std::deque<T>>
optional_type scl::async::AsyncQueue< T, Lock, Guard, Container >::head ( ) const
inline

Definition at line 89 of file AsyncQueue.h.

◆ isEmpty()

template<class T , class Lock = std::mutex, template< class > class Guard = std::lock_guard, class Container = std::deque<T>>
bool scl::async::AsyncQueue< T, Lock, Guard, Container >::isEmpty ( ) const
inline

Determine whether or not the queue is empty.

Returns
TRUE if it is, FALSE otherwise

Definition at line 61 of file AsyncQueue.h.

◆ last()

template<class T , class Lock = std::mutex, template< class > class Guard = std::lock_guard, class Container = std::deque<T>>
optional_type scl::async::AsyncQueue< T, Lock, Guard, Container >::last ( ) const
inline

Alias for AsyncQueue::back.

Definition at line 94 of file AsyncQueue.h.

◆ length()

template<class T , class Lock = std::mutex, template< class > class Guard = std::lock_guard, class Container = std::deque<T>>
size_type scl::async::AsyncQueue< T, Lock, Guard, Container >::length ( ) const
inline

Alias for AsyncQueue::size.

Definition at line 53 of file AsyncQueue.h.

◆ operator=() [1/2]

template<class T , class Lock = std::mutex, template< class > class Guard = std::lock_guard, class Container = std::deque<T>>
AsyncQueue& scl::async::AsyncQueue< T, Lock, Guard, Container >::operator= ( AsyncQueue< T, Lock, Guard, Container > &&  )
defaultnoexcept

◆ operator=() [2/2]

template<class T , class Lock = std::mutex, template< class > class Guard = std::lock_guard, class Container = std::deque<T>>
AsyncQueue& scl::async::AsyncQueue< T, Lock, Guard, Container >::operator= ( const AsyncQueue< T, Lock, Guard, Container > &  )
delete

◆ pop()

template<class T , class Lock = std::mutex, template< class > class Guard = std::lock_guard, class Container = std::deque<T>>
optional_type scl::async::AsyncQueue< T, Lock, Guard, Container >::pop ( )
inline

Removes the first element of the queue.

Returns
NONE if there was none, the element otherwise

Definition at line 139 of file AsyncQueue.h.

◆ push() [1/2]

template<class T , class Lock = std::mutex, template< class > class Guard = std::lock_guard, class Container = std::deque<T>>
AsyncQueue& scl::async::AsyncQueue< T, Lock, Guard, Container >::push ( const value_type elem)
inline

Add an element to the queue by copy.

Parameters
elembeing the element to copy into the queue
Returns
a reference to this AsyncQueue

Definition at line 102 of file AsyncQueue.h.

◆ push() [2/2]

template<class T , class Lock = std::mutex, template< class > class Guard = std::lock_guard, class Container = std::deque<T>>
AsyncQueue& scl::async::AsyncQueue< T, Lock, Guard, Container >::push ( value_type &&  elem)
inline

Add an element to the queue by move.

Parameters
elembeing the element to move into the queue
Returns
a reference to this AsyncQueue

Definition at line 114 of file AsyncQueue.h.

◆ pushEmplace()

template<class T , class Lock = std::mutex, template< class > class Guard = std::lock_guard, class Container = std::deque<T>>
template<class... Args>
AsyncQueue& scl::async::AsyncQueue< T, Lock, Guard, Container >::pushEmplace ( Args &&...  args)
inline

Construct and add an element to the queue.

Template Parameters
Argsbeing the types of the arguments for the constructor
Parameters
argsbeing the arguments for the constructor
Returns
a reference to this AsyncQueue

Definition at line 128 of file AsyncQueue.h.

◆ queue() [1/2]

template<class T , class Lock = std::mutex, template< class > class Guard = std::lock_guard, class Container = std::deque<T>>
AsyncQueue& scl::async::AsyncQueue< T, Lock, Guard, Container >::queue ( const value_type elem)
inline

Alias for AsyncQueue::push.

Definition at line 151 of file AsyncQueue.h.

◆ queue() [2/2]

template<class T , class Lock = std::mutex, template< class > class Guard = std::lock_guard, class Container = std::deque<T>>
AsyncQueue& scl::async::AsyncQueue< T, Lock, Guard, Container >::queue ( value_type &&  elem)
inline

Definition at line 153 of file AsyncQueue.h.

◆ size()

template<class T , class Lock = std::mutex, template< class > class Guard = std::lock_guard, class Container = std::deque<T>>
size_type scl::async::AsyncQueue< T, Lock, Guard, Container >::size ( ) const
inline

Determine the size of the queue.

Returns
the actual size of the queue

Definition at line 44 of file AsyncQueue.h.

◆ tail()

template<class T , class Lock = std::mutex, template< class > class Guard = std::lock_guard, class Container = std::deque<T>>
optional_type scl::async::AsyncQueue< T, Lock, Guard, Container >::tail ( ) const
inline

Definition at line 95 of file AsyncQueue.h.

Member Data Documentation

◆ queue_

template<class T , class Lock = std::mutex, template< class > class Guard = std::lock_guard, class Container = std::deque<T>>
guarded_type scl::async::AsyncQueue< T, Lock, Guard, Container >::queue_
protected

Definition at line 21 of file AsyncQueue.h.


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