Skip to content

iox::concurrent::TriggerQueue🔗

TriggerQueue is behaves exactly like a normal queue (fifo) except that this queue is threadsafe and offers a blocking push which blocks the the caller until the queue has space for at least one element which can be pushed. More...

#include <trigger_queue.hpp>

Public Types🔗

Name
using T ValueType

Public Functions🔗

Name
bool push(const T & in)
Pushs an element into the trigger queue. If the queue is full it blocks until there is space again. If in the meantime destroy() was called the block is released and push returns false.
cxx::optional< T > pop()
If the queue already contains an element it writes the contents of that element in out and returns true, otherwise false.
bool empty() const
Returns true if the queue is empty, otherwise false.
uint64_t size() const
Returns the number of elements which are currently in the queue.
void destroy()
when someone is waiting in push since the queue is full it unblocks push. after that call it is impossible to push elements.
bool setCapacity(const uint64_t capacity)
resizes the queue.
constexpr uint64_t capacity()
Returns the capacity of the trigger queue.

Public Attributes🔗

Name
constexpr uint64_t CAPACITY

Detailed Description🔗

template <typename T ,
uint64_t Capacity,
template< typename, uint64_t > class QueueType>
class iox::concurrent::TriggerQueue;

TriggerQueue is behaves exactly like a normal queue (fifo) except that this queue is threadsafe and offers a blocking push which blocks the the caller until the queue has space for at least one element which can be pushed.

Public Types Documentation🔗

using ValueType🔗

using iox::concurrent::TriggerQueue< T, Capacity, QueueType >::ValueType =  T;

Public Functions Documentation🔗

function push🔗

inline bool push(
    const T & in
)

Pushs an element into the trigger queue. If the queue is full it blocks until there is space again. If in the meantime destroy() was called the block is released and push returns false.

function pop🔗

inline cxx::optional< T > pop()

If the queue already contains an element it writes the contents of that element in out and returns true, otherwise false.

Return: if an element could be removed the optional contains it, otherwise when the queue is empty the optional is empty

function empty🔗

inline bool empty() const

Returns true if the queue is empty, otherwise false.

function size🔗

inline uint64_t size() const

Returns the number of elements which are currently in the queue.

function destroy🔗

inline void destroy()

when someone is waiting in push since the queue is full it unblocks push. after that call it is impossible to push elements.

function setCapacity🔗

inline bool setCapacity(
    const uint64_t capacity
)

resizes the queue.

Return: true if resize was successful otherwise false

function capacity🔗

static inline constexpr uint64_t capacity()

Returns the capacity of the trigger queue.

Public Attributes Documentation🔗

variable CAPACITY🔗

static constexpr uint64_t CAPACITY = Capacity;

Updated on 31 May 2022 at 15:29:15 CEST