#include <AH/Containers/Updatable.hpp>
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.
This version uses static polymorphism using the Curiously Recurring Template Pattern. This requires less virtual function calls.
(Only the destructor is virtual.)
Definition at line 32 of file Updatable.hpp.
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... | |
template<class U , size_t N> | |
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... | |
template<class U , size_t N> | |
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... | |
Public Member Functions | |
virtual | ~UpdatableCRTP () __attribute__((no_sanitize("undefined"))) |
Destructor: remove the updatable from the linked list of instances. More... | |
Protected Member Functions | |
UpdatableCRTP () __attribute__((no_sanitize("undefined"))) | |
Constructor: create an Updatable and add it to the linked list of instances. More... | |
UpdatableCRTP (const UpdatableCRTP &) __attribute__((no_sanitize("undefined"))) | |
UpdatableCRTP & | operator= (const UpdatableCRTP &) |
UpdatableCRTP (UpdatableCRTP &&) __attribute__((no_sanitize("undefined"))) | |
UpdatableCRTP & | operator= (UpdatableCRTP &&) |
Protected Attributes | |
Derived * | next |
Derived * | previous |
Static Protected Attributes | |
static DoublyLinkedList< Derived > | updatables |
|
inlineprotected |
Constructor: create an Updatable and add it to the linked list of instances.
Definition at line 54 of file Updatable.hpp.
|
inlineprotected |
Definition at line 58 of file Updatable.hpp.
|
inlineprotected |
Definition at line 65 of file Updatable.hpp.
|
inlinevirtual |
Destructor: remove the updatable from the linked list of instances.
Definition at line 72 of file Updatable.hpp.
|
inlineprotected |
Definition at line 63 of file Updatable.hpp.
|
inlineprotected |
Definition at line 68 of file Updatable.hpp.
|
inline |
Enable this updatable: insert it into the linked list of instances, so it gets updated automatically.
Definition at line 100 of file Updatable.hpp.
|
inline |
Disable this updatable: remove it from the linked list of instances, so it no longer gets updated automatically.
Definition at line 110 of file Updatable.hpp.
|
inline |
Check if this updatable is enabled.
Definition at line 124 of file Updatable.hpp.
|
inlinestatic |
Enable this updatable: insert it into the linked list of instances, so it gets updated automatically.
Definition at line 129 of file Updatable.hpp.
|
inlinestatic |
Enable this updatable: insert it into the linked list of instances, so it gets updated automatically.
Definition at line 131 of file Updatable.hpp.
|
inlinestatic |
Enable this updatable: insert it into the linked list of instances, so it gets updated automatically.
Definition at line 134 of file Updatable.hpp.
|
inlinestatic |
Disable this updatable: remove it from the linked list of instances, so it no longer gets updated automatically.
Definition at line 140 of file Updatable.hpp.
|
inlinestatic |
Disable this updatable: remove it from the linked list of instances, so it no longer gets updated automatically.
Definition at line 142 of file Updatable.hpp.
|
inlinestatic |
Disable this updatable: remove it from the linked list of instances, so it no longer gets updated automatically.
Definition at line 145 of file Updatable.hpp.
|
inline |
Move down this element in the list.
Definition at line 151 of file Updatable.hpp.
|
staticprotected |
Definition at line 156 of file Updatable.hpp.
|
protectedinherited |
Definition at line 324 of file LinkedList.hpp.
|
protectedinherited |
Definition at line 325 of file LinkedList.hpp.