Corium 1.1.0
High-Performance Zero-Heap C++20 MPSC Application Runtime
Loading...
Searching...
No Matches
corium::BoundedMpscQueuePolicy< EventVariant, Capacity > Class Template Reference

Queue Policy for fixed-capacity, zero-allocation lock-free MPSC RingBuffer. More...

#include <QueuePolicies.hpp>

+ Inheritance diagram for corium::BoundedMpscQueuePolicy< EventVariant, Capacity >:
+ Collaboration diagram for corium::BoundedMpscQueuePolicy< EventVariant, Capacity >:

Classes

struct  PushResult
 

Public Types

using EventType = EventVariant
 

Public Member Functions

bool empty () const noexcept
 Check if queue is empty.
 
bool tryPop (EventVariant &event)
 Try to pop an event from the lock-free queue (single consumer).
 
PushResult tryPush (const EventVariant &event, EventPriority priority=EventPriority::Normal)
 Try to push an event into the lock-free queue (const lvalue overload).
 
PushResult tryPush (EventVariant &&event, EventPriority priority=EventPriority::Normal)
 Try to push an event into the lock-free queue (thread-safe, zero allocations).
 

Static Public Attributes

static constexpr std::size_t capacity = Capacity
 Accessible queue capacity for profiler wiring.
 

Detailed Description

template<typename EventVariant = DefaultEvents, size_t Capacity = 1024>
class corium::BoundedMpscQueuePolicy< EventVariant, Capacity >

Queue Policy for fixed-capacity, zero-allocation lock-free MPSC RingBuffer.

Template Parameters
EventVariantThe variant type list of supported events.
CapacityRing buffer capacity (must be a power of 2).

Member Typedef Documentation

◆ EventType

template<typename EventVariant = DefaultEvents, size_t Capacity = 1024>
using corium::BoundedMpscQueuePolicy< EventVariant, Capacity >::EventType = EventVariant

Member Function Documentation

◆ empty()

template<typename EventVariant = DefaultEvents, size_t Capacity = 1024>
bool corium::BoundedMpscQueuePolicy< EventVariant, Capacity >::empty ( ) const
inlinenoexcept

Check if queue is empty.

◆ tryPop()

template<typename EventVariant = DefaultEvents, size_t Capacity = 1024>
bool corium::BoundedMpscQueuePolicy< EventVariant, Capacity >::tryPop ( EventVariant &  event)
inline

Try to pop an event from the lock-free queue (single consumer).

◆ tryPush() [1/2]

template<typename EventVariant = DefaultEvents, size_t Capacity = 1024>
PushResult corium::BoundedMpscQueuePolicy< EventVariant, Capacity >::tryPush ( const EventVariant &  event,
EventPriority  priority = EventPriority::Normal 
)
inline

Try to push an event into the lock-free queue (const lvalue overload).

+ Here is the call graph for this function:

◆ tryPush() [2/2]

template<typename EventVariant = DefaultEvents, size_t Capacity = 1024>
PushResult corium::BoundedMpscQueuePolicy< EventVariant, Capacity >::tryPush ( EventVariant &&  event,
EventPriority  priority = EventPriority::Normal 
)
inline

Try to push an event into the lock-free queue (thread-safe, zero allocations).

+ Here is the caller graph for this function:

Member Data Documentation

◆ capacity

template<typename EventVariant = DefaultEvents, size_t Capacity = 1024>
constexpr std::size_t corium::BoundedMpscQueuePolicy< EventVariant, Capacity >::capacity = Capacity
staticconstexpr

Accessible queue capacity for profiler wiring.


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