|
Sparkle 0.0.1
|
Tracks a state value and triggers callbacks per-state. More...
#include <spk_stateful_object.hpp>

Public Member Functions | |
| StatefulObject (const TType &p_initialState) | |
| Builds with an initial state. | |
| StatefulObject (const StatefulObject &p_other)=delete | |
| StatefulObject & | operator= (const StatefulObject &p_other)=delete |
| StatefulObject (StatefulObject &&p_other) noexcept | |
| Move-constructs, transferring state and callbacks. | |
| StatefulObject & | operator= (StatefulObject &&p_other) noexcept |
| Move-assigns, transferring state and callbacks. | |
| void | setState (const TType &p_newState) |
| Sets a new state and triggers callbacks registered for it. | |
| TType | state () const |
| Returns the current state. | |
| Contract | addCallback (const TType &p_state, const Job &p_callback) |
| Subscribes a callback for a specific state. | |
Tracks a state value and triggers callbacks per-state.
| TType | State type (hashable for map keys). |
|
inline |
Builds with an initial state.
| p_initialState | Initial state value. |
|
inlinenoexcept |
Move-constructs, transferring state and callbacks.
| p_other | Source object. |
|
inline |
Subscribes a callback for a specific state.
| p_state | State for which to run the callback. |
| p_callback | Callback to execute. |

|
inlinenoexcept |
Move-assigns, transferring state and callbacks.
| p_other | Source object. |
|
inline |
Sets a new state and triggers callbacks registered for it.
| p_newState | New state value. |

|
inline |
Returns the current state.
