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

Strategy for managing indices in circular buffer via empty slot. 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
 
size_type 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 + 1
 

Detailed Description

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

Strategy for managing indices in circular buffer via empty slot.

This strategy uses one slot as empty slot to distinguish between full and empty buffer. Thus the maximum number of storable elements is N-1 where N is the size of the buffer.

Member Typedef Documentation

◆ index_type

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

◆ size_type

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

Member Function Documentation

◆ back_idx()

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

◆ empty()

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

◆ front_idx()

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

◆ full()

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

◆ incr_back() [1/2]

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

◆ incr_back() [2/2]

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

◆ incr_front() [1/2]

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

◆ incr_front() [2/2]

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

◆ last_idx()

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

◆ size()

template<std::size_t N>
size_type emlabcpp::_spacer_strategy< N >::size ( ) const
inlinenoexcept

Member Data Documentation

◆ max_size

template<std::size_t N>
constexpr std::size_t emlabcpp::_spacer_strategy< N >::max_size = N + 1
staticconstexpr

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