|
HikoGUI
A low latency retained GUI
|
#include <hikogui/observer/observer_intf.hpp>
Data Structures | |
| class | proxy_type |
| A proxy object of the observer. More... | |
Public Types | |
| using | value_type = T |
| using | notifier_type = notifier<void(value_type)> |
| using | callback_type = notifier_type::callback_type |
| using | awaiter_type = notifier_type::awaiter_type |
| using | path_type = observable_msg::path_type |
| using | const_reference = value_type const & |
| using | pointer = proxy_type |
| using | const_pointer = value_type const * |
Public Member Functions | |
| template<forward_of< std::shared_ptr< hi::observed_base > > Observed> | |
| observer (Observed &&observed_base) noexcept | |
| Create an observer from an observed_base. | |
| constexpr | observer () noexcept |
| Create a observer linked to an anonymous default initialized observed_base-value. | |
| template<std::convertible_to< value_type > Value> | |
| constexpr | observer (Value &&value) noexcept |
| Create a observer linked to an anonymous observed_base-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_pointer | get () const noexcept |
| Read the observed_base value. | |
| pointer | get () noexcept |
| Make a copy of the observed_base value for modification. | |
| template<forward_of< void(value_type)> Func> | |
| callback< void(value_type)> | subscribe (Func &&func, callback_flags flags=callback_flags::synchronous) noexcept |
| Subscribe a callback to this observer. | |
| awaiter_type | operator co_await () const noexcept |
| auto | sub (auto const &index) const noexcept |
| Create a sub-observer by indexing into the value. | |
| template<fixed_string Name> | |
| auto | sub () 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_base value. | |
| const_reference | operator* () const noexcept |
| Get the value being observed_base. | |
| const_pointer | operator& () const noexcept |
| const_pointer | operator-> () const noexcept |
| Constant pointer-to-member of the value being observed_base. | |
| pointer | operator-> () noexcept |
| Constant pointer-to-member of the value being observed_base. | |
| X (++) X(--) X(++) X(--) X(+ | |
| template<forward_of< observed_type > ObservedBase, forward_of< path_type > Path, forward_of< void *(void *)> Converter> | |
| observer (ObservedBase &&observed_base, Path &&path, Converter &&converter) noexcept | |
| Construct an observer from an observed_base. | |
| void | notify () 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 | _debug_value |
A observer pointing to the whole or part of a observed_base.
A observer will point to a observed_base that was created, or possibly an anonymous observed_base, which is created when a observer is created as empty.
| T | The type of observer. |
|
inlinenoexcept |
Create an observer from an observed_base.
| observed_base | The observed_base which will be observed_base by this observer. |
|
inlineexplicitconstexprnoexcept |
Create a observer linked to an anonymous default initialized observed_base-value.
|
inlineconstexprnoexcept |
Create a observer linked to an anonymous observed_base-value.
|
inlineconstexprnoexcept |
Copy construct.
| other | The other observer. |
|
inlineconstexprnoexcept |
Move construct.
| other | The other observer. |
|
inlinenoexcept |
Construct an observer from an observed_base.
|
inlinenoexcept |
Read the observed_base value.
|
inlinenoexcept |
Make a copy of the observed_base value for modification.
|
inlinenoexcept |
Get the value being observed_base.
|
inlinenoexcept |
Constant pointer-to-member of the value being observed_base.
|
inlinenoexcept |
Constant pointer-to-member of the value being observed_base.
|
inlineconstexprnoexcept |
Move assign.
| other | The other observer. |
|
inlineconstexprnoexcept |
Copy assign.
| other | The other observer. |
|
inlinenoexcept |
Assign a new value to the observed_base value.
|
inlinenoexcept |
Reset the observer.
This will link the observer with an anonymous observed_base with a default initialized value.
|
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_base. |
|
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() |