|
HikoGUI
A low latency retained GUI
|
#include <hikogui/observer.hpp>
Data Structures | |
| class | _proxy |
| A proxy object of the observer. More... | |
Public Types | |
| using | value_type = T |
| using | notifier_type = notifier<void(value_type)> |
| using | callback_token = notifier_type::callback_token |
| using | callback_proto = notifier_type::callback_proto |
| using | awaiter_type = notifier_type::awaiter_type |
| using | path_type = observable_msg::path_type |
| using | proxy = _proxy<true> |
| using | const_proxy = _proxy<false> |
Public Member Functions | |
| observer (forward_of< std::shared_ptr< observable > > auto &&observed) noexcept | |
| Create an observer from an observable. | |
| constexpr | observer () noexcept |
| Create a observer linked to an anonymous default initialized observed-value. | |
| constexpr | observer (std::convertible_to< value_type > auto &&value) noexcept |
| Create a observer linked to an anonymous observed-value. | |
| constexpr | observer (observer const &other) noexcept |
| Copy construct. | |
| constexpr | observer (observer &&other) noexcept |
| Move construct. | |
| constexpr observer & | operator= (observer const &other) noexcept |
| Copy assign. | |
| constexpr observer & | operator= (observer &&other) noexcept |
| Move assign. | |
| void | reset () noexcept |
| Reset the observer. | |
| const_proxy | read () const &noexcept |
| Read the observed value. | |
| const_proxy | read () &&=delete |
| proxy | copy () const &noexcept |
| Make a copy of the observed value for modification. | |
| callback_token | subscribe (forward_of< callback_proto > auto &&function, callback_flags flags=callback_flags::synchronous) noexcept |
| Subscribe a callback to this observer. | |
| awaiter_type | operator co_await () const noexcept |
| auto | get (auto const &index) const noexcept |
| Create a sub-observer by indexing into the value. | |
| template<fixed_string Name> | |
| auto | get () const noexcept |
| Create a sub-observer by selecting a member-variable of the value. | |
| template<typename Rhs > requires requires (value_type &a, Rhs &&b) { a = std::forward<Rhs>(b); } | |
| observer & | operator= (Rhs &&rhs) noexcept |
| Assign a new value to the observed value. | |
| value_type | operator* () const noexcept |
| Get a copy of the value being observed. | |
| const_proxy | operator-> () const &noexcept |
| Constant pointer-to-member of the value being observed. | |
| const_proxy | operator-> () &&=delete |
| X (++) X(--) X(++) X(--) X(+ | |
| observer (forward_of< observed_type > auto &&observed, forward_of< path_type > auto &&path, forward_of< void *(void *)> auto &&converter) noexcept | |
| Construct an observer from an observable. | |
| void | read_unlock () const noexcept |
| void | commit (void *base) const noexcept |
| void | abort (void *base) const noexcept |
| value_type * | convert (void *base) const noexcept |
| value_type const * | convert (void const *base) const noexcept |
| void | update_state_callback () noexcept |
Data Fields | |
| observed_type | _observed = {} |
| path_type | _path = {} |
| std::function< void *(void *) | _convert ) = {} |
| notifier_type | _notifier |
| value_type | _value |
A observer pointing to the whole or part of a observable.
A observer will point to a observable that was created, or possibly an anonymous observable, which is created when a observer is created as empty.
| T | The type of observer. |
|
inlinenoexcept |
Create an observer from an observable.
| observed | The observable which will be observed by this observer. |
|
inlineexplicitconstexprnoexcept |
Create a observer linked to an anonymous default initialized observed-value.
|
inlineconstexprnoexcept |
Create a observer linked to an anonymous observed-value.
|
inlineconstexprnoexcept |
Copy construct.
| other | The other observer. |
|
inlineconstexprnoexcept |
Move construct.
| other | The other observer. |
|
inlinenoexcept |
Construct an observer from an observable.
|
inlinenoexcept |
Make a copy of the observed value for modification.
|
inlinenoexcept |
Create a sub-observer by selecting a member-variable of the value.
hi::selector type-trait to be implemented for value_type. | Name | The name of the member-variable of value. |
|
inlinenoexcept |
Create a sub-observer by indexing into the value.
| index | The index into the value being observed. |
|
inlinenoexcept |
Get a copy of the value being observed.
|
inlinenoexcept |
Constant pointer-to-member of the value being observed.
|
inlineconstexprnoexcept |
Move assign.
| other | The other observer. |
|
inlineconstexprnoexcept |
Copy assign.
| other | The other observer. |
|
inlinenoexcept |
Assign a new value to the observed value.
|
inlinenoexcept |
Read the observed value.
|
inlinenoexcept |
Reset the observer.
This will link the observer with an anonymous observable with a default initialized value.
|
inlinenoexcept |
Subscribe a callback to this observer.
| flags | The callback flags on how to call the function. |
| function | The function used as callback in the form void(value_type const &old_value, value_type const &new_value) |