Toolbox snapshot
The Reactive C++ Toolbox
Loading...
Searching...
No Matches
Classes | Public Member Functions | List of all members
toolbox::util::RingBuffer< ValueT > Class Template Reference

#include <toolbox/util/RingBuffer.hpp>

Public Member Functions

 RingBuffer (std::size_t capacity)
 
 ~RingBuffer ()=default
 
 RingBuffer (const RingBuffer &)=delete
 
RingBufferoperator= (const RingBuffer &)=delete
 
 RingBuffer (RingBuffer &&) noexcept=default
 
RingBufferoperator= (RingBuffer &&) noexcept=default
 
bool empty () const noexcept
 Returns true if the container is empty.
 
bool full () const noexcept
 Returns true if the container is full.
 
std::size_t available () const noexcept
 Returns the number of available elements.
 
std::size_t capacity () const noexcept
 
std::size_t max_size () const noexcept
 
std::size_t size () const noexcept
 Returns true if the number of elements in the container.
 
const ValueTfront () const noexcept
 
const ValueTback () const noexcept
 
ValueTfront () noexcept
 
ValueTback () noexcept
 
void clear () noexcept
 
void pop () noexcept
 
void push (const ValueT &val)
 
template<typename FnT >
void fetch (FnT fn)
 
template<typename FnT >
void write (FnT fn)
 

Detailed Description

template<typename ValueT>
class toolbox::util::RingBuffer< ValueT >

Definition at line 28 of file RingBuffer.hpp.

Constructor & Destructor Documentation

◆ RingBuffer() [1/3]

template<typename ValueT >
toolbox::util::RingBuffer< ValueT >::RingBuffer ( std::size_t  capacity)
inlineexplicit

Definition at line 30 of file RingBuffer.hpp.

◆ ~RingBuffer()

◆ RingBuffer() [2/3]

template<typename ValueT >
toolbox::util::RingBuffer< ValueT >::RingBuffer ( const RingBuffer< ValueT > &  )
delete

◆ RingBuffer() [3/3]

template<typename ValueT >
toolbox::util::RingBuffer< ValueT >::RingBuffer ( RingBuffer< ValueT > &&  )
defaultnoexcept

Member Function Documentation

◆ operator=() [1/2]

◆ operator=() [2/2]

◆ empty()

template<typename ValueT >
bool toolbox::util::RingBuffer< ValueT >::empty ( ) const
inlinenoexcept

Returns true if the container is empty.

Definition at line 47 of file RingBuffer.hpp.

◆ full()

template<typename ValueT >
bool toolbox::util::RingBuffer< ValueT >::full ( ) const
inlinenoexcept

Returns true if the container is full.

Definition at line 49 of file RingBuffer.hpp.

Referenced by toolbox::util::RingBuffer< ValueT >::push(), and toolbox::util::RingBuffer< ValueT >::write().

◆ available()

template<typename ValueT >
std::size_t toolbox::util::RingBuffer< ValueT >::available ( ) const
inlinenoexcept

Returns the number of available elements.

Definition at line 51 of file RingBuffer.hpp.

◆ capacity()

template<typename ValueT >
std::size_t toolbox::util::RingBuffer< ValueT >::capacity ( ) const
inlinenoexcept

Returns the maximum number of elements the container can hold. I.e. the container's capacity.

Definition at line 54 of file RingBuffer.hpp.

Referenced by toolbox::util::RingBuffer< ValueT >::max_size().

◆ max_size()

template<typename ValueT >
std::size_t toolbox::util::RingBuffer< ValueT >::max_size ( ) const
inlinenoexcept

Returns the maximum number of elements the container can hold. I.e. the container's capacity.

Definition at line 57 of file RingBuffer.hpp.

◆ size()

template<typename ValueT >
std::size_t toolbox::util::RingBuffer< ValueT >::size ( ) const
inlinenoexcept

Returns true if the number of elements in the container.

Definition at line 59 of file RingBuffer.hpp.

Referenced by toolbox::util::RingBuffer< ValueT >::available(), and toolbox::util::RingBuffer< ValueT >::full().

◆ front() [1/2]

template<typename ValueT >
const ValueT & toolbox::util::RingBuffer< ValueT >::front ( ) const
inlinenoexcept

Definition at line 60 of file RingBuffer.hpp.

◆ back() [1/2]

template<typename ValueT >
const ValueT & toolbox::util::RingBuffer< ValueT >::back ( ) const
inlinenoexcept

Definition at line 61 of file RingBuffer.hpp.

◆ front() [2/2]

template<typename ValueT >
ValueT & toolbox::util::RingBuffer< ValueT >::front ( )
inlinenoexcept

Definition at line 63 of file RingBuffer.hpp.

◆ back() [2/2]

template<typename ValueT >
ValueT & toolbox::util::RingBuffer< ValueT >::back ( )
inlinenoexcept

Definition at line 64 of file RingBuffer.hpp.

◆ clear()

template<typename ValueT >
void toolbox::util::RingBuffer< ValueT >::clear ( )
inlinenoexcept

Definition at line 65 of file RingBuffer.hpp.

◆ pop()

template<typename ValueT >
void toolbox::util::RingBuffer< ValueT >::pop ( )
inlinenoexcept

Definition at line 66 of file RingBuffer.hpp.

◆ push()

template<typename ValueT >
void toolbox::util::RingBuffer< ValueT >::push ( const ValueT val)
inline

Definition at line 67 of file RingBuffer.hpp.

◆ fetch()

template<typename ValueT >
template<typename FnT >
void toolbox::util::RingBuffer< ValueT >::fetch ( FnT  fn)
inline

Definition at line 77 of file RingBuffer.hpp.

◆ write()

template<typename ValueT >
template<typename FnT >
void toolbox::util::RingBuffer< ValueT >::write ( FnT  fn)
inline

Definition at line 84 of file RingBuffer.hpp.


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