Control Surface  1.2.0
MIDI Control Surface library for Arduino
Public Types | Static Public Member Functions | Protected Attributes | Static Protected Attributes | List of all members
Updatable< T, ThreadSafe > Class Template Referenceabstract

A super class for object that have to be updated regularly. More...

#include <AH/Containers/Updatable.hpp>

+ Inheritance diagram for Updatable< T, ThreadSafe >:
+ Collaboration diagram for Updatable< T, ThreadSafe >:

Public Types

using Mutex = typename std::conditional< ThreadSafe, DefaultMutEx, EmptyMutex >::type
 
using LockGuard = typename std::conditional< ThreadSafe, DefaultLockGuard< Mutex >, EmptyLockGuard< Mutex > >::type
 

Static Public Member Functions

static MutexgetMutex ()
 

Protected Attributes

Updatable< NormalUpdatable, false > * next
 
Updatable< NormalUpdatable, false > * previous
 

Static Protected Attributes

static DoublyLinkedList< Updatable< NormalUpdatable, false > > updatables
 
static Mutex mutex
 

Main initialization and updating methods

static void applyToAll (const LockGuard &, void(Derived::*method)(Args &&...), Args &&... args)
 
static void applyToAll (void(Derived::*method)(Args &&...), Args &&... args)
 

Enabling and disabling updatables

void enable (const LockGuard &lock)
 Enable this updatable: insert it into the linked list of instances, so it gets updated automatically. More...
 
void enable ()
 Enable this updatable: insert it into the linked list of instances, so it gets updated automatically. More...
 
void disable (const LockGuard &lock)
 Disable this updatable: remove it from the linked list of instances, so it no longer gets updated automatically. More...
 
void disable ()
 Disable this updatable: remove it from the linked list of instances, so it no longer gets updated automatically. More...
 
bool isEnabled (const LockGuard &) const
 Check if this updatable is enabled. More...
 
bool isEnabled ()
 Check if this updatable is enabled. More...
 
void moveDown (const LockGuard &)
 Move down this element in the list. More...
 
void moveDown ()
 Move down this element in the list. More...
 
static void enable (UpdatableCRTP *element)
 Enable this updatable: insert it into the linked list of instances, so it gets updated automatically. More...
 
static void enable (UpdatableCRTP &element)
 Enable this updatable: insert it into the linked list of instances, so it gets updated automatically. More...
 
static void enable (U(&array)[N])
 Enable this updatable: insert it into the linked list of instances, so it gets updated automatically. More...
 
static void disable (UpdatableCRTP *element)
 Disable this updatable: remove it from the linked list of instances, so it no longer gets updated automatically. More...
 
static void disable (UpdatableCRTP &element)
 Disable this updatable: remove it from the linked list of instances, so it no longer gets updated automatically. More...
 
static void disable (U(&array)[N])
 Disable this updatable: remove it from the linked list of instances, so it no longer gets updated automatically. More...
 

Main initialization and updating methods

virtual void begin ()=0
 Initialize this updatable. More...
 
virtual void update ()=0
 Update this updatable. More...
 
static void beginAll ()
 Begin all enabled instances of this class. More...
 
static void updateAll ()
 Update all enabled instances of this class. More...
 

Detailed Description

template<class T = NormalUpdatable, bool ThreadSafe = false>
class AH::Updatable< T, ThreadSafe >

A super class for object that have to be updated regularly.

All instances of this class are kept in a linked list, so it's easy to iterate over all of them to update them.

Definition at line 195 of file Updatable.hpp.

Member Typedef Documentation

◆ Mutex

using Mutex = typename std::conditional<ThreadSafe, DefaultMutEx, EmptyMutex>::type
inherited

Definition at line 36 of file Updatable.hpp.

◆ LockGuard

using LockGuard = typename std::conditional<ThreadSafe, DefaultLockGuard<Mutex>, EmptyLockGuard<Mutex> >::type
inherited

Definition at line 38 of file Updatable.hpp.

Member Function Documentation

◆ begin()

virtual void begin ( )
pure virtual

Initialize this updatable.

