jaulib v1.3.0
Jau Support Library (C++, Java, ..)
Public Types | Public Member Functions | Static Public Attributes | List of all members
jau::ringbuffer< Value_type, Size_type, use_memmove, use_memcpy, use_secmem > Class Template Reference

Ring buffer implementation, a.k.a circular buffer, exposing lock-free get*(..) and put*(..) methods. More...

#include <ringbuffer.hpp>

Inheritance diagram for jau::ringbuffer< Value_type, Size_type, use_memmove, use_memcpy, use_secmem >:
Collaboration diagram for jau::ringbuffer< Value_type, Size_type, use_memmove, use_memcpy, use_secmem >:

Public Types

typedef jau::callocator< Value_typeallocator_type
 
typedef const value_typeconst_pointer
 
typedef const value_typeconst_reference
 
typedef std::make_signed< size_type >::type difference_type
 
typedef value_typepointer
 
typedef value_typereference
 
typedef Size_type size_type
 
typedef Value_type value_type
 

Public Member Functions

 ringbuffer (const ringbuffer &_source) noexcept
 
 ringbuffer (const Size_type capacity) noexcept
 Create an empty ring buffer instance w/ the given net capacity. More...
 
 ringbuffer (const std::vector< Value_type > &copyFrom) noexcept
 Create a full ring buffer instance w/ the given array's net capacity and content. More...
 
 ringbuffer (const Value_type *copyFrom, const Size_type copyFromSize) noexcept
 
 ringbuffer (ringbuffer &&o) noexcept=default
 
 ~ringbuffer () noexcept
 
Size_type capacity () const noexcept
 Returns the net capacity of this ring buffer. More...
 
void clear (const bool zeromem=false) noexcept
 Releasing all elements available, i.e. More...
 
void close (const bool zeromem=false) noexcept
 Close this ringbuffer by releasing all elements available and resizing capacity to zero. More...
 
Size_type drop (const Size_type max_count) noexcept
 Drops up to max_count oldest enqueued elements, but may drop less if not available. More...
 
bool dropBlocking (const Size_type count, const fraction_i64 &timeout) noexcept
 Drops exactly count oldest enqueued elements, will block until they become available. More...
 
bool dropBlocking (const Size_type count, const fraction_i64 &timeout, bool &timeout_occurred) noexcept
 Drops exactly count oldest enqueued elements, will block until they become available. More...
 
void dump (FILE *stream, const std::string &prefix) const noexcept
 Debug functionality - Dumps the contents of the internal array. More...
 
Size_type freeSlots () const noexcept
 Returns the number of free slots available to put. More...
 
bool get (Value_type &result) noexcept
 Dequeues the oldest enqueued element, if available. More...
 
Size_type get (Value_type *dest, const Size_type dest_len, const Size_type min_count) noexcept
 Dequeues the oldest enqueued min(dest_len, size()>=min_count) elements by copying them into the given consecutive 'dest' storage. More...
 
std::string get_info () const noexcept
 
bool getBlocking (Value_type &result, const fraction_i64 &timeout) noexcept
 Dequeues the oldest enqueued element. More...
 
bool getBlocking (Value_type &result, const fraction_i64 &timeout, bool &timeout_occurred) noexcept
 Dequeues the oldest enqueued element. More...
 
Size_type getBlocking (Value_type *dest, const Size_type dest_len, const Size_type min_count, const fraction_i64 &timeout) noexcept
 Dequeues the oldest enqueued min(dest_len, size()>=min_count) elements by copying them into the given consecutive 'dest' storage. More...
 
Size_type getBlocking (Value_type *dest, const Size_type dest_len, const Size_type min_count, const fraction_i64 &timeout, bool &timeout_occurred) noexcept
 Dequeues the oldest enqueued min(dest_len, size()>=min_count) elements by copying them into the given consecutive 'dest' storage. More...
 
constexpr bool getMultiPCEnabled () const
 Return whether multiple producer and consumer are enabled, see ringbuffer_multi_pc and ringbuffer_single_pc. More...
 
void interruptReader () noexcept
 Interrupt a potentially blocked reader once. More...
 
void interruptWriter () noexcept
 Interrupt a potentially blocked writer once. More...
 
bool isEmpty () const noexcept
 Returns true if this ring buffer is empty, otherwise false. More...
 
bool isFull () const noexcept
 Returns true if this ring buffer is full, otherwise false. More...
 
ringbufferoperator= (const ringbuffer &_source) noexcept
 
ringbufferoperator= (ringbuffer &&o) noexcept=default
 
bool peek (Value_type &result) noexcept
 Peeks the next element at the read position w/o modifying pointer, nor blocking. More...
 
bool peekBlocking (Value_type &result, const fraction_i64 &timeout) noexcept
 Peeks the next element at the read position w/o modifying pointer, but with blocking. More...
 
bool peekBlocking (Value_type &result, const fraction_i64 &timeout, bool &timeout_occurred) noexcept
 Peeks the next element at the read position w/o modifying pointer, but with blocking. More...
 
bool put (const Value_type &e) noexcept
 Enqueues the given element by copying it into this ringbuffer storage. More...
 
bool put (const Value_type *first, const Value_type *last) noexcept
 Enqueues the given range of consecutive elements by copying it into this ringbuffer storage. More...
 
bool put (Value_type &&e) noexcept
 Enqueues the given element by moving it into this ringbuffer storage. More...
 
bool putBlocking (const Value_type &e, const fraction_i64 &timeout) noexcept
 Enqueues the given element by copying it into this ringbuffer storage. More...
 
bool putBlocking (const Value_type &e, const fraction_i64 &timeout, bool &timeout_occurred) noexcept
 Enqueues the given element by copying it into this ringbuffer storage. More...
 
