|
HikoGUI
A low latency retained GUI
|
#include <ttauri/observable.hpp>
Public Types | |
| using | value_type = T |
| using | notifier_type = notifier<void()> |
| using | callback_type = typename notifier_type::callback_type |
| using | callback_ptr_type = typename notifier_type::callback_ptr_type |
Public Member Functions | |
| observable (observable &&other) noexcept | |
| observable & | operator= (observable &&other) noexcept |
| observable (observable const &other) noexcept | |
| observable & | operator= (observable const &other) noexcept |
| observable () noexcept | |
| Default construct a observable holding a default constructed value. | |
| observable (value_type const &value) noexcept | |
| Construct a observable holding value. | |
| operator bool () const noexcept | |
| Is the internal value true. | |
| observable & | operator= (value_type const &value) noexcept |
| Assign a new value. | |
| observable & | operator+= (value_type const &value) noexcept |
| Inplace add a value. | |
| observable & | operator-= (value_type const &value) noexcept |
| Inplace subtract a value. | |
| value_type | load () const noexcept |
| Load the value. | |
| value_type | operator* () const noexcept |
| Load the value. | |
| bool | store (value_type const &new_value) noexcept |
| Assign a new value. | |
| template<typename Callback > requires (std::is_invocable_v<Callback>) | |
| callback_ptr_type | subscribe (Callback &&callback) noexcept |
| Subscribe a callback function. | |
| callback_ptr_type | subscribe (callback_ptr_type const &callback) noexcept |
| Subscribe a callback function. | |
| void | unsubscribe (callback_ptr_type const &callback_ptr) noexcept |
| Unsubscribe a callback function. | |
| value_type | operator- () const noexcept |
| Negate and return the value. | |
Friends | |
| class | detail::observable_base< value_type > |
| bool | operator== (observable const &lhs, observable const &rhs) noexcept |
| Compare the value of two observables. | |
| bool | operator== (observable const &lhs, value_type const &rhs) noexcept |
| Compare and observable with a value. | |
| bool | operator== (value_type const &lhs, observable const &rhs) noexcept |
| Compare and observable with a value. | |
| auto | operator<=> (observable const &lhs, observable const &rhs) noexcept |
| Compare the value of two observables. | |
| auto | operator<=> (observable const &lhs, value_type const &rhs) noexcept |
| Compare and observable with a value. | |
| auto | operator<=> (value_type const &lhs, observable const &rhs) noexcept |
| Compare and observable with a value. | |
| auto | operator+ (observable const &lhs, observable const &rhs) noexcept |
| Add the value of two observables. | |
| auto | operator+ (observable const &lhs, value_type const &rhs) noexcept |
| Add the value of observables to a value. | |
| auto | operator+ (value_type const &lhs, observable const &rhs) noexcept |
| Add the value of observables to a value. | |
| auto | operator- (observable const &lhs, observable const &rhs) noexcept |
| Subtract the value of two observables. | |
| auto | operator- (observable const &lhs, value_type const &rhs) noexcept |
| Subtract a value from an observable to a value. | |
| auto | operator- (value_type const &lhs, observable const &rhs) noexcept |
| Subtract an observable value from a value. | |
An observable value.
An observable-value will notify listeners when a value changes. An observable-value can also observe another observable-value.
For widgets this allows changes to values to be reflected on the screen in multiple places. Or values to be written automatically to a configuration file.
|
inlinenoexcept |
Default construct a observable holding a default constructed value.
|
inlinenoexcept |
Construct a observable holding value.
| value | The value to set the internal value to. |
|
inlinenoexcept |
Load the value.
Loads the internal or observed value.
|
inlineexplicitnoexcept |
Is the internal value true.
|
inlinenoexcept |
Load the value.
Loads the internal or observed value.
|
inlinenoexcept |
Inplace add a value.
Updates the internal value or the value that is being observed non-atomically.
| value | The value to add. |
|
inlinenoexcept |
Negate and return the value.
|
inlinenoexcept |
Inplace subtract a value.
Updates the internal value or the value that is being observed non-atomically.
| value | The value to subtract. |
|
inlinenoexcept |
Assign a new value.
Updates the internal value or the value that is being observed.
| value | The value to assign. |
|
inlinenoexcept |
Assign a new value.
Updates the internal value or the value that is being observed.
| value | The value to assign. |
|
inlinenoexcept |
Subscribe a callback function.
The subscribed callback function will be called when the value is modified.
| Callback | A callback-type of the form void(). |
| callback | The callback function to subscribe. |
std::shared_ptr to the callback function. std::weak_ptr to the callback function is retained by the observable. When this pointer is expired the callback will be automatically unsubscribed.
|
inlinenoexcept |
Subscribe a callback function.
The subscribed callback function will be called when the value is modified.
| callback | The callback function to subscribe. |
std::shared_ptr to the callback function. std::weak_ptr to the callback function is retained by the observable. When this pointer is expired the callback will be automatically unsubscribed.
|
inlinenoexcept |
Unsubscribe a callback function.
| callback | The callback function to subscribe. |
|
friend |
Add the value of two observables.
| lhs | An observable-value |
| rhs | An observable-value |
|
friend |
Add the value of observables to a value.
| lhs | An observable-value |
| rhs | A value |
|
friend |
Add the value of observables to a value.
| lhs | A value |
| rhs | An observable-value |
|
friend |
Subtract the value of two observables.
| lhs | An observable-value |
| rhs | An observable-value |
|
friend |
Subtract a value from an observable to a value.
| lhs | An observable-value |
| rhs | A value |
|
friend |
Subtract an observable value from a value.
| lhs | A value |
| rhs | An observable-value |
|
friend |
Compare the value of two observables.
| lhs | An observable-value. |
| rhs | An observable-value. |
|
friend |
Compare and observable with a value.
| lhs | An observable-value. |
| rhs | A value. |
|
friend |
Compare and observable with a value.
| lhs | A value. |
| rhs | An observable-value. |
|
friend |
Compare the value of two observables.
| lhs | An observable-value. |
| rhs | An observable-value. |
|
friend |
Compare and observable with a value.
| lhs | An observable-value. |
| rhs | A value. |
|
friend |
Compare and observable with a value.
| lhs | A value. |
| rhs | An observable-value. |