1 #ifndef UTOPIA_CORE_STATE_HH
2 #define UTOPIA_CORE_STATE_HH
36 template<
typename StateType, Update mode>
40 template<
typename StateType>
62 template<
typename StateType>
70 static constexpr
bool is_sync () {
return false; }
92 template<
typename StateType>
100 static constexpr
bool is_sync () {
return true; }
113 void update () noexcept { _state = _state_new; }
State & state()
Return reference to state.
Definition: state.hh:78
State _state
Definition: state.hh:83
static constexpr bool is_sync()
Export implementation type.
Definition: state.hh:70
StateType State
Type of state.
Definition: state.hh:67
StateContainer(const State state)
Construct state container with specific state.
Definition: state.hh:73
const State & state() const
Return const reference to state.
Definition: state.hh:80
State state
Definition: state.hh:45
StateType State
Definition: state.hh:44
StateContainer(const State state_initial)
Construct state container with specific state.
Definition: state.hh:51
State & state_new()
Return reference to state cache.
Definition: state.hh:109
State _state_new
Definition: state.hh:117
static constexpr bool is_sync()
Export implementation type.
Definition: state.hh:100
void update() noexcept
Overwrite state with state cache.
Definition: state.hh:113
StateContainer(const State state)
Construct state container with specific state.
Definition: state.hh:103
State _state
Definition: state.hh:116
StateType State
Type of state.
Definition: state.hh:97
const State & state() const
Return const reference to state.
Definition: state.hh:111
Container for states.
Definition: state.hh:37
@ manual
Fully manual: write_data method is always called.
Update
Update modes when applying rules.
Definition: state.hh:20
@ async
Asynchronous update.
@ manual
User chooses update type when calling apply_rule()
@ sync
Synchronous update.