emlabcpp
modern opinionated embedded C++ library
|
Class implementing circular buffer of any type for up to N elements. More...
#include <static_circular_buffer.h>
Public Types | |
using | index_type = int32_t |
using | value_type = T |
using | size_type = uint32_t |
using | reference = T & |
using | const_reference = T const & |
using | iterator = static_circular_buffer_iterator< T > |
using | const_iterator = static_circular_buffer_iterator< T const > |
Public Member Functions | |
static_circular_buffer () noexcept=default | |
static_circular_buffer (static_circular_buffer const &other) | |
static_circular_buffer (static_circular_buffer &&other) noexcept | |
static_circular_buffer & | operator= (static_circular_buffer const &other) |
static_circular_buffer & | operator= (static_circular_buffer &&other) noexcept |
iterator | begin () |
methods for handling the front side of the circular buffer More... | |
const_iterator | begin () const |
std::reverse_iterator< iterator > | rbegin () |
std::reverse_iterator< const_iterator > | rbegin () const |
reference | front () |
const_reference | front () const |
T | take_front () |
void | pop_front () |
void | pop_front (size_type n) |
iterator | end () |
methods for handling the back side of the circular buffer More... | |
const_iterator | end () const |
std::reverse_iterator< iterator > | rend () |
std::reverse_iterator< const_iterator > | rend () const |
reference | back () |
const_reference | back () const |
void | push_back (T item) |
template<typename... Args> | |
T & | emplace_back (Args &&... args) |
constexpr size_type | capacity () const |
other methods More... | |
size_type | size () const |
bool | empty () const |
bool | full () const |
void | clear () |
~static_circular_buffer () | |
Static Public Attributes | |
static constexpr std::size_t | max_size = N |
Friends | |
template<typename U > | |
class | static_circular_buffer_iterator |
Class implementing circular buffer of any type for up to N elements.
This should work for generic type T, not just simple types.
It is safe in "single consumer single producer" scenario between main loop and interrupts. Because of that the behavior is as follows:
In case of copy or move operations, the buffer does not have to store the data internally in same manner, the data are equivavlent only from the perspective of push/pop operations.
using emlabcpp::static_circular_buffer< T, N >::const_iterator = static_circular_buffer_iterator< T const > |
using emlabcpp::static_circular_buffer< T, N >::const_reference = T const& |
using emlabcpp::static_circular_buffer< T, N >::index_type = int32_t |
using emlabcpp::static_circular_buffer< T, N >::iterator = static_circular_buffer_iterator< T > |
using emlabcpp::static_circular_buffer< T, N >::reference = T& |
using emlabcpp::static_circular_buffer< T, N >::size_type = uint32_t |
using emlabcpp::static_circular_buffer< T, N >::value_type = T |
|
defaultnoexcept |
|
inline |
|
inlinenoexcept |
|
inline |
|
inline |
|
inline |
|
inline |
methods for handling the front side of the circular buffer
References emlabcpp::N.
|
inline |
References emlabcpp::N.
|
inlineconstexpr |
other methods
References emlabcpp::N.
|
inline |
|
inline |
References emlabcpp::args.
|
inline |
|
inline |
methods for handling the back side of the circular buffer
References emlabcpp::N.
|
inline |
References emlabcpp::N.
|
inline |
|
inline |
|
inline |
|
inlinenoexcept |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
References emlabcpp::static_circular_buffer< T, N >::end().
|
inline |
References emlabcpp::static_circular_buffer< T, N >::end().
|
inline |
|
inline |
|
inline |
References emlabcpp::f, and emlabcpp::N.
|
inline |
|
friend |
|
staticconstexpr |