|
|
constexpr | shared_state (shared_state const &) noexcept=default |
| |
|
constexpr | shared_state (shared_state &&) noexcept=default |
| |
|
constexpr shared_state & | operator= (shared_state const &) noexcept=default |
| |
|
constexpr shared_state & | operator= (shared_state &&) noexcept=default |
| |
| template<typename... Args> |
| constexpr | shared_state (Args &&...args) noexcept |
| | Construct the shared state and initialize the value.
|
| |
|
observer< value_type > | observer () const &noexcept |
| |
| auto | sub (auto const &index) const &noexcept |
| | Get a observer to a sub-object of value accessed by the index operator.
|
| |
| template<fixed_string Name> |
| auto | sub () const &noexcept |
| | Get a observer to a member variable of the value.
|
| |
template<typename T>
class v1::shared_state< T >
Shared state of an application.
The shared state of an application that can be manipulated by the GUI, preference and other systems.
A observer selects a member or indexed element from the shared state, or from another observer. You can .read() or .copy() the value pointed to by the observer to read and manipulate the shared-data.
Both .read() and .copy() take the full shared-state as a whole not allowing other threads to have write access to this reference or copy. A copy will be automatically committed, or may be aborted as well.
lifetime:
- The lifetime of
observer will extend the lifetime of shared_state.
- The lifetime of
observer::proxy must be within the lifetime of observer.
- The lifetime of
observer::const_proxy must be within the lifetime of observer.
- Although
observer are created from another observer they internally do not refer to each other so their lifetime are not connected.
- Template Parameters
-
| T | type used as the shared state. |