Control Surface main
MIDI Control Surface library for Arduino
Loading...
Searching...
No Matches
Classes | Public Member Functions | Private Types | Private Attributes | Static Private Attributes | List of all members
BLEDataGenerator Class Reference

#include <MIDI_Interfaces/BLEMIDI/BLEAPI.hpp>

Detailed Description

Callable that returns the next chunk of data from a BLE packet when called.

Uses type erasure with a static buffer (no dynamic memory allocations).

Definition at line 66 of file BLEAPI.hpp.

+ Collaboration diagram for BLEDataGenerator:

Classes

struct  Impl
 Specific class that implements the type-erased interface, wrapping the type T. More...
 

Public Member Functions

BLEDataView operator() ()
 Get the next chunk of data from the BLE packet.
 
void clear ()
 Release the resources of the underlying data generator.
 
 operator bool () const
 Check if this wrapper contains an underlying data generator.
 
 BLEDataGenerator ()=default
 Create an empty BLEDataGenerator.
 
template<class T , class... Args>
 BLEDataGenerator (compat::in_place_type_t< T >, Args &&...args)
 Store a callable of type T and initialize it by args.
 
template<class T >
 BLEDataGenerator (compat::in_place_t, T &&t)
 Store a callable of type T (with cv qualifiers and references removed) and initialize it by forwarding t.
 
 BLEDataGenerator (const BLEDataGenerator &)=delete
 
BLEDataGeneratoroperator= (const BLEDataGenerator &)=delete
 
 BLEDataGenerator (BLEDataGenerator &&other) noexcept
 
BLEDataGeneratoroperator= (BLEDataGenerator &&other) noexcept
 
 ~BLEDataGenerator ()
 

Private Types

using buffer_align_t = max_align_t
 Alignment of the buffer to allocate the underlying data generator.
 

Private Attributes

compat::byte storage [capacity]
 Buffer used for allocation of the underlying data generator.
 
Iface * instance = nullptr
 

Static Private Attributes

static constexpr size_t capacity = 4 * sizeof(void *) - sizeof(Iface *)
 Size of the buffer to allocate the underlying data generator.
 

Member Typedef Documentation

◆ buffer_align_t

using buffer_align_t = max_align_t
private

Alignment of the buffer to allocate the underlying data generator.

Definition at line 102 of file BLEAPI.hpp.

Constructor & Destructor Documentation

◆ BLEDataGenerator() [1/5]

BLEDataGenerator ( )
default

Create an empty BLEDataGenerator.

◆ BLEDataGenerator() [2/5]

template<class T , class... Args>
BLEDataGenerator ( compat::in_place_type_t< T > ,
Args &&... args )

Store a callable of type T and initialize it by args.

◆ BLEDataGenerator() [3/5]

template<class T >
BLEDataGenerator ( compat::in_place_t ,
T && t )

Store a callable of type T (with cv qualifiers and references removed) and initialize it by forwarding t.

◆ BLEDataGenerator() [4/5]

BLEDataGenerator ( const BLEDataGenerator & )
delete

◆ BLEDataGenerator() [5/5]

BLEDataGenerator ( BLEDataGenerator && other)
noexcept

◆ ~BLEDataGenerator()

~BLEDataGenerator ( )
inline

Definition at line 92 of file BLEAPI.hpp.

Member Function Documentation

◆ operator()()

BLEDataView operator() ( )

Get the next chunk of data from the BLE packet.

Returns a chunk of size zero to indicate completion.

Precondition
This wrapper is not empty.
There is still data available. Calling this function again after the previous call returned an empty chunk is not allowed.

◆ clear()

void clear ( )

Release the resources of the underlying data generator.

◆ operator bool()

operator bool ( ) const
inlineexplicit

Check if this wrapper contains an underlying data generator.

Definition at line 77 of file BLEAPI.hpp.

◆ operator=() [1/2]

BLEDataGenerator & operator= ( const BLEDataGenerator & )
delete

◆ operator=() [2/2]

BLEDataGenerator & operator= ( BLEDataGenerator && other)
noexcept

Member Data Documentation

◆ capacity

constexpr size_t capacity = 4 * sizeof(void *) - sizeof(Iface *)
staticconstexprprivate

Size of the buffer to allocate the underlying data generator.

Definition at line 104 of file BLEAPI.hpp.

◆ storage

compat::byte storage[capacity]
private

Buffer used for allocation of the underlying data generator.

Definition at line 106 of file BLEAPI.hpp.

◆ instance

Iface* instance = nullptr
private

Definition at line 108 of file BLEAPI.hpp.


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