Implemented in GenericSwitchSelector< Callback >, GenericSwitchSelector< SelectorSingleLEDCallback >, GenericSwitchSelector<>, GenericSelector< N, Callback >, GenericSelector< N >, GenericSelector< N, SelectorLEDsCallback< N > >, GenericSelector< 2, EmptySelectorCallback >, GenericSelector< N, EmptySelectorCallback >, GenericSelector< 2, SelectorSingleLEDCallback >, GenericProgramChangeSelector< N, Callback >, GenericProgramChangeSelector< N >, GenericProgramChangeSelector< N, SelectorLEDsCallback< N > >, GenericManyButtonsSelector< N, Callback >, GenericManyButtonsSelector< N >, GenericManyButtonsSelector< N, SelectorLEDsCallback< N > >, GenericIncrementSelector< N, Callback >, GenericIncrementSelector< N >, GenericIncrementSelector< N, SelectorLEDsCallback< N > >, GenericIncrementDecrementSelector< N, Callback >, GenericIncrementDecrementSelector< N >, GenericIncrementDecrementSelector< N, SelectorLEDsCallback< N > >, GenericEncoderSelector< N, Callback >, GenericEncoderSelector< N >, GenericEncoderSelector< N, SelectorLEDsCallback< N > >, SmartMIDIFilteredAnalog< NumBanks, BankAddress, Sender >, SmartMIDIFilteredAnalog< NumBanks, SingleAddress, PitchBendSender< 10 > >, SmartMIDIFilteredAnalog< NumBanks, SingleAddress, ContinuousCCSender >, MIDIIncrementDecrementButtons< BankAddress, RelativeSender, ResetSender >, MIDIIncrementDecrementButtons< DualManyAddresses< NumBanks >, RelativeCCSender, DigitalNoteSender >, MIDIIncrementDecrementButtons< DualAddresses, RelativeCCSender, DigitalNoteSender >, MIDIFilteredAnalogAddressable< BankAddress, Sender >, MIDIFilteredAnalogAddressable< ManyAddresses< NumBanks >, ContinuousCCSender >, MIDIFilteredAnalogAddressable< SingleAddress, ContinuousCCSender >, MIDIChordButton< Sender >, MIDIChordButton< DigitalNoteSender >, MIDIButtonMatrix< BankAddress, Sender, nb_rows, nb_cols >, MIDIButtonMatrix< ManyMatrixAddresses< NumBanks, nb_rows, nb_cols >, DigitalCCSender, nb_rows, nb_cols >, MIDIButtonMatrix< MatrixAddress< nb_rows, nb_cols >, DigitalNoteSender, nb_rows, nb_cols >, MIDIButtonMatrix< ManyMatrixAddresses< NumBanks, nb_rows, nb_cols >, DigitalNoteSender, nb_rows, nb_cols >, MIDIButtonMatrix< MatrixAddress< nb_rows, nb_cols >, DigitalCCSender, nb_rows, nb_cols >, MIDIButtonLatching< BankAddress, Sender >, MIDIButtonLatching< SingleAddress, DigitalNoteSender >, MIDIButtonLatching< SingleAddress, DigitalCCSender >, MIDIButtonLatched< NumBanks, BankAddress, Sender >, MIDIButtonLatched< NumBanks, SingleAddress, DigitalNoteSender >, MIDIButtonLatched< NumBanks, SingleAddress, DigitalCCSender >, MIDIButton< BankAddress, Sender >, MIDIButton< SingleAddress, ProgramChangeSender >, MIDIButton< SingleAddress, DigitalNoteSender >, MIDIButton< ManyAddresses< NumBanks >, DigitalNoteSender >, MIDIButton< SingleAddress, DigitalCCSender >, MIDIButton< ManyAddresses< NumBanks >, ProgramChangeSender >, MIDIButton< ManyAddresses< NumBanks >, DigitalCCSender >, MIDIIncrementDecrementButtons< RelativeSender, ResetSender >, MIDIIncrementDecrementButtons< RelativeCCSender, DigitalNoteSender >, MIDIFilteredAnalogAddressable< Sender >, MIDIFilteredAnalogAddressable< ContinuousCCSender >, MIDIButtonLatching< Sender >, MIDIButtonLatching< DigitalNoteSender >, MIDIButtonLatching< DigitalCCSender >, MIDIButton< Sender >, MIDIButton< DigitalNoteSender >, MIDIButton< DigitalCCSender >, MIDIButton< ProgramChangeSender >, MIDIAbsoluteEncoder< Sender >, MIDIAbsoluteEncoder< PitchBendSender< 14 > >, MIDIAbsoluteEncoder< ContinuousCCSender >, FortySevenEffectsMIDI_Interface< MidiInterface >, SerialMIDI_Interface< T >, SerialMIDI_Interface< HardwareSerial >, SerialMIDI_Interface< decltype(Serial)>, SerialMIDI_Interface< SoftwareSerial >, MIDI_Interface, SerialDebugMIDI_Interface< T >, SerialDebugMIDI_Interface< HardwareSerial >, SerialDebugMIDI_Interface< decltype(Serial)>, SerialDebugMIDI_Interface< SoftwareSerial >, BluetoothMIDI_Interface, VolumeControl< N >, AudioVULEDs< N >, MIDIRotaryEncoder< BankAddress, Sender >, MIDIRotaryEncoder< ManyAddresses< NumBanks >, RelativeCCSender >, MIDIRotaryEncoder< SingleAddress, RelativeCCSender >, MIDIFilteredAnalog< BankAddress, Sender >, MIDIFilteredAnalog< SingleAddress, PitchBendSender< 10 > >, MIDIFilteredAnalog< ManyAddresses< NumBanks >, PitchBendSender< 10 > >, MIDIButtons< BankAddress, Sender, NumButtons >, MIDIButtons< SingleAddress, DigitalCCSender, NumButtons >, MIDIButtons< SingleAddress, DigitalNoteSender, NumButtons >, MIDIRotaryEncoder< Sender >, MIDIRotaryEncoder< RelativeCCSender >, MIDIFilteredAnalog< Sender >, MIDIFilteredAnalog< PitchBendSender< 10 > >, MIDIChordButton< Sender >, MIDIChordButton< DigitalNoteSender >, MIDIButtons< Sender, NumButtons >, MIDIButtons< DigitalCCSender, NumButtons >, MIDIButtons< DigitalNoteSender, NumButtons >, MIDIButtonMatrix< Sender, nb_rows, nb_cols >, MIDIButtonMatrix< DigitalCCSender, nb_rows, nb_cols >, MIDIButtonMatrix< DigitalNoteSender, nb_rows, nb_cols >, MIDIButtonLatched< Sender >, MIDIButtonLatched< DigitalNoteSender >, and MIDIButtonLatched< DigitalCCSender >.