bool putBlocking (const Value_type *first, const Value_type *last, const fraction_i64 &timeout) noexcept
 Enqueues the given range of consecutive elementa by copying it into this ringbuffer storage. More...
 
bool putBlocking (const Value_type *first, const Value_type *last, const fraction_i64 &timeout, bool &timeout_occurred) noexcept
 Enqueues the given range of consecutive elementa by copying it into this ringbuffer storage. More...
 
bool putBlocking (Value_type &&e, const fraction_i64 &timeout) noexcept
 Enqueues the given element by moving it into this ringbuffer storage. More...
 
bool putBlocking (Value_type &&e, const fraction_i64 &timeout, bool &timeout_occurred) noexcept
 Enqueues the given element by moving it into this ringbuffer storage. More...
 
void recapacity (const Size_type newCapacity)
 Resizes this ring buffer's capacity. More...
 
void reset (const std::vector< Value_type > &copyFrom) noexcept
 Clears all elements and add all copyFrom elements thereafter, as if reconstructing this ringbuffer instance. More...
 
void reset (const Value_type *copyFrom, const Size_type copyFromCount) noexcept
 Clears all elements and add all copyFrom elements thereafter, as if reconstructing this ringbuffer instance. More...
 
void set_end_of_input (const bool v=true) noexcept
 Set End of Input from writer thread, unblocking all read-operations and a potentially currently blocked reader thread. More...
 
constexpr_non_literal_var void setMultiPCEnabled (const bool v)
 Enable or disable capability to handle multiple producer and consumer, see ringbuffer_multi_pc and ringbuffer_single_pc. More...
 
Size_type size () const noexcept
 Returns the number of elements in this ring buffer. More...
 
std::string toString () const noexcept
 Returns a short string representation incl. More...
 
Size_type waitForElements (const Size_type min_count, const fraction_i64 &timeout, bool &timeout_occured) noexcept
 Blocks until at least count elements have been put for subsequent get() and getBlocking(). More...
 
Size_type waitForFreeSlots (const Size_type min_count, const fraction_i64 &timeout, bool &timeout_occured) noexcept
 Blocks until at least count free slots become available for subsequent put() and putBlocking(). More...
 

Static Public Attributes

static constexpr const bool uses_memcpy = use_memcpy
 
static constexpr const bool uses_memmove = use_memmove
 
static constexpr const bool uses_secmem = use_secmem
 

Detailed Description

template<typename Value_type, typename Size_type, bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_memcpy = std::is_trivially_copyable_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
class jau::ringbuffer< Value_type, Size_type, use_memmove, use_memcpy, use_secmem >

Ring buffer implementation, a.k.a circular buffer, exposing lock-free get*(..) and put*(..) methods.

This data structure is also supporting Concurrency.

Implementation utilizes the Always Keep One Slot Open, hence implementation maintains an internal array of capacity plus one!

Characteristics

EmptywritePos == readPossize == 0
FullwritePos == readPos - 1size == capacity
Empty [RW][][ ][ ][ ][ ][ ][ ] ; W==R
Avail [ ][ ][R][.][.][.][.][W] ; W > R
Avail [.][.][.][W][ ][ ][R][.] ; W <  R - 1
Full  [.][.][.][.][.][W][R][.] ; W==R-1

Thread Safety

Thread safety is guaranteed, considering the mode of operation as described below.

One producer-thread and one consumer-thread

Expects one producer-thread at a time and one consumer-thread at a time concurrently. Threads can be different or the same.

This is the default mode with the least std::mutex operations.

See setMultiPCEnabled().

Implementation is thread safe if:

Multiple producer-threads and multiple consumer-threads

Expects multiple producer-threads and multiple consumer-threads concurrently. Threads can be different or the same.

This operation mode utilizes a specific multi-producer and -consumer lock, synchronizing put*(..) and get*(..) operations separately.

Use setMultiPCEnabled() to enable or disable multiple producer and consumer mode.

Implementation is thread safe if:

Interruption of Consumer and Producer

To allow an application to unblock a potentially blocked producer (writer) or consumer (reader) thread once, one can call interruptWriter() or interruptReader() respectively.

Marking End of Input Stream (EOS)

To allow an application to mark the end of input stream, i.e. the producer (write) has completed filling the ringbuffer, one can call set_end_of_input().

Calling set_end_of_input(true) will unblock all read-operations from this point onwards. A potentially currently blocked reader thread is also interrupted and hence unblocked.

See also

Non-Type Template Parameter (NTTP) controlling Value_type memory

See darray_ntt_params.

use_memmove

use_memmove see darray_memmove.

use_memcpy

use_memcpy has more strict requirements than use_memmove, i.e. strictly relies on Value_type being std::is_trivially_copyable_v<Value_type>.

It allows to merely use memory operations w/o the need for constructor or destructor.

See Trivial destructor being key requirement to TriviallyCopyable.

‍A trivial destructor is a destructor that performs no action. Objects with trivial destructors don't require a delete-expression and may be disposed of by simply deallocating their storage. All data types compatible with the C language (POD types) are trivially destructible.`

use_secmem

use_secmem see darray_secmem.

See also
darray_ntt_params
jau::sc_atomic_critical
Examples
test_lfringbuffer11.cpp.

Definition at line 182 of file ringbuffer.hpp.

Member Typedef Documentation

◆ value_type

template<typename Value_type , typename Size_type , bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_memcpy = std::is_trivially_copyable_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
typedef Value_type jau::ringbuffer< Value_type, Size_type, use_memmove, use_memcpy, use_secmem >::value_type

Definition at line 190 of file ringbuffer.hpp.

◆ pointer

template<typename Value_type , typename Size_type , bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_memcpy = std::is_trivially_copyable_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
typedef value_type* jau::ringbuffer< Value_type, Size_type, use_memmove, use_memcpy, use_secmem >::pointer

