Observable value — wraps a single value with change notification. More...
#include <state_tree.hpp>
Public Types | |
| using | ChangeListener = std::function<void(const T& old_val, const T& new_val)> |
Public Member Functions | |
| ObservableValue ()=default | |
| ObservableValue (T initial) | |
| const T & | get () const |
| operator const T & () const | |
| void | set (T new_value) |
| ObservableValue & | operator= (T new_value) |
| int | add_listener (ChangeListener fn) |
| void | remove_listener (int id) |
Observable value — wraps a single value with change notification.
Thread-safety contract: NOT thread-safe. Every method (get, set, add_listener, remove_listener) touches non-atomic members without internal locking. Caller must serialize. Same model as StateTree.
| using pulp::state::ObservableValue< T >::ChangeListener = std::function<void(const T& old_val, const T& new_val)> |
|
default |
|
inlineexplicit |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |