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

Ring buffer. More...

#include <ring_buffer>

Inheritance diagram for utrace::Ring_buffer< SEQUENCE_TYPE >:
Collaboration diagram for utrace::Ring_buffer< SEQUENCE_TYPE >:

Static Public Member Functions

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

static constexpr Sequence const nil = 0U
 Invalid (non-committed) items set their sequence counter to 0.

Detailed Description

template<typename SEQUENCE_TYPE>
class utrace::Ring_buffer< SEQUENCE_TYPE >

Ring buffer.

Base class of all ring buffer objects. Not directly usable by the user.

Template Parameters
SEQUENCE_TYPENumerical type for storing sequence and generation counters. Must be suitable for atomic access.

Definition at line 66 of file ring_buffer.

Member Function Documentation

◆ check_items()

template<typename SEQUENCE_TYPE>
void utrace::Ring_buffer< SEQUENCE_TYPE >::check_items ( size_t const items)
inlinestatic

Check that the number of items is a power of two.

This ring buffer implementation supports a non-zero power of two number of items.

Parameters
itemsNumber of items.
Exceptions
std::invalid_argumentIf the number of items is zero or not a power of two.

Definition at line 86 of file ring_buffer.

Referenced by utrace::Ring_buffer_producer< SEQUENCE_TYPE, ITEM_TYPE, GENERATION_PTR >::Ring_buffer_producer().

Here is the caller graph for this function:

◆ check_mask()

template<typename SEQUENCE_TYPE>
void utrace::Ring_buffer< SEQUENCE_TYPE >::check_mask ( size_t const mask)
inlinestatic

Check that the item mask is a power of two minus one.

This ring buffer implementation uses the bitwise AND for implementing a modulo operation with the number of items. Thus the item mask must be a power of two minus one.

Parameters
maskItem mask.
Exceptions
td::length_errorIf the item mask is not a power of two minus one.

Definition at line 106 of file ring_buffer.

Referenced by utrace::Ring_buffer_consumer_raw< Sequence, Item, GENERATION_PTR >::Ring_buffer_consumer_raw().

Here is the caller graph for this function:

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