Definition at line 191 of file ringbuffer.hpp.

◆ const_pointer

template<typename Value_type , typename Size_type , bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_memcpy = std::is_trivially_copyable_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
typedef const value_type* jau::ringbuffer< Value_type, Size_type, use_memmove, use_memcpy, use_secmem >::const_pointer

Definition at line 192 of file ringbuffer.hpp.

◆ reference

template<typename Value_type , typename Size_type , bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_memcpy = std::is_trivially_copyable_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
typedef value_type& jau::ringbuffer< Value_type, Size_type, use_memmove, use_memcpy, use_secmem >::reference

Definition at line 193 of file ringbuffer.hpp.

◆ const_reference

template<typename Value_type , typename Size_type , bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_memcpy = std::is_trivially_copyable_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
typedef const value_type& jau::ringbuffer< Value_type, Size_type, use_memmove, use_memcpy, use_secmem >::const_reference

Definition at line 194 of file ringbuffer.hpp.

◆ size_type

template<typename Value_type , typename Size_type , bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_memcpy = std::is_trivially_copyable_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
typedef Size_type jau::ringbuffer< Value_type, Size_type, use_memmove, use_memcpy, use_secmem >::size_type

Definition at line 195 of file ringbuffer.hpp.

◆ difference_type

template<typename Value_type , typename Size_type , bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_memcpy = std::is_trivially_copyable_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
typedef std::make_signed<size_type>::type jau::ringbuffer< Value_type, Size_type, use_memmove, use_memcpy, use_secmem >::difference_type

Definition at line 196 of file ringbuffer.hpp.

◆ allocator_type

template<typename Value_type , typename Size_type , bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_memcpy = std::is_trivially_copyable_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
typedef jau::callocator<Value_type> jau::ringbuffer< Value_type, Size_type, use_memmove, use_memcpy, use_secmem >::allocator_type

Definition at line 198 of file ringbuffer.hpp.

Constructor & Destructor Documentation

◆ ringbuffer() [1/5]

template<typename Value_type , typename Size_type , bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_memcpy = std::is_trivially_copyable_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
jau::ringbuffer< Value_type, Size_type, use_memmove, use_memcpy, use_secmem >::ringbuffer ( const std::vector< Value_type > &  copyFrom)
inlinenoexcept

Create a full ring buffer instance w/ the given array's net capacity and content.

Example for a 10 element Integer array:

 Integer[] source = new Integer[10];
 // fill source with content ..
 ringbuffer<Integer> rb = new ringbuffer<Integer>(source);

isFull() returns true on the newly created full ring buffer.

Implementation will allocate an internal array with size of array copyFrom plus one, and copy all elements from array copyFrom into the internal array.

Parameters
copyFrommandatory source array determining ring buffer's net capacity() and initial content.
Exceptions
IllegalArgumentExceptionif copyFrom is nullptr

Definition at line 1072 of file ringbuffer.hpp.

◆ ringbuffer() [2/5]

template<typename Value_type , typename Size_type , bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_memcpy = std::is_trivially_copyable_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
jau::ringbuffer< Value_type, Size_type, use_memmove, use_memcpy, use_secmem >::ringbuffer ( const Value_type copyFrom,
const Size_type  copyFromSize 
)
inlinenoexcept
Parameters
copyFrom
copyFromSize

Definition at line 1084 of file ringbuffer.hpp.

◆ ringbuffer() [3/5]

template<typename Value_type , typename Size_type , bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_memcpy = std::is_trivially_copyable_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
jau::ringbuffer< Value_type, Size_type, use_memmove, use_memcpy, use_secmem >::ringbuffer ( const Size_type  capacity)
inlinenoexcept

Create an empty ring buffer instance w/ the given net capacity.

Example for a 10 element Integer array:

 ringbuffer<Integer> rb = new ringbuffer<Integer>(10, Integer[].class);

isEmpty() returns true on the newly created empty ring buffer.

Implementation will allocate an internal array of size capacity plus one.

Parameters
arrayTypethe array type of the created empty internal array.
capacitythe initial net capacity of the ring buffer

Definition at line 1109 of file ringbuffer.hpp.

◆ ~ringbuffer()

template<typename Value_type , typename Size_type , bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_memcpy = std::is_trivially_copyable_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
jau::ringbuffer< Value_type, Size_type, use_memmove, use_memcpy, use_secmem >::~ringbuffer ( )
inlinenoexcept

Definition at line 1116 of file ringbuffer.hpp.

◆ ringbuffer() [4/5]

template<typename Value_type , typename Size_type , bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_memcpy = std::is_trivially_copyable_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
jau::ringbuffer< Value_type, Size_type, use_memmove, use_memcpy, use_secmem >::ringbuffer ( const ringbuffer< Value_type, Size_type, use_memmove, use_memcpy, use_secmem > &  _source)
inlinenoexcept

Definition at line 1124 of file ringbuffer.hpp.

◆ ringbuffer() [5/5]

template<typename Value_type , typename Size_type , bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_memcpy = std::is_trivially_copyable_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
jau::ringbuffer< Value_type, Size_type, use_memmove, use_memcpy, use_secmem >::ringbuffer ( ringbuffer< Value_type, Size_type, use_memmove, use_memcpy, use_secmem > &&  o)
defaultnoexcept

Member Function Documentation

◆ toString()

template<typename Value_type , typename Size_type , bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_memcpy = std::is_trivially_copyable_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
std::string jau::ringbuffer< Value_type, Size_type, use_memmove, use_memcpy, use_secmem >::toString ( ) const
inlinenoexcept

Returns a short string representation incl.

size/capacity and internal r/w index (impl. dependent).

Definition at line 1024 of file ringbuffer.hpp.

