Woman, Life, Freedom


Adaptive AUTOSAR
ARA public interface header documentation
ara::com::helper::ConcurrentQueue< T > Class Template Reference

Thread-safe wrapper around STL queue using locking mechanism. More...

#include <concurrent_queue.h>

Public Member Functions

bool Empty () const noexcept
 Indicate whether the queue is empty or not. More...
 
bool TryEnqueue (T &&element)
 Try to insert an element to the queue via moving. More...
 
bool TryEnqueue (const T &element)
 Try to insert an element to the queue via copying. More...
 
bool TryDequeue (T &element)
 Try to peek an element from the queue by removing it. More...
 

Detailed Description

template<typename T>
class ara::com::helper::ConcurrentQueue< T >

Thread-safe wrapper around STL queue using locking mechanism.

Template Parameters
TQueue element type

Member Function Documentation

◆ Empty()

template<typename T >
bool ara::com::helper::ConcurrentQueue< T >::Empty ( ) const
inlinenoexcept

Indicate whether the queue is empty or not.

Returns
True if the queue is empty, otherwise false

◆ TryDequeue()

template<typename T >
bool ara::com::helper::ConcurrentQueue< T >::TryDequeue ( T &  element)
inline

Try to peek an element from the queue by removing it.

Parameters
[out]elementElement that is moved out from the queue
Returns
True if the element is dequeued successfully, otherwise false

◆ TryEnqueue() [1/2]

template<typename T >
bool ara::com::helper::ConcurrentQueue< T >::TryEnqueue ( const T &  element)
inline

Try to insert an element to the queue via copying.

Parameters
[in]elementElement to be moved into the queue
Returns
True if the element is moved to the queue successfully, otherwise false
Note
The insertion is based on move constructor emplacement rather than pushing.

◆ TryEnqueue() [2/2]

template<typename T >
bool ara::com::helper::ConcurrentQueue< T >::TryEnqueue ( T &&  element)
inline

Try to insert an element to the queue via moving.

Parameters
[in]elementElement to be moved into the queue
Returns
True if the element is moved to the queue successfully, otherwise false
Note
The insertion is based on move constructor emplacement rather than pushing.