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

Queue Policy supporting strict event priorities using separate lock-free MPSC ring buffers. High priority events are always popped and dispatched before Normal/Low priority events. More...

#include <QueuePolicies.hpp>

+ Collaboration diagram for corium::PriorityMpscQueuePolicy< EventVariant, HighCapacity, NormalCapacity, LowCapacity >:

Classes

struct  PushResult
 

Public Types

using EventType = EventVariant
 

Public Member Functions

bool empty () const noexcept
 Check if all priority queues are empty.
 
bool tryPop (EventVariant &event)
 Try to pop an event from the priority queue (strict priority order: High -> Normal -> Low).
 
PushResult tryPush (const EventVariant &event, EventPriority priority=EventPriority::Normal)
 Try to push an event into the priority queue (const lvalue overload).
 
PushResult tryPush (EventVariant &&event, EventPriority priority=EventPriority::Normal)
 Try to push an event into the priority queue (thread-safe, zero dynamic allocation).
 

Static Public Attributes

static constexpr std::size_t capacity = HighCapacity + NormalCapacity + (LowCapacity > 0 ? LowCapacity : 0)
 Total accessible capacity (high + normal; low is optional).
 

Detailed Description

template<typename EventVariant = DefaultEvents, size_t HighCapacity = 256, size_t NormalCapacity = 1024, size_t LowCapacity = 0>
class corium::PriorityMpscQueuePolicy< EventVariant, HighCapacity, NormalCapacity, LowCapacity >

Queue Policy supporting strict event priorities using separate lock-free MPSC ring buffers. High priority events are always popped and dispatched before Normal/Low priority events.

Template Parameters
EventVariantThe variant type list of supported events.
HighCapacityCapacity for high-priority ring buffer (power of 2).
NormalCapacityCapacity for normal-priority ring buffer (power of 2).
LowCapacityCapacity for low-priority ring buffer (power of 2, 0 to disable).

Member Typedef Documentation

◆ EventType

template<typename EventVariant = DefaultEvents, size_t HighCapacity = 256, size_t NormalCapacity = 1024, size_t LowCapacity = 0>
using corium::PriorityMpscQueuePolicy< EventVariant, HighCapacity, NormalCapacity, LowCapacity >::EventType = EventVariant

Member Function Documentation

◆ empty()

template<typename EventVariant = DefaultEvents, size_t HighCapacity = 256, size_t NormalCapacity = 1024, size_t LowCapacity = 0>
bool corium::PriorityMpscQueuePolicy< EventVariant, HighCapacity, NormalCapacity, LowCapacity >::empty ( ) const
inlinenoexcept

Check if all priority queues are empty.

+ Here is the caller graph for this function:

◆ tryPop()

template<typename EventVariant = DefaultEvents, size_t HighCapacity = 256, size_t NormalCapacity = 1024, size_t LowCapacity = 0>
bool corium::PriorityMpscQueuePolicy< EventVariant, HighCapacity, NormalCapacity, LowCapacity >::tryPop ( EventVariant &  event)
inline

Try to pop an event from the priority queue (strict priority order: High -> Normal -> Low).

◆ tryPush() [1/2]

template<typename EventVariant = DefaultEvents, size_t HighCapacity = 256, size_t NormalCapacity = 1024, size_t LowCapacity = 0>
PushResult corium::PriorityMpscQueuePolicy< EventVariant, HighCapacity, NormalCapacity, LowCapacity >::tryPush ( const EventVariant &  event,
EventPriority  priority = EventPriority::Normal 
)
inline

Try to push an event into the priority queue (const lvalue overload).

+ Here is the call graph for this function:

◆ tryPush() [2/2]

template<typename EventVariant = DefaultEvents, size_t HighCapacity = 256, size_t NormalCapacity = 1024, size_t LowCapacity = 0>
PushResult corium::PriorityMpscQueuePolicy< EventVariant, HighCapacity, NormalCapacity, LowCapacity >::tryPush ( EventVariant &&  event,
EventPriority  priority = EventPriority::Normal 
)
inline

Try to push an event into the priority queue (thread-safe, zero dynamic allocation).

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ capacity

template<typename EventVariant = DefaultEvents, size_t HighCapacity = 256, size_t NormalCapacity = 1024, size_t LowCapacity = 0>
constexpr std::size_t corium::PriorityMpscQueuePolicy< EventVariant, HighCapacity, NormalCapacity, LowCapacity >::capacity = HighCapacity + NormalCapacity + (LowCapacity > 0 ? LowCapacity : 0)
staticconstexpr

Total accessible capacity (high + normal; low is optional).


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