Here is the caller graph for this function:

◆ dump()

template<typename Value_type , typename Size_type , bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_memcpy = std::is_trivially_copyable_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
void jau::ringbuffer< Value_type, Size_type, use_memmove, use_memcpy, use_secmem >::dump ( FILE *  stream,
const std::string &  prefix 
) const
inlinenoexcept

Debug functionality - Dumps the contents of the internal array.

Definition at line 1033 of file ringbuffer.hpp.

◆ get_info()

template<typename Value_type , typename Size_type , bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_memcpy = std::is_trivially_copyable_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
std::string jau::ringbuffer< Value_type, Size_type, use_memmove, use_memcpy, use_secmem >::get_info ( ) const
inlinenoexcept

Definition at line 1037 of file ringbuffer.hpp.

Here is the caller graph for this function:

◆ operator=() [1/2]

template<typename Value_type , typename Size_type , bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_memcpy = std::is_trivially_copyable_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
ringbuffer & jau::ringbuffer< Value_type, Size_type, use_memmove, use_memcpy, use_secmem >::operator= ( const ringbuffer< Value_type, Size_type, use_memmove, use_memcpy, use_secmem > &  _source)
inlinenoexcept

Definition at line 1136 of file ringbuffer.hpp.

◆ operator=() [2/2]

template<typename Value_type , typename Size_type , bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_memcpy = std::is_trivially_copyable_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
ringbuffer & jau::ringbuffer< Value_type, Size_type, use_memmove, use_memcpy, use_secmem >::operator= ( ringbuffer< Value_type, Size_type, use_memmove, use_memcpy, use_secmem > &&  o)
defaultnoexcept

◆ getMultiPCEnabled()

template<typename Value_type , typename Size_type , bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_memcpy = std::is_trivially_copyable_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
constexpr bool jau::ringbuffer< Value_type, Size_type, use_memmove, use_memcpy, use_secmem >::getMultiPCEnabled ( ) const
inlineconstexpr

Return whether multiple producer and consumer are enabled, see ringbuffer_multi_pc and ringbuffer_single_pc.

Defaults to false.

See also
ringbuffer_multi_pc
ringbuffer_single_pc
getMultiPCEnabled()
setMultiPCEnabled()

Definition at line 1172 of file ringbuffer.hpp.

Here is the caller graph for this function:

◆ setMultiPCEnabled()

template<typename Value_type , typename Size_type , bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_memcpy = std::is_trivially_copyable_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
constexpr_non_literal_var void jau::ringbuffer< Value_type, Size_type, use_memmove, use_memcpy, use_secmem >::setMultiPCEnabled ( const bool  v)
inline

Enable or disable capability to handle multiple producer and consumer, see ringbuffer_multi_pc and ringbuffer_single_pc.

Defaults to false.

See also
ringbuffer_multi_pc
ringbuffer_single_pc
getMultiPCEnabled()
setMultiPCEnabled()

Definition at line 1184 of file ringbuffer.hpp.

Here is the caller graph for this function:

◆ capacity()

template<typename Value_type , typename Size_type , bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_memcpy = std::is_trivially_copyable_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
Size_type jau::ringbuffer< Value_type, Size_type, use_memmove, use_memcpy, use_secmem >::capacity ( ) const
inlinenoexcept

Returns the net capacity of this ring buffer.

Definition at line 1207 of file ringbuffer.hpp.

◆ freeSlots()

template<typename Value_type , typename Size_type , bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_memcpy = std::is_trivially_copyable_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
Size_type jau::ringbuffer< Value_type, Size_type, use_memmove, use_memcpy, use_secmem >::freeSlots ( ) const
inlinenoexcept

Returns the number of free slots available to put.


Definition at line 1210 of file ringbuffer.hpp.

Here is the caller graph for this function:

◆ isEmpty()

template<typename Value_type , typename Size_type , bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_memcpy = std::is_trivially_copyable_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
bool jau::ringbuffer< Value_type, Size_type, use_memmove, use_memcpy, use_secmem >::isEmpty ( ) const
inlinenoexcept

Returns true if this ring buffer is empty, otherwise false.

Definition at line 1213 of file ringbuffer.hpp.

Here is the caller graph for this function:

◆ isFull()

template<typename Value_type , typename Size_type , bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_memcpy = std::is_trivially_copyable_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
bool jau::ringbuffer< Value_type, Size_type, use_memmove, use_memcpy, use_secmem >::isFull ( ) const
inlinenoexcept

Returns true if this ring buffer is full, otherwise false.

Definition at line 1216 of file ringbuffer.hpp.

Here is the caller graph for this function:

◆ size()

template<typename Value_type , typename Size_type , bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_memcpy = std::is_trivially_copyable_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
Size_type jau::ringbuffer< Value_type, Size_type, use_memmove, use_memcpy, use_secmem >::size ( ) const
inlinenoexcept

Returns the number of elements in this ring buffer.

Definition at line 1221 of file ringbuffer.hpp.

Here is the caller graph for this function:

◆ waitForElements()

template<typename Value_type , typename Size_type , bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_memcpy = std::is_trivially_copyable_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
Size_type jau::ringbuffer< Value_type, Size_type, use_memmove, use_memcpy, use_secmem >::waitForElements ( const Size_type  min_count,
const fraction_i64 timeout,
bool &  timeout_occured 
)
inlinenoexcept

Blocks until at least count elements have been put for subsequent get() and getBlocking().

Parameters
min_countminimum number of put slots
timeoutmaximum duration in fractions of seconds to wait, where fractions_i64::zero waits infinitely
timeout_occurredresult value set to true if a timeout has occurred
Returns
the number of put elements, available for get() and getBlocking()

Definition at line 1238 of file ringbuffer.hpp.

◆ waitForFreeSlots()

