Arduino Helpers master
Utility library for Arduino
Protected Attributes | Static Protected Attributes | List of all members
Updatable< T > Class Template Referenceabstract

#include <AH/Containers/Updatable.hpp>

Detailed Description

template<class T = NormalUpdatable>
class Updatable< T >

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 169 of file Updatable.hpp.

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

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...
 

Enabling and disabling updatables

void enable ()
 Enable this updatable: insert it into the linked list of instances, so it 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
 Check if this updatable is enabled. 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...
 

Protected Attributes

Updatable< NormalUpdatable > * next
 
Updatable< NormalUpdatable > * previous
 

Static Protected Attributes

static DoublyLinkedList< Updatable< NormalUpdatable > > updatables
 

Member Function Documentation

◆ begin()

virtual void begin ( )
pure virtual

Initialize this updatable.

◆ update()

virtual void update ( )
pure virtual

Update this updatable.

◆ beginAll()

static void beginAll ( )
inlinestatic

Begin all enabled instances of this class.

See also
begin()

Definition at line 182 of file Updatable.hpp.

◆ updateAll()

static void updateAll ( )
inlinestatic

Update all enabled instances of this class.

See also
update()

Definition at line 186 of file Updatable.hpp.

◆ enable() [1/4]

void enable ( )
inlineinherited

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

Definition at line 96 of file Updatable.hpp.

◆ enable() [2/4]

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

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

Definition at line 125 of file Updatable.hpp.

◆ enable() [3/4]

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

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

Definition at line 127 of file Updatable.hpp.

◆ enable() [4/4]

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 130 of file Updatable.hpp.

◆ disable() [1/4]

void disable ( )
inlineinherited

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

Definition at line 106 of file Updatable.hpp.

◆ disable() [2/4]

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

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

Definition at line 136 of file Updatable.hpp.

◆ disable() [3/4]

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

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

Definition at line 138 of file Updatable.hpp.

◆ disable() [4/4]

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 141 of file Updatable.hpp.

◆ isEnabled()

bool isEnabled ( ) 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 120 of file Updatable.hpp.

◆ moveDown()

void moveDown ( )
inlineinherited

Move down this element in the list.

Definition at line 147 of file Updatable.hpp.

Member Data Documentation

◆ updatables

DoublyLinkedList< Updatable< NormalUpdatable > > updatables
staticprotectedinherited

Definition at line 152 of file Updatable.hpp.

◆ next

Updatable< NormalUpdatable > * next
protectedinherited

Definition at line 320 of file LinkedList.hpp.

◆ previous

Updatable< NormalUpdatable > * previous
protectedinherited

Definition at line 321 of file LinkedList.hpp.


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