iceoryx_doc  1.0.1
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
iox::concurrent::TriggerQueue< T, Capacity, QueueType > Class Template Reference

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

using ValueType = T
 

Public Member Functions

bool push (const T &in) noexcept
 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 () noexcept
 If the queue already contains an element it writes the contents of that element in out and returns true, otherwise false. More...
 
bool empty () const noexcept
 Returns true if the queue is empty, otherwise false.
 
uint64_t size () const noexcept
 Returns the number of elements which are currently in the queue.
 
void destroy () noexcept
 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) noexcept
 resizes the queue. More...
 

Static Public Member Functions

static constexpr uint64_t capacity () noexcept
 Returns the capacity of the trigger queue.
 

Static Public Attributes

static constexpr uint64_t CAPACITY = Capacity
 

Detailed Description

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

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.

Member Function Documentation

◆ pop()

template<typename T , uint64_t Capacity, template< typename, uint64_t > class QueueType>
cxx::optional< T > iox::concurrent::TriggerQueue< T, Capacity, QueueType >::pop
inlinenoexcept

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

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

◆ setCapacity()

template<typename T , uint64_t Capacity, template< typename, uint64_t > class QueueType>
bool iox::concurrent::TriggerQueue< T, Capacity, QueueType >::setCapacity ( const uint64_t  capacity)
inlinenoexcept

resizes the queue.

Returns
true if resize was successful otherwise false

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