template<typename Value_type , typename Size_type , bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_memcpy = std::is_trivially_copyable_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
Size_type jau::ringbuffer< Value_type, Size_type, use_memmove, use_memcpy, use_secmem >::waitForFreeSlots ( const Size_type  min_count,
const fraction_i64 timeout,
bool &  timeout_occured 
)
inlinenoexcept

Blocks until at least count free slots become available for subsequent put() and putBlocking().

Parameters
min_countminimum number of free slots
timeoutmaximum duration in fractions of seconds to wait, where fractions_i64::zero waits infinitely
timeout_occurredresult value set to true if a timeout has occurred
Returns
the number of free slots, available for put() and putBlocking()

Definition at line 1256 of file ringbuffer.hpp.

◆ clear()

template<typename Value_type , typename Size_type , bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_memcpy = std::is_trivially_copyable_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
void jau::ringbuffer< Value_type, Size_type, use_memmove, use_memcpy, use_secmem >::clear ( const bool  zeromem = false)
inlinenoexcept

Releasing all elements available, i.e.

size() at the time of the call

It is the user's obligation to ensure thread safety when using ringbuffer_single_pc, as implementation can only synchronize on the blocked put() and get() std::mutex.

Assuming no concurrent put() operation, after the call:

Parameters
zeromempass true to zero ringbuffer memory after releasing elements, otherwise non template type parameter use_secmem determines the behavior (default), see ringbuffer_ntt_params.
See also
ringbuffer_ntt_params

Definition at line 1278 of file ringbuffer.hpp.

Here is the caller graph for this function:

◆ close()

template<typename Value_type , typename Size_type , bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_memcpy = std::is_trivially_copyable_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
void jau::ringbuffer< Value_type, Size_type, use_memmove, use_memcpy, use_secmem >::close ( const bool  zeromem = false)
inlinenoexcept

Close this ringbuffer by releasing all elements available and resizing capacity to zero.

Essentially causing all read and write operations to fail.

Potential writer and reader thread will be

  • notified, allowing them to be woken up
  • interrupted to abort the write and read operation

Subsequent write and read operations will fail and not block.

After the call:

Definition at line 1322 of file ringbuffer.hpp.

Here is the caller graph for this function:

◆ reset() [1/2]

template<typename Value_type , typename Size_type , bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_memcpy = std::is_trivially_copyable_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
void jau::ringbuffer< Value_type, Size_type, use_memmove, use_memcpy, use_secmem >::reset ( const Value_type copyFrom,
const Size_type  copyFromCount 
)
inlinenoexcept

Clears all elements and add all copyFrom elements thereafter, as if reconstructing this ringbuffer instance.

It is the user's obligation to ensure thread safety when using ringbuffer_single_pc, as implementation can only synchronize on the blocked put() and get() std::mutex.

Parameters
copyFromMandatory array w/ length capacity() to be copied into the internal array.
See also
getMultiPCEnabled()
setMultiPCEnabled()
ringbuffer_multi_pc
ringbuffer_single_pc

Definition at line 1362 of file ringbuffer.hpp.

Here is the caller graph for this function:

◆ reset() [2/2]

template<typename Value_type , typename Size_type , bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_memcpy = std::is_trivially_copyable_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
void jau::ringbuffer< Value_type, Size_type, use_memmove, use_memcpy, use_secmem >::reset ( const std::vector< Value_type > &  copyFrom)
inlinenoexcept

Clears all elements and add all copyFrom elements thereafter, as if reconstructing this ringbuffer instance.

It is the user's obligation to ensure thread safety when using ringbuffer_single_pc, as implementation can only synchronize on the blocked put() and get() std::mutex.

Parameters
copyFrom
See also
getMultiPCEnabled()
setMultiPCEnabled()
ringbuffer_multi_pc
ringbuffer_single_pc

Definition at line 1393 of file ringbuffer.hpp.

◆ recapacity()

template<typename Value_type , typename Size_type , bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_memcpy = std::is_trivially_copyable_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
void jau::ringbuffer< Value_type, Size_type, use_memmove, use_memcpy, use_secmem >::recapacity ( const Size_type  newCapacity)
inline

Resizes this ring buffer's capacity.

New capacity must be greater than current size.

It is the user's obligation to ensure thread safety when using ringbuffer_single_pc, as implementation can only synchronize on the blocked put() and get() std::mutex.

Parameters
newCapacity
See also
getMultiPCEnabled()
setMultiPCEnabled()
ringbuffer_multi_pc
ringbuffer_single_pc

Definition at line 1426 of file ringbuffer.hpp.

◆ interruptReader()

template<typename Value_type , typename Size_type , bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_memcpy = std::is_trivially_copyable_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
void jau::ringbuffer< Value_type, Size_type, use_memmove, use_memcpy, use_secmem >::interruptReader ( )
inlinenoexcept

Interrupt a potentially blocked reader once.

Call this method to unblock a potentially blocked reader thread once.

Definition at line 1448 of file ringbuffer.hpp.

◆ set_end_of_input()

template<typename Value_type , typename Size_type , bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_memcpy = std::is_trivially_copyable_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
void jau::ringbuffer< Value_type, Size_type, use_memmove, use_memcpy, use_secmem >::set_end_of_input ( const bool  v = true)
inlinenoexcept

Set End of Input from writer thread, unblocking all read-operations and a potentially currently blocked reader thread.

Call this method with true after concluding writing input data will unblock all read-operations from this point onwards. A potentially currently blocked reader thread is also interrupted and hence unblocked.

Definition at line 1456 of file ringbuffer.hpp.

Here is the caller graph for this function:

◆ interruptWriter()

template<typename Value_type , typename Size_type , bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_memcpy = std::is_trivially_copyable_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
void jau::ringbuffer< Value_type, Size_type, use_memmove, use_memcpy, use_secmem >::interruptWriter ( )
inlinenoexcept

