emlabcpp
modern opinionated embedded C++ library
emlabcpp::_overflow_strategy< N > Struct Template Reference

Strategy for managing indices in circular buffer via overflowing indices. More...

#include <static_circular_buffer.h>

Public Types

using index_type = decltype(_select_index_type< N >())
 
using size_type = typename index_type::value_type
 

Public Member Functions

void incr_front () noexcept
 
void incr_front (size_type n) noexcept
 
auto front_idx () const noexcept
 
void incr_back () noexcept
 
void incr_back (size_type n) noexcept
 
auto back_idx () const noexcept
 
auto size () const noexcept
 
bool empty () const noexcept
 
bool full () const noexcept
 
index_type last_idx () const noexcept
 

Static Public Attributes

static constexpr std::size_t max_size = N
 

Detailed Description

template<std::size_t N>
struct emlabcpp::_overflow_strategy< N >

Strategy for managing indices in circular buffer via overflowing indices.

This strategy allows to use all N slots of the buffer by allowing the indices to overflow. This works correctly as long as buffer size is power of two.

Member Typedef Documentation

◆ index_type

template<std::size_t N>
using emlabcpp::_overflow_strategy< N >::index_type = decltype( _select_index_type< N >() )

◆ size_type

template<std::size_t N>
using emlabcpp::_overflow_strategy< N >::size_type = typename index_type::value_type

Member Function Documentation

◆ back_idx()

template<std::size_t N>
auto emlabcpp::_overflow_strategy< N >::back_idx ( ) const
inlinenoexcept

◆ empty()

template<std::size_t N>
bool emlabcpp::_overflow_strategy< N >::empty ( ) const
inlinenoexcept

◆ front_idx()

template<std::size_t N>
auto emlabcpp::_overflow_strategy< N >::front_idx ( ) const
inlinenoexcept

◆ full()

template<std::size_t N>
bool emlabcpp::_overflow_strategy< N >::full ( ) const
inlinenoexcept

◆ incr_back() [1/2]

template<std::size_t N>
void emlabcpp::_overflow_strategy< N >::incr_back ( )
inlinenoexcept

◆ incr_back() [2/2]

template<std::size_t N>
void emlabcpp::_overflow_strategy< N >::incr_back ( size_type  n)
inlinenoexcept

◆ incr_front() [1/2]

template<std::size_t N>
void emlabcpp::_overflow_strategy< N >::incr_front ( )
inlinenoexcept

◆ incr_front() [2/2]

template<std::size_t N>
void emlabcpp::_overflow_strategy< N >::incr_front ( size_type  n)
inlinenoexcept

◆ last_idx()

template<std::size_t N>
index_type emlabcpp::_overflow_strategy< N >::last_idx ( ) const
inlinenoexcept

◆ size()

template<std::size_t N>
auto emlabcpp::_overflow_strategy< N >::size ( ) const
inlinenoexcept

Member Data Documentation

◆ max_size

template<std::size_t N>
constexpr std::size_t emlabcpp::_overflow_strategy< N >::max_size = N
staticconstexpr

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