17 #ifndef IOX_UTILS_CONCURRENT_TRIGGER_QUEUE_HPP
18 #define IOX_UTILS_CONCURRENT_TRIGGER_QUEUE_HPP
20 #include "iceoryx_utils/cxx/optional.hpp"
30 template <
typename ElementType, u
int64_t Capacity>
32 template <
typename ElementType, u
int64_t Capacity>
33 class ResizeableLockFreeQueue;
35 template <
typename T, u
int64_t Capacity,
template <
typename, u
int64_t>
class Queue>
38 static bool push(Queue<T, Capacity>& queue,
const T& in) noexcept;
41 template <
typename T, u
int64_t Capacity>
47 template <
typename T, u
int64_t Capacity>
58 template <
typename T, u
int64_t Capacity,
template <
typename, u
int64_t>
class QueueType>
63 static constexpr uint64_t CAPACITY = Capacity;
69 bool push(
const T& in) noexcept;
78 bool empty()
const noexcept;
81 uint64_t
size()
const noexcept;
84 static constexpr uint64_t
capacity() noexcept;
96 QueueType<T, Capacity> m_queue;
97 std::atomic_bool m_toBeDestroyed{
false};
102 #include "iceoryx_utils/internal/concurrent/trigger_queue.inl"
implements a lock free queue (i.e. container with FIFO order) of elements of type T with a fixed Capa...
Definition: lockfree_queue.hpp:35
implements a lock free queue (i.e. container with FIFO order) of elements of type T with a maximum ca...
Definition: resizeable_lockfree_queue.hpp:48
TriggerQueue is behaves exactly like a normal queue (fifo) except that this queue is threadsafe and o...
Definition: trigger_queue.hpp:60
uint64_t size() const noexcept
Returns the number of elements which are currently in the queue.
Definition: trigger_queue.inl:69
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....
Definition: trigger_queue.inl:46
bool setCapacity(const uint64_t capacity) noexcept
resizes the queue.
Definition: trigger_queue.inl:87
cxx::optional< T > pop() noexcept
If the queue already contains an element it writes the contents of that element in out and returns tr...
Definition: trigger_queue.inl:57
bool empty() const noexcept
Returns true if the queue is empty, otherwise false.
Definition: trigger_queue.inl:63
void destroy() noexcept
when someone is waiting in push since the queue is full it unblocks push. after that call it is impos...
Definition: trigger_queue.inl:81
static constexpr uint64_t capacity() noexcept
Returns the capacity of the trigger queue.
Definition: trigger_queue.inl:75
Optional implementation from the C++17 standard with C++11. The interface is analog to the C++17 stan...
Definition: optional.hpp:63
building block to easily create free function for logging in a library context
Definition: lockfree_queue.hpp:28
Definition: trigger_queue.hpp:37