Interrupt a potentially blocked writer once.

Call this method to unblock a potentially blocked writer thread once.

Definition at line 1468 of file ringbuffer.hpp.

◆ peek()

template<typename Value_type , typename Size_type , bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_memcpy = std::is_trivially_copyable_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
bool jau::ringbuffer< Value_type, Size_type, use_memmove, use_memcpy, use_secmem >::peek ( Value_type result)
inlinenoexcept

Peeks the next element at the read position w/o modifying pointer, nor blocking.

Method is non blocking and returns immediately;.

Parameters
resultstorage for the resulting value if successful, otherwise unchanged.
Returns
true if successful, otherwise false.

Definition at line 1478 of file ringbuffer.hpp.

◆ peekBlocking() [1/2]

template<typename Value_type , typename Size_type , bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_memcpy = std::is_trivially_copyable_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
bool jau::ringbuffer< Value_type, Size_type, use_memmove, use_memcpy, use_secmem >::peekBlocking ( Value_type result,
const fraction_i64 timeout,
bool &  timeout_occurred 
)
inlinenoexcept

Peeks the next element at the read position w/o modifying pointer, but with blocking.

Parameters
resultstorage for the resulting value if successful, otherwise unchanged.
timeoutmaximum duration in fractions of seconds to wait, where fractions_i64::zero waits infinitely
timeout_occurredresult value set to true if a timeout has occurred
Returns
true if successful, otherwise false.

Definition at line 1496 of file ringbuffer.hpp.

Here is the caller graph for this function:

◆ peekBlocking() [2/2]

template<typename Value_type , typename Size_type , bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_memcpy = std::is_trivially_copyable_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
bool jau::ringbuffer< Value_type, Size_type, use_memmove, use_memcpy, use_secmem >::peekBlocking ( Value_type result,
const fraction_i64 timeout 
)
inlinenoexcept

Peeks the next element at the read position w/o modifying pointer, but with blocking.

Parameters
resultstorage for the resulting value if successful, otherwise unchanged.
timeoutmaximum duration in fractions of seconds to wait, where fractions_i64::zero waits infinitely
Returns
true if successful, otherwise false.

Definition at line 1512 of file ringbuffer.hpp.

◆ get() [1/2]

template<typename Value_type , typename Size_type , bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_memcpy = std::is_trivially_copyable_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
bool jau::ringbuffer< Value_type, Size_type, use_memmove, use_memcpy, use_secmem >::get ( Value_type result)
inlinenoexcept

Dequeues the oldest enqueued element, if available.

The ring buffer slot will be released and its value moved to the caller's result storage, if successful.

Method is non blocking and returns immediately;.

Parameters
resultstorage for the resulting value if successful, otherwise unchanged.
Returns
true if successful, otherwise false.

Definition at line 1527 of file ringbuffer.hpp.

◆ getBlocking() [1/4]

template<typename Value_type , typename Size_type , bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_memcpy = std::is_trivially_copyable_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
bool jau::ringbuffer< Value_type, Size_type, use_memmove, use_memcpy, use_secmem >::getBlocking ( Value_type result,
const fraction_i64 timeout,
bool &  timeout_occurred 
)
inlinenoexcept

Dequeues the oldest enqueued element.

The ring buffer slot will be released and its value moved to the caller's result storage, if successful.

Parameters
resultstorage for the resulting value if successful, otherwise unchanged.
timeoutmaximum duration in fractions of seconds to wait, where fractions_i64::zero waits infinitely
timeout_occurredresult value set to true if a timeout has occurred
Returns
true if successful, otherwise false.

Definition at line 1547 of file ringbuffer.hpp.

Here is the caller graph for this function:

◆ getBlocking() [2/4]

template<typename Value_type , typename Size_type , bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_memcpy = std::is_trivially_copyable_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
bool jau::ringbuffer< Value_type, Size_type, use_memmove, use_memcpy, use_secmem >::getBlocking ( Value_type result,
const fraction_i64 timeout 
)
inlinenoexcept

Dequeues the oldest enqueued element.

The ring buffer slot will be released and its value moved to the caller's result storage, if successful.

Parameters
resultstorage for the resulting value if successful, otherwise unchanged.
timeoutmaximum duration in fractions of seconds to wait, where fractions_i64::zero waits infinitely
Returns
true if successful, otherwise false.

Definition at line 1565 of file ringbuffer.hpp.

◆ get() [2/2]

template<typename Value_type , typename Size_type , bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_memcpy = std::is_trivially_copyable_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
Size_type jau::ringbuffer< Value_type, Size_type, use_memmove, use_memcpy, use_secmem >::get ( Value_type dest,
const Size_type  dest_len,
const Size_type  min_count 
)
inlinenoexcept

Dequeues the oldest enqueued min(dest_len, size()>=min_count) elements by copying them into the given consecutive 'dest' storage.

The ring buffer slots will be released and its value moved to the caller's dest storage, if successful.

Method is non blocking and returns immediately;.

Parameters
destpointer to first storage element of dest_len consecutive elements to store the values, if successful.
dest_lennumber of consecutive elements in dest, hence maximum number of elements to return.
min_countminimum number of consecutive elements to return.
Returns
actual number of elements returned

Definition at line 1582 of file ringbuffer.hpp.

◆ getBlocking() [3/4]

template<typename Value_type , typename Size_type , bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_memcpy = std::is_trivially_copyable_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
Size_type jau::ringbuffer< Value_type, Size_type, use_memmove, use_memcpy, use_secmem >::getBlocking ( Value_type dest,
const Size_type  dest_len,
const Size_type  min_count,
const fraction_i64 timeout,
bool &  timeout_occurred 
)
inlinenoexcept

