A C++ template library for embedded applications
MIT licensed
Designed and
maintained by
John Wellbelove
bip_buffer_spsc_atomic

A fixed capacity bipartite buffer.
STL equivalent: none

etl::bip_buffer_spsc_atomic<typename T,
                            size_t SIZE,
                            size_t MEMORY_MODEL = etl::memory_model::MEMORY_MODEL_LARGE>

Inherits from etl::ibip_buffer_spsc_atomic<T>
etl::ibip_buffer_spsc_atomic may be used as a size independent pointer or reference type for any
etl::bip_buffer_spsc_atomic instance.
____________________________________________________________________________________________________
Member types

value_type              T
size_type               std::size_t
reference               value_type&
const_reference         const value_type&
rvalue_reference        value_type&&
____________________________________________________________________________________________________
Static Constants

MAX_SIZE  The maximum size of the circular_buffer.
____________________________________________________________________________________________________
Constructor

etl::bip_buffer_spsc_atomic<typename T,
                            size_t SIZE,
                            size_t MEMORY_MODEL = etl::memory_model::MEMORY_MODEL_LARGE>();
____________________________________________________________________________________________________
Capacity

bool empty() const
Returns true if the size of the circular_buffer is zero, otherwise false.
____________________________________________________________________________________________________
bool full() const
Returns true if the size of the circular_buffer is SIZE, otherwise false.
____________________________________________________________________________________________________
size_t size() const
Returns the size of the circular_buffer.
____________________________________________________________________________________________________
size_t max_size() const
Returns the maximum possible size of the circular_buffer.
____________________________________________________________________________________________________
size_t capacity() const
Returns the maximum possible size of the circular_buffer.
____________________________________________________________________________________________________
size_t available() const
Returns the remaining available capacity in the circular_buffer.
____________________________________________________________________________________________________
Modifiers

etl::span<T> read_reserve(size_type max_reserve_size = numeric_limits<size_type>::max())
Reserves a memory area for reading (up to the max_reserve_size).
____________________________________________________________________________________________________
void read_commit(const etl::span<T> &reserve)
Commits the previously reserved read memory area
the reserve can be trimmed at the end before committing.
Throws bip_buffer_reserve_invalid.
____________________________________________________________________________________________________
etl::span<T> write_reserve(size_type max_reserve_size)
Reserves a memory area for writing up to the max_reserve_size.
____________________________________________________________________________________________________
etl::span<T> write_reserve_optimal(size_type min_reserve_size = 1U)
Reserves an optimal memory area for writing. The buffer will only wrap
around if the available forward space is less than min_reserve_size.
____________________________________________________________________________________________________
void write_commit(const etl::span<T> &reserve)
Commits the previously reserved write memory area
the reserve can be trimmed at the end before committing.
Throws bip_buffer_reserve_invalid
____________________________________________________________________________________________________
void clear()
Clears the buffer, destructing any elements that haven't been read.
bip_buffer_spsc_atomic.h