|
morph 0.1.0
Asynchronous bridge between GUI thread and business models
|
The latest R the bridge published on a handler's instance, as reactive state. More...
#include <control.hpp>
Public Member Functions | |
| template<typename M, typename S> | |
| Subscription (Runtime &runtime, bridge::BridgeHandler< M, S > &handler) | |
Subscribes to every R published on handler's instance, and checks the handler's callback executor against the runtime's owner (detail::checkHandlerExecutor). | |
| Subscription (Subscription const &)=delete | |
| Subscription & | operator= (Subscription const &)=delete |
| Subscription (Subscription &&)=delete | |
| Subscription & | operator= (Subscription &&)=delete |
| std::optional< R > const & | latest () const |
| The latest published value. Tracked. | |
The latest R the bridge published on a handler's instance, as reactive state.
Uses the handler's one subscription slot for R: two consumers of the same R use two handlers. The subscription is gated by a scope the Subscription owns, so a publish delivered after it is destroyed — one already queued included — is dropped. The handler keeps the dead entry until it is destroyed or subscribes to R again. A delivery off the Runtime's owner is reported (detail::site::kOffOwner) and dropped.
latest() is state, not an event stream: when R compares with ==, a publish equal to the current value does not notify. For something to happen on every publish, use Query::refreshOn.
| R | The published result type. |
Definition at line 704 of file control.hpp.
|
inline |
Subscribes to every R published on handler's instance, and checks the handler's callback executor against the runtime's owner (detail::checkHandlerExecutor).
| M | The handler's model type. |
| S | The handler's sharing policy. |
| runtime | The runtime. Borrowed: it must outlive the subscription. |
| handler | The handler whose instance publishes; its GUI executor must be the runtime's owner. Borrowed: it must outlive the subscription. |
Definition at line 714 of file control.hpp.
|
inlinenodiscard |
The latest published value. Tracked.
Definition at line 733 of file control.hpp.