Dequeues the oldest enqueued min(dest_len, size()>=min_count) elements by copying them into the given consecutive 'dest' storage.

The ring buffer slots will be released and its value moved to the caller's dest storage, if successful.

Parameters
destpointer to first storage element of dest_len consecutive elements to store the values, if successful.
dest_lennumber of consecutive elements in dest, hence maximum number of elements to return.
min_countminimum number of consecutive elements to return
timeoutmaximum duration in fractions of seconds to wait, where fractions_i64::zero waits infinitely
timeout_occurredresult value set to true if a timeout has occurred
Returns
actual number of elements returned

Definition at line 1604 of file ringbuffer.hpp.

◆ getBlocking() [4/4]

template<typename Value_type , typename Size_type , bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_memcpy = std::is_trivially_copyable_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
Size_type jau::ringbuffer< Value_type, Size_type, use_memmove, use_memcpy, use_secmem >::getBlocking ( Value_type dest,
const Size_type  dest_len,
const Size_type  min_count,
const fraction_i64 timeout 
)
inlinenoexcept

Dequeues the oldest enqueued min(dest_len, size()>=min_count) elements by copying them into the given consecutive 'dest' storage.

The ring buffer slots will be released and its value moved to the caller's dest storage, if successful.

Parameters
destpointer to first storage element of dest_len consecutive elements to store the values, if successful.
dest_lennumber of consecutive elements in dest, hence maximum number of elements to return.
min_countminimum number of consecutive elements to return
timeoutmaximum duration in fractions of seconds to wait, where fractions_i64::zero waits infinitely
Returns
actual number of elements returned

Definition at line 1624 of file ringbuffer.hpp.

◆ drop()

template<typename Value_type , typename Size_type , bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_memcpy = std::is_trivially_copyable_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
Size_type jau::ringbuffer< Value_type, Size_type, use_memmove, use_memcpy, use_secmem >::drop ( const Size_type  max_count)
inlinenoexcept

Drops up to max_count oldest enqueued elements, but may drop less if not available.

Method is non blocking and returns immediately;.

Parameters
max_countmaximum number of elements to drop from ringbuffer.
Returns
number of elements dropped

Definition at line 1638 of file ringbuffer.hpp.

Here is the caller graph for this function:

◆ dropBlocking() [1/2]

template<typename Value_type , typename Size_type , bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_memcpy = std::is_trivially_copyable_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
bool jau::ringbuffer< Value_type, Size_type, use_memmove, use_memcpy, use_secmem >::dropBlocking ( const Size_type  count,
const fraction_i64 timeout,
bool &  timeout_occurred 
)
inlinenoexcept

Drops exactly count oldest enqueued elements, will block until they become available.

In count elements are not available to drop even after blocking for timeoutMS, no element will be dropped.

Parameters
countnumber of elements to drop from ringbuffer.
timeoutmaximum duration in fractions of seconds to wait, where fractions_i64::zero waits infinitely
timeout_occurredresult value set to true if a timeout has occurred
Returns
true if successful, otherwise false

Definition at line 1662 of file ringbuffer.hpp.

Here is the caller graph for this function:

◆ dropBlocking() [2/2]

template<typename Value_type , typename Size_type , bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_memcpy = std::is_trivially_copyable_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
bool jau::ringbuffer< Value_type, Size_type, use_memmove, use_memcpy, use_secmem >::dropBlocking ( const Size_type  count,
const fraction_i64 timeout 
)
inlinenoexcept

Drops exactly count oldest enqueued elements, will block until they become available.

In count elements are not available to drop even after blocking for timeoutMS, no element will be dropped.

Parameters
countnumber of elements to drop from ringbuffer.
timeoutmaximum duration in fractions of seconds to wait, where fractions_i64::zero waits infinitely
Returns
true if successful, otherwise false

Definition at line 1684 of file ringbuffer.hpp.

◆ put() [1/3]

template<typename Value_type , typename Size_type , bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_memcpy = std::is_trivially_copyable_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
bool jau::ringbuffer< Value_type, Size_type, use_memmove, use_memcpy, use_secmem >::put ( Value_type &&  e)
inlinenoexcept

Enqueues the given element by moving it into this ringbuffer storage.

Returns true if successful, otherwise false in case buffer is full.

Method is non blocking and returns immediately;.

Parameters
evalue to be moved into this ringbuffer
Returns
true if successful, otherwise false

Definition at line 1699 of file ringbuffer.hpp.

Here is the caller graph for this function:

◆ putBlocking() [1/6]

template<typename Value_type , typename Size_type , bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_memcpy = std::is_trivially_copyable_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
bool jau::ringbuffer< Value_type, Size_type, use_memmove, use_memcpy, use_secmem >::putBlocking ( Value_type &&  e,
const fraction_i64 timeout,
bool &  timeout_occurred 
)
inlinenoexcept

Enqueues the given element by moving it into this ringbuffer storage.

Parameters
evalue to be moved into this ringbuffer
timeoutmaximum duration in fractions of seconds to wait, where fractions_i64::zero waits infinitely
timeout_occurredresult value set to true if a timeout has occurred
Returns
true if successful, otherwise false in case timeout occurred or otherwise.

Definition at line 1717 of file ringbuffer.hpp.

Here is the caller graph for this function:

◆ putBlocking() [2/6]

template<typename Value_type , typename Size_type , bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_memcpy = std::is_trivially_copyable_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
bool jau::ringbuffer< Value_type, Size_type, use_memmove, use_memcpy, use_secmem >::putBlocking ( Value_type &&  e,
const fraction_i64 timeout 
)
inlinenoexcept

Enqueues the given element by moving it into this ringbuffer storage.