◆ update()

virtual void update ( )
pure virtual

Update this updatable.

Implemented in MIDI_Interface, GenericSwitchSelector< Callback >, GenericSwitchSelector< SelectorSingleLEDCallback >, GenericSwitchSelector<>, GenericSelector< N, Callback >, GenericSelector< N >, GenericSelector< N, SelectorLEDsCallback< N > >, GenericSelector< 2, EmptySelectorCallback >, GenericSelector< N, EmptySelectorCallback >, GenericSelector< 2, SelectorSingleLEDCallback >, GenericManyButtonsSelector< N, Callback >, GenericManyButtonsSelector< N >, GenericManyButtonsSelector< N, SelectorLEDsCallback< N > >, GenericIncrementSelector< N, Callback >, GenericIncrementSelector< N >, GenericIncrementSelector< N, SelectorLEDsCallback< N > >, GenericIncrementDecrementSelector< N, Callback >, GenericIncrementDecrementSelector< N >, GenericIncrementDecrementSelector< N, SelectorLEDsCallback< N > >, GenericEncoderSelector< N, Callback >, GenericEncoderSelector< N >, GenericEncoderSelector< N, SelectorLEDsCallback< N > >, SmartMIDIFilteredAnalog< NumBanks, BankAddress, Sender >, SmartMIDIFilteredAnalog< NumBanks, SingleAddress, PitchBendSender< 10 > >, SmartMIDIFilteredAnalog< NumBanks, SingleAddress, ContinuousCCSender >, MIDIIncrementDecrementButtons< BankAddress, RelativeSender, ResetSender >, MIDIIncrementDecrementButtons< DualManyAddresses< NumBanks >, RelativeCCSender, DigitalNoteSender >, MIDIIncrementDecrementButtons< DualAddresses, RelativeCCSender, DigitalNoteSender >, MIDIFilteredAnalogAddressable< BankAddress, Sender >, MIDIFilteredAnalogAddressable< ManyAddresses< NumBanks >, ContinuousCCSender >, MIDIFilteredAnalogAddressable< SingleAddress, ContinuousCCSender >, MIDIChordButton< Sender >, MIDIChordButton< DigitalNoteSender >, MIDIButtonMatrix< BankAddress, Sender, nb_rows, nb_cols >, MIDIButtonMatrix< ManyMatrixAddresses< NumBanks, nb_rows, nb_cols >, DigitalCCSender, nb_rows, nb_cols >, MIDIButtonMatrix< MatrixAddress< nb_rows, nb_cols >, DigitalNoteSender, nb_rows, nb_cols >, MIDIButtonMatrix< ManyMatrixAddresses< NumBanks, nb_rows, nb_cols >, DigitalNoteSender, nb_rows, nb_cols >, MIDIButtonMatrix< MatrixAddress< nb_rows, nb_cols >, DigitalCCSender, nb_rows, nb_cols >, MIDIButtonLatching< BankAddress, Sender >, MIDIButtonLatching< SingleAddress, DigitalNoteSender >, MIDIButtonLatching< SingleAddress, DigitalCCSender >, MIDIButtonLatched< NumBanks, BankAddress, Sender >, MIDIButtonLatched< NumBanks, SingleAddress, DigitalNoteSender >, MIDIButtonLatched< NumBanks, SingleAddress, DigitalCCSender >, MIDIButton< BankAddress, Sender >, MIDIButton< SingleAddress, ProgramChangeSender >, MIDIButton< SingleAddress, DigitalNoteSender >, MIDIButton< ManyAddresses< NumBanks >, DigitalNoteSender >, MIDIButton< SingleAddress, DigitalCCSender >, MIDIButton< ManyAddresses< NumBanks >, ProgramChangeSender >, MIDIButton< ManyAddresses< NumBanks >, DigitalCCSender >, MIDIIncrementDecrementButtons< RelativeSender, ResetSender >, MIDIIncrementDecrementButtons< RelativeCCSender, DigitalNoteSender >, MIDIFilteredAnalogAddressable< Sender >, MIDIFilteredAnalogAddressable< ContinuousCCSender >, MIDIButtonLatching< Sender >, MIDIButtonLatching< DigitalNoteSender >, MIDIButtonLatching< DigitalCCSender >, MIDIButton< Sender >, MIDIButton< DigitalNoteSender >, MIDIButton< DigitalCCSender >, MIDIButton< ProgramChangeSender >, MIDIAbsoluteEncoder< Sender >, MIDIAbsoluteEncoder< PitchBendSender< 14 > >, MIDIAbsoluteEncoder< ContinuousCCSender >, Parsing_MIDI_Interface, BluetoothMIDI_Interface, VolumeControl< N >, AudioVULEDs< N >, MIDIRotaryEncoder< BankAddress, Sender >, MIDIRotaryEncoder< ManyAddresses< NumBanks >, RelativeCCSender >, MIDIRotaryEncoder< SingleAddress, RelativeCCSender >, MIDIFilteredAnalog< BankAddress, Sender >, MIDIFilteredAnalog< SingleAddress, PitchBendSender< 10 > >, MIDIFilteredAnalog< ManyAddresses< NumBanks >, PitchBendSender< 10 > >, MIDIButtons< BankAddress, Sender, NumButtons >, MIDIButtons< SingleAddress, DigitalCCSender, NumButtons >, MIDIButtons< SingleAddress, DigitalNoteSender, NumButtons >, MIDIRotaryEncoder< Sender >, MIDIRotaryEncoder< RelativeCCSender >, MIDIFilteredAnalog< Sender >, MIDIFilteredAnalog< PitchBendSender< 10 > >, MIDIChordButton< Sender >, MIDIChordButton< DigitalNoteSender >, MIDIButtons< Sender, NumButtons >, MIDIButtons< DigitalCCSender, NumButtons >, MIDIButtons< DigitalNoteSender, NumButtons >, MIDIButtonMatrix< Sender, nb_rows, nb_cols >, MIDIButtonMatrix< DigitalCCSender, nb_rows, nb_cols >, MIDIButtonMatrix< DigitalNoteSender, nb_rows, nb_cols >, MIDIButtonLatched< Sender >, MIDIButtonLatched< DigitalNoteSender >, and MIDIButtonLatched< DigitalCCSender >.

