#include <icy/stateful.h>State machine implementation.
For an example See also: PacketStream
The derived [State](icy-State.html#state) type.| Return | Name | Description |
|---|---|---|
Signal< void(void *, T &, const T &)> | StateChange | Signals when the state changes. |
Signal< void(void *, T &, const T &)> StateChangeSignals when the state changes.
| Return | Name | Description |
|---|---|---|
Stateful inline | ||
bool | stateEquals virtual const inline | Returns true if the current state ID equals the given ID. |
bool | stateBetween virtual const inline | Returns true if the current state ID is in the inclusive range [lid, rid]. |
T & | state virtual inline | Returns a mutable reference to the current state. |
const T | state virtual const inline | Returns a copy of the current state. |
inline
inline Stateful()virtual const inline
virtual inline bool stateEquals(typename T::ID id) constReturns true if the current state ID equals the given ID.
id State ID to compare against.True if the current state matches.
virtual const inline
virtual inline bool stateBetween(typename T::ID lid, typename T::ID rid) constReturns true if the current state ID is in the inclusive range [lid, rid].
lid Lower bound state ID.
rid Upper bound state ID.
True if lid <= state.id() <= rid.
virtual inline
virtual inline T & state()Returns a mutable reference to the current state.
Reference to the internal state object.
virtual const inline
virtual inline const T state() constReturns a copy of the current state.
Current state value.
| Return | Name | Description |
|---|---|---|
T | _state |
T _state| Return | Name | Description |
|---|---|---|
bool | beforeStateChange virtual inline | Override to handle pre state change logic. Return false to prevent state change. |
void | onStateChange virtual inline | Override to handle post state change logic. |
bool | setState virtual inline | Sets the state and sends the state signal if the state change was successful. |
bool | setState virtual inline | Sets the state and sends the state signal if the state change was successful. |
virtual inline
virtual inline bool beforeStateChange(const T & state)Override to handle pre state change logic. Return false to prevent state change.
virtual inline
virtual inline void onStateChange(T &, const T &)Override to handle post state change logic.
virtual inline
virtual inline bool setState(void * sender, typename T::ID id)Sets the state and sends the state signal if the state change was successful.
virtual inline
virtual inline bool setState(void * sender, const T & state)Sets the state and sends the state signal if the state change was successful.