![]() |
LogIt++
Header-only, macro-first C++ logging library
|
Bounded MPSC ring buffer with arbitrary capacity (C++11). More...
#include <MpscRingAny.hpp>
Classes | |
| struct | Cell |
| Single cell storing sequence number and raw storage for T. More... | |
Public Member Functions | |
| MpscRingAny (std::size_t capacity) | |
| Construct ring with given capacity (>= 2). | |
| ~MpscRingAny () | |
| Destroy remaining elements, if any. | |
| MpscRingAny (const MpscRingAny &)=delete | |
| MpscRingAny & | operator= (const MpscRingAny &)=delete |
| MpscRingAny (MpscRingAny &&other) noexcept | |
| Move construct ring, adopting producer/consumer indices. | |
| MpscRingAny & | operator= (MpscRingAny &&other) noexcept |
| Move assign ring, draining existing payload. | |
| std::size_t | capacity () const noexcept |
| Capacity of the ring. | |
| template<class U > | |
| bool | try_push (U &&v) noexcept |
| Try to enqueue value. | |
| bool | try_pop (T &out) noexcept |
| Try to dequeue value into out. | |
| bool | empty () const noexcept |
| Lightweight emptiness check for current consumer position. | |
Private Member Functions | |
| void | destroy_all_ () noexcept |
Private Attributes | |
| std::size_t | m_cap |
| std::unique_ptr< Cell[]> | m_cells |
| std::atomic< std::size_t > | m_enqueue_pos |
| std::atomic< std::size_t > | m_dequeue_pos |
Bounded MPSC ring buffer with arbitrary capacity (C++11).
| T | Stored type. |
Definition at line 20 of file MpscRingAny.hpp.
|
inlineexplicit |
Construct ring with given capacity (>= 2).
Definition at line 35 of file MpscRingAny.hpp.
|
inline |
Destroy remaining elements, if any.
Definition at line 46 of file MpscRingAny.hpp.
|
delete |
|
inlinenoexcept |
Move construct ring, adopting producer/consumer indices.
Definition at line 54 of file MpscRingAny.hpp.
|
inlinenoexcept |
Capacity of the ring.
Definition at line 82 of file MpscRingAny.hpp.
|
inlineprivatenoexcept |
Definition at line 169 of file MpscRingAny.hpp.
|
inlinenoexcept |
Lightweight emptiness check for current consumer position.
Definition at line 156 of file MpscRingAny.hpp.
|
delete |
|
inlinenoexcept |
Move assign ring, draining existing payload.
Definition at line 65 of file MpscRingAny.hpp.
|
inlinenoexcept |
Try to dequeue value into out.
Non-blocking.
Definition at line 123 of file MpscRingAny.hpp.
|
inlinenoexcept |
Try to enqueue value.
Non-blocking.
Definition at line 87 of file MpscRingAny.hpp.
|
private |
Definition at line 189 of file MpscRingAny.hpp.
|
private |
Definition at line 190 of file MpscRingAny.hpp.
|
private |
Definition at line 192 of file MpscRingAny.hpp.
|
private |
Definition at line 191 of file MpscRingAny.hpp.