L4Re Operating System Framework
Interface and Usage Documentation
Loading...
Searching...
No Matches
utrace::Ring_buffer_producer< SEQUENCE_TYPE, ITEM_TYPE, GENERATION_PTR > Class Template Reference

Ring buffer producer. More...

#include <ring_buffer>

Inheritance diagram for utrace::Ring_buffer_producer< SEQUENCE_TYPE, ITEM_TYPE, GENERATION_PTR >:
Collaboration diagram for utrace::Ring_buffer_producer< SEQUENCE_TYPE, ITEM_TYPE, GENERATION_PTR >:

Public Member Functions

 Ring_buffer_producer (Status &status, Slot &slots, unsigned const version, size_t const items)
 Construct ring buffer producer.
size_t items () const
 Get the number of items.
void enqueue (Item const &item) const
 Enqueue an item in the ring buffer.

Additional Inherited Members

Static Public Member Functions inherited from utrace::Ring_buffer< SEQUENCE_TYPE >
static void check_items (size_t const items)
 Check that the number of items is a power of two.
static void check_mask (size_t const mask)
 Check that the item mask is a power of two minus one.
Static Public Attributes inherited from utrace::Ring_buffer< SEQUENCE_TYPE >
static constexpr Sequence const nil = 0U
 Invalid (non-committed) items set their sequence counter to 0.

Detailed Description

template<typename SEQUENCE_TYPE, typename ITEM_TYPE, auto GENERATION_PTR>
class utrace::Ring_buffer_producer< SEQUENCE_TYPE, ITEM_TYPE, GENERATION_PTR >

Ring buffer producer.

Template Parameters
SEQUENCE_TYPENumerical type for storing sequence and generation counters. Must be suitable for atomic access.
ITEM_TYPEActual ring buffer item type.
GENERATION_PTRClass member pointer to the member that contains the sequence number within the item. The member needs to be suitable for an atomic reference.

Definition at line 248 of file ring_buffer.

Constructor & Destructor Documentation

◆ Ring_buffer_producer()

template<typename SEQUENCE_TYPE, typename ITEM_TYPE, auto GENERATION_PTR>
utrace::Ring_buffer_producer< SEQUENCE_TYPE, ITEM_TYPE, GENERATION_PTR >::Ring_buffer_producer ( Status & status,
Slot & slots,
unsigned const version,
size_t const items )
inline

Construct ring buffer producer.

This initializes the ring buffer status area and slots.

Parameters
statusRing buffer status area.
slotsRing buffer slots.
versionVersion of the ring buffer items. The semantics of the version number is defined by the user.
itemsNumber of items in the ring buffer slots. Must be a non-zero power of two.
Exceptions
std::invalid_argumentIf the number of items is zero or not a power of two.

Definition at line 274 of file ring_buffer.

References utrace::Ring_buffer< SEQUENCE_TYPE >::check_items(), items(), and utrace::Ring_buffer< SEQUENCE_TYPE >::nil.

Here is the call graph for this function:

Member Function Documentation

◆ enqueue()

template<typename SEQUENCE_TYPE, typename ITEM_TYPE, auto GENERATION_PTR>
void utrace::Ring_buffer_producer< SEQUENCE_TYPE, ITEM_TYPE, GENERATION_PTR >::enqueue ( Item const & item) const
inline

Enqueue an item in the ring buffer.

This operation never blocks and implements the head-drop policy (i.e. the oldest item is overwritten).

Parameters
itemItem to enqueue (as a copy).

Definition at line 300 of file ring_buffer.

References utrace::Ring_buffer< SEQUENCE_TYPE >::nil.


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