31#ifndef ETL_BUFFER_DESCRIPTORS_INCLUDED
32#define ETL_BUFFER_DESCRIPTORS_INCLUDED
38#include "static_assert.h"
51 template <
typename TBuffer,
size_t BUFFER_SIZE_,
size_t N_BUFFERS_,
typename TFlag =
bool>
52 class buffer_descriptors
61 typedef value_type* pointer;
62 typedef size_t size_type;
66 static ETL_CONSTANT size_type BUFFER_SIZE =
BUFFER_SIZE_;
75 friend class buffer_descriptors;
77 static ETL_CONSTANT size_type MAX_SIZE = buffer_descriptors::BUFFER_SIZE;
81 : pdesc_item(ETL_NULLPTR)
86 descriptor(
const descriptor& other)
87 : pdesc_item(other.pdesc_item)
92 descriptor& operator =(
const descriptor& other)
94 pdesc_item = other.pdesc_item;
101 assert(pdesc_item != ETL_NULLPTR);
102 return pdesc_item->pbuffer;
107 ETL_CONSTEXPR size_type
max_size()
const
114 bool is_allocated()
const
116 return bool(pdesc_item->in_use);
121 bool is_released()
const
123 return bool(!pdesc_item->in_use);
128 bool is_valid()
const
130 return pdesc_item != ETL_NULLPTR;
136 pdesc_item->in_use =
false;
142 descriptor(descriptor_item* pdesc_item_)
143 : pdesc_item(pdesc_item_)
150 pdesc_item->in_use =
true;;
154 descriptor_item* pdesc_item;
172 notification(descriptor desc_,
size_t count_)
180 descriptor get_descriptor()
const
187 size_t get_count()
const
213 void set_callback(
const callback_type&
callback_)
231 bool is_valid()
const
233 return callback.is_valid();
240 if (callback.is_valid())
252 if (
desc.is_released())
274 etl::fill_n(
desc.data(), BUFFER_SIZE, fill_);
286 volatile flag_type in_use;
289 callback_type callback;
294 template <
typename TBuffer,
size_t BUFFER_SIZE_,
size_t N_BUFFERS_,
typename TFlag>
295 ETL_CONSTANT
typename buffer_descriptors<TBuffer, BUFFER_SIZE_, N_BUFFERS_, TFlag>::size_type buffer_descriptors<TBuffer, BUFFER_SIZE_, N_BUFFERS_, TFlag>::N_BUFFERS;
297 template <
typename TBuffer,
size_t BUFFER_SIZE_,
size_t N_BUFFERS_,
typename TFlag>
298 ETL_CONSTANT
typename buffer_descriptors<TBuffer, BUFFER_SIZE_, N_BUFFERS_, TFlag>::size_type buffer_descriptors<TBuffer, BUFFER_SIZE_, N_BUFFERS_, TFlag>::BUFFER_SIZE;
300 template <
typename TBuffer,
size_t BUFFER_SIZE_,
size_t N_BUFFERS_,
typename TFlag>
301 ETL_CONSTANT
typename buffer_descriptors<TBuffer, BUFFER_SIZE_, N_BUFFERS_, TFlag>::size_type buffer_descriptors<TBuffer, BUFFER_SIZE_, N_BUFFERS_, TFlag>::descriptor::MAX_SIZE;
Provides a value that cycles between two limits.
Definition cyclic_value.h:53
Declaration.
Definition delegate_cpp03.h:191
bitset_ext
Definition absolute.h:38
size_t max_size() const
Returns the maximum number of items in the variant_pool.
Definition variant_pool_generator.h:395
pair holds two objects of arbitrary type
Definition utility.h:164
ETL_CONSTEXPR pair()
Default constructor.
Definition utility.h:176