![]() |
L4Re Operating System Framework
Interface and Usage Documentation
|
Ring buffer producer. More...
#include <ring_buffer>
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. | |
Ring buffer producer.
| SEQUENCE_TYPE | Numerical type for storing sequence and generation counters. Must be suitable for atomic access. |
| ITEM_TYPE | Actual ring buffer item type. |
| GENERATION_PTR | Class 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.
|
inline |
Construct ring buffer producer.
This initializes the ring buffer status area and slots.
| status | Ring buffer status area. |
| slots | Ring buffer slots. |
| version | Version of the ring buffer items. The semantics of the version number is defined by the user. |
| items | Number of items in the ring buffer slots. Must be a non-zero power of two. |
| std::invalid_argument | If 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.
|
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).
| item | Item to enqueue (as a copy). |
Definition at line 300 of file ring_buffer.
References utrace::Ring_buffer< SEQUENCE_TYPE >::nil.