jaffarCommon
Loading...
Searching...
No Matches
Public Member Functions | List of all members
jaffarCommon::concurrent::Deque< T > Class Template Reference

#include <concurrent.hpp>

Public Member Functions

__JAFFAR_COMMON__INLINE__ auto & getInternalStorage ()
 
__JAFFAR_COMMON__INLINE__ void push_back_no_lock (T element)
 
__JAFFAR_COMMON__INLINE__ void push_back (T element)
 
__JAFFAR_COMMON__INLINE__ void push_front_no_lock (T element)
 
__JAFFAR_COMMON__INLINE__ void push_front (T element)
 
__JAFFAR_COMMON__INLINE__ T front () const
 
__JAFFAR_COMMON__INLINE__ T back () const
 
__JAFFAR_COMMON__INLINE__ void pop_front ()
 
__JAFFAR_COMMON__INLINE__ void pop_back ()
 
__JAFFAR_COMMON__INLINE__ bool pop_back_get (T &element)
 
__JAFFAR_COMMON__INLINE__ bool pop_front_get (T &element)
 
__JAFFAR_COMMON__INLINE__ size_t wasSize () const
 

Detailed Description

template<class T>
class jaffarCommon::concurrent::Deque< T >

This implementation of a concurrent doble-ended queue class was created specifically for Jaffar's engine It allows for lock-free front and back push, pop, and pop_get operations It uses a single mutex to coordinate access. This could theoretically be improved, but for the time being seems to suffice

Member Function Documentation

◆ back()

template<class T >
__JAFFAR_COMMON__INLINE__ T jaffarCommon::concurrent::Deque< T >::back ( ) const
inline

Gets the element at the back of the Deque

Note
This is not a thread safe operation
This operation does not check for an empty container and might produce unexpected behaviour if ran with an empty container
Returns
The element at the back of the Deque

◆ front()

template<class T >
__JAFFAR_COMMON__INLINE__ T jaffarCommon::concurrent::Deque< T >::front ( ) const
inline

Gets the element at the front of the Deque

Note
This is not a thread safe operation
This operation does not check for an empty container and might produce unexpected behaviour if ran with an empty container
Returns
The element at the front of the Deque

◆ getInternalStorage()

template<class T >
__JAFFAR_COMMON__INLINE__ auto & jaffarCommon::concurrent::Deque< T >::getInternalStorage ( )
inline

Gets access to the internal Deque storage

Returns
A reference to the internal Deque storage

◆ pop_back()

template<class T >
__JAFFAR_COMMON__INLINE__ void jaffarCommon::concurrent::Deque< T >::pop_back ( )
inline

Pops (removes) the element at the back of the Deque

Note
This is a thread safe operation
This operation does not check for an empty container and might produce unexpected behaviour if ran with an empty container

◆ pop_back_get()

template<class T >
__JAFFAR_COMMON__INLINE__ bool jaffarCommon::concurrent::Deque< T >::pop_back_get ( T &  element)
inline

Pops (removes) the element at the back of the Deque and retrieves it

Note
This is a thread safe operation
Parameters
[out]elementA reference to the storage to save the element into
Returns
True, if the operation was successful; false, if the Deque was empty

◆ pop_front()

template<class T >
__JAFFAR_COMMON__INLINE__ void jaffarCommon::concurrent::Deque< T >::pop_front ( )
inline

Pops (removes) the element at the front of the Deque

Note
This is a thread safe operation
This operation does not check for an empty container and might produce unexpected behaviour if ran with an empty container

◆ pop_front_get()

template<class T >
__JAFFAR_COMMON__INLINE__ bool jaffarCommon::concurrent::Deque< T >::pop_front_get ( T &  element)
inline

Pops (removes) the element at the front of the Deque and retrieves it

Note
This is a thread safe operation
Parameters
[out]elementA reference to the storage to save the element into
Returns
True, if the operation was successful; false, if the Deque was empty

◆ push_back()

template<class T >
__JAFFAR_COMMON__INLINE__ void jaffarCommon::concurrent::Deque< T >::push_back ( element)
inline

Pushes an element to the back of the deque with locking protection

Note
This is a thread safe operation
Parameters
[in]elementThe input element to push

◆ push_back_no_lock()

template<class T >
__JAFFAR_COMMON__INLINE__ void jaffarCommon::concurrent::Deque< T >::push_back_no_lock ( element)
inline

Pushes an element to the back of the deque without any locking protection

Note
This is not a thread safe operation
Parameters
[in]elementThe input element to push

◆ push_front()

template<class T >
__JAFFAR_COMMON__INLINE__ void jaffarCommon::concurrent::Deque< T >::push_front ( element)
inline

Pushes an element to the front of the deque with locking protection

Note
This is a thread safe operation
Parameters
[in]elementThe input element to push

◆ push_front_no_lock()

template<class T >
__JAFFAR_COMMON__INLINE__ void jaffarCommon::concurrent::Deque< T >::push_front_no_lock ( element)
inline

Pushes an element to the front of the deque without any locking protection

Note
This is not a thread safe operation
Parameters
[in]elementThe input element to push

◆ wasSize()

template<class T >
__JAFFAR_COMMON__INLINE__ size_t jaffarCommon::concurrent::Deque< T >::wasSize ( ) const
inline

Retrieves the size of the container at the time of checking

Note
This is not a thread safe operation
Returns
The current size of the Deque at the time of checking

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