◆ beginAll()

static void beginAll ( )
inlinestatic

Begin all enabled instances of this class.

See also
begin()

Definition at line 208 of file Updatable.hpp.

◆ updateAll()

static void updateAll ( )
inlinestatic

Update all enabled instances of this class.

See also
update()

Definition at line 212 of file Updatable.hpp.

◆ getMutex()

static Mutex& getMutex ( )
inlinestaticinherited

Definition at line 79 of file Updatable.hpp.

◆ applyToAll() [1/2]

static void applyToAll ( const LockGuard ,
void(Derived::*)(Args &&...)  method,
Args &&...  args 
)
inlinestaticinherited

Definition at line 85 of file Updatable.hpp.

◆ applyToAll() [2/2]

static void applyToAll ( void(Derived::*)(Args &&...)  method,
Args &&...  args 
)
inlinestaticinherited

Definition at line 93 of file Updatable.hpp.

◆ enable() [1/5]

void enable ( const LockGuard lock)
inlineinherited

Enable this updatable: insert it into the linked list of instances, so it gets updated automatically.

Definition at line 106 of file Updatable.hpp.

◆ enable() [2/5]

void enable ( )
inlineinherited

Enable this updatable: insert it into the linked list of instances, so it gets updated automatically.

Definition at line 115 of file Updatable.hpp.