Parameters
evalue to be moved into this ringbuffer
timeoutmaximum duration in fractions of seconds to wait, where fractions_i64::zero waits infinitely
Returns
true if successful, otherwise false in case timeout occurred or otherwise.

Definition at line 1733 of file ringbuffer.hpp.

◆ put() [2/3]

template<typename Value_type , typename Size_type , bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_memcpy = std::is_trivially_copyable_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
bool jau::ringbuffer< Value_type, Size_type, use_memmove, use_memcpy, use_secmem >::put ( const Value_type e)
inlinenoexcept

Enqueues the given element by copying it into this ringbuffer storage.

Returns true if successful, otherwise false in case buffer is full.

Method is non blocking and returns immediately;.

Returns
true if successful, otherwise false

Definition at line 1747 of file ringbuffer.hpp.

◆ putBlocking() [3/6]

template<typename Value_type , typename Size_type , bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_memcpy = std::is_trivially_copyable_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
bool jau::ringbuffer< Value_type, Size_type, use_memmove, use_memcpy, use_secmem >::putBlocking ( const Value_type e,
const fraction_i64 timeout,
bool &  timeout_occurred 
)
inlinenoexcept

Enqueues the given element by copying it into this ringbuffer storage.

Parameters
timeoutmaximum duration in fractions of seconds to wait, where fractions_i64::zero waits infinitely
timeout_occurredresult value set to true if a timeout has occurred
Returns
true if successful, otherwise false in case timeout occurred or otherwise.

Definition at line 1764 of file ringbuffer.hpp.

◆ putBlocking() [4/6]

template<typename Value_type , typename Size_type , bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_memcpy = std::is_trivially_copyable_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
bool jau::ringbuffer< Value_type, Size_type, use_memmove, use_memcpy, use_secmem >::putBlocking ( const Value_type e,
const fraction_i64 timeout 
)
inlinenoexcept

Enqueues the given element by copying it into this ringbuffer storage.

Parameters
timeoutmaximum duration in fractions of seconds to wait, where fractions_i64::zero waits infinitely
Returns
true if successful, otherwise false in case timeout occurred or otherwise.

Definition at line 1779 of file ringbuffer.hpp.

◆ put() [3/3]

template<typename Value_type , typename Size_type , bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_memcpy = std::is_trivially_copyable_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
bool jau::ringbuffer< Value_type, Size_type, use_memmove, use_memcpy, use_secmem >::put ( const Value_type first,
const Value_type last 
)
inlinenoexcept

Enqueues the given range of consecutive elements by copying it into this ringbuffer storage.

Returns true if successful, otherwise false in case buffer is full.

Method is non blocking and returns immediately;.

Parameters
firstpointer to first consecutive element to range of value_type [first, last)
lastpointer to last consecutive element to range of value_type [first, last)
Returns
true if successful, otherwise false

Definition at line 1795 of file ringbuffer.hpp.

◆ putBlocking() [5/6]

template<typename Value_type , typename Size_type , bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_memcpy = std::is_trivially_copyable_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
bool jau::ringbuffer< Value_type, Size_type, use_memmove, use_memcpy, use_secmem >::putBlocking ( const Value_type first,
const Value_type last,
const fraction_i64 timeout,
bool &  timeout_occurred 
)
inlinenoexcept

Enqueues the given range of consecutive elementa by copying it into this ringbuffer storage.

Parameters
firstpointer to first consecutive element to range of value_type [first, last)
lastpointer to last consecutive element to range of value_type [first, last)
timeoutmaximum duration in fractions of seconds to wait, where fractions_i64::zero waits infinitely
timeout_occurredresult value set to true if a timeout has occurred
Returns
true if successful, otherwise false in case timeout occurred or otherwise.

Definition at line 1814 of file ringbuffer.hpp.

◆ putBlocking() [6/6]

template<typename Value_type , typename Size_type , bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_memcpy = std::is_trivially_copyable_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
bool jau::ringbuffer< Value_type, Size_type, use_memmove, use_memcpy, use_secmem >::putBlocking ( const Value_type first,
const Value_type last,
const fraction_i64 timeout 
)
inlinenoexcept

Enqueues the given range of consecutive elementa by copying it into this ringbuffer storage.

Parameters
firstpointer to first consecutive element to range of value_type [first, last)
lastpointer to last consecutive element to range of value_type [first, last)
timeoutmaximum duration in fractions of seconds to wait, where fractions_i64::zero waits infinitely
Returns
true if successful, otherwise false in case timeout occurred or otherwise.

Definition at line 1831 of file ringbuffer.hpp.

Member Data Documentation

◆ uses_memmove

template<typename Value_type , typename Size_type , bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_memcpy = std::is_trivially_copyable_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
constexpr const bool jau::ringbuffer< Value_type, Size_type, use_memmove, use_memcpy, use_secmem >::uses_memmove = use_memmove
staticconstexpr

Definition at line 184 of file ringbuffer.hpp.

◆ uses_memcpy

template<typename Value_type , typename Size_type , bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_memcpy = std::is_trivially_copyable_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
constexpr const bool jau::ringbuffer< Value_type, Size_type, use_memmove, use_memcpy, use_secmem >::uses_memcpy = use_memcpy
staticconstexpr

Definition at line 185 of file ringbuffer.hpp.

◆ uses_secmem

template<typename Value_type , typename Size_type , bool use_memmove = std::is_trivially_copyable_v<Value_type> || is_container_memmove_compliant_v<Value_type>, bool use_memcpy = std::is_trivially_copyable_v<Value_type>, bool use_secmem = is_enforcing_secmem_v<Value_type>>
constexpr const bool jau::ringbuffer< Value_type, Size_type, use_memmove, use_memcpy, use_secmem >::uses_secmem = use_secmem
staticconstexpr

Definition at line 186 of file ringbuffer.hpp.


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