◆ enable() [3/5]

static void enable ( UpdatableCRTP< Updatable< NormalUpdatable, false >, false > *  element)
inlinestaticinherited

Enable this updatable: insert it into the linked list of instances, so it gets updated automatically.

Definition at line 144 of file Updatable.hpp.

◆ enable() [4/5]

static void enable ( UpdatableCRTP< Updatable< NormalUpdatable, false >, false > &  element)
inlinestaticinherited

Enable this updatable: insert it into the linked list of instances, so it gets updated automatically.

Definition at line 146 of file Updatable.hpp.

◆ enable() [5/5]

static void enable ( U(&)  array[N])
inlinestaticinherited

Enable this updatable: insert it into the linked list of instances, so it gets updated automatically.

Definition at line 149 of file Updatable.hpp.

◆ disable() [1/5]

void disable ( const LockGuard lock)
inlineinherited

Disable this updatable: remove it from the linked list of instances, so it no longer gets updated automatically.

Definition at line 119 of file Updatable.hpp.

◆ disable() [2/5]

void disable ( )
inlineinherited

Disable this updatable: remove it from the linked list of instances, so it no longer gets updated automatically.

Definition at line 128 of file Updatable.hpp.

◆ disable() [3/5]

static void disable ( UpdatableCRTP< Updatable< NormalUpdatable, false >, false > *  element)
inlinestaticinherited

Disable this updatable: remove it from the linked list of instances, so it no longer gets updated automatically.

Definition at line 155 of file Updatable.hpp.

◆ disable() [4/5]

static void disable ( UpdatableCRTP< Updatable< NormalUpdatable, false >, false > &  element)
inlinestaticinherited

Disable this updatable: remove it from the linked list of instances, so it no longer gets updated automatically.

Definition at line 157 of file Updatable.hpp.

◆ disable() [5/5]

static void disable ( U(&)  array[N])
inlinestaticinherited

Disable this updatable: remove it from the linked list of instances, so it no longer gets updated automatically.

Definition at line 160 of file Updatable.hpp.

◆ isEnabled() [1/2]

bool isEnabled ( const LockGuard ) const
inlineinherited

Check if this updatable is enabled.

Note
Assumes that the updatable is not added to a different linked list by the user.

Definition at line 136 of file Updatable.hpp.

◆ isEnabled() [2/2]

bool isEnabled ( )
inlineinherited

Check if this updatable is enabled.

Note
Assumes that the updatable is not added to a different linked list by the user.

Definition at line 141 of file Updatable.hpp.

◆ moveDown() [1/2]

void moveDown ( const LockGuard )
inlineinherited

Move down this element in the list.

Definition at line 166 of file Updatable.hpp.

◆ moveDown() [2/2]

void moveDown ( )
inlineinherited

Move down this element in the list.

Definition at line 168 of file Updatable.hpp.

Member Data Documentation

◆ updatables

DoublyLinkedList< Updatable< NormalUpdatable, false > > updatables
staticprotectedinherited

Definition at line 173 of file Updatable.hpp.

◆ mutex

UpdatableCRTP< Updatable< NormalUpdatable, false > , ThreadSafe >::Mutex mutex
staticprotectedinherited

Definition at line 174 of file Updatable.hpp.

◆ next

Updatable< NormalUpdatable, false > * next
protectedinherited

Definition at line 323 of file LinkedList.hpp.

◆ previous

Updatable< NormalUpdatable, false > * previous
protectedinherited

Definition at line 324 of file LinkedList.hpp.


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