|
morph 0.1.0
Asynchronous bridge between GUI thread and business models
|
Where the screens and the models are: a server (remote) or the application linked in-process (local). More...
#include <frontend.hpp>
Public Member Functions | |
| AppSource (AppSource const &)=delete | |
| AppSource & | operator= (AppSource const &)=delete |
| AppSource (AppSource &&)=delete | |
| AppSource & | operator= (AppSource &&)=delete |
| virtual void | open (AppContext &context, std::function< void(std::expected< Bundle, ConnectError >)> ready)=0 |
| Connects (or, local, sets up the models), signs the user in natively if the application needs it, and delivers the bundle. | |
| virtual void | switchBackend (Backend backend, std::function< void(std::expected< void, std::string >)> done)=0 |
| Replaces the dispatch target under the mounted screens: Bridge::switchBackend, posted to the owner. | |
| virtual void | close ()=0 |
| Releases everything open made (connections, bridges, handlers) and drops a ready not yet delivered. Called by runApp once the screens are gone and before the frontend's runtime is; the source may be opened again afterwards. | |
| virtual void | onConnected (std::function< void()> const &listener) |
| Adds a listener called on the owner after each successful connect to the server, the first included (spec 8 §7, "Reconnect"). A shell registers Session::reconnected here, so the session re-sends its watch set and re-reads what it shows after an outage. The source owns the backend's single connect hook, so anything else that wants connects subscribes here too. | |
Where the screens and the models are: a server (remote) or the application linked in-process (local).
main builds one from its arguments and hands it to Frontend::run. Every call is made on the context's owner executor, and every callback it is given must be called there too.
Definition at line 137 of file frontend.hpp.
|
pure virtual |
Connects (or, local, sets up the models), signs the user in natively if the application needs it, and delivers the bundle.
| context | The running frontend's context; its executor is every bridge's callback executor. |
| ready | Called once, on the owner, now or later, with the bundle or why there is none. A source that is closed first never calls it. |
|
pure virtual |
Replaces the dispatch target under the mounted screens: Bridge::switchBackend, posted to the owner.
| backend | One of the application's backends. |
| done | Called once, on the owner, when the switch committed, or with why it did not; a switch that fails leaves the old backend in place. |
Implemented in morph::client::Source.
|
pure virtual |
Releases everything open made (connections, bridges, handlers) and drops a ready not yet delivered. Called by runApp once the screens are gone and before the frontend's runtime is; the source may be opened again afterwards.
Implemented in morph::client::Source.
|
inlinevirtual |
Adds a listener called on the owner after each successful connect to the server, the first included (spec 8 §7, "Reconnect"). A shell registers Session::reconnected here, so the session re-sends its watch set and re-reads what it shows after an outage. The source owns the backend's single connect hook, so anything else that wants connects subscribes here too.
The default does nothing: a local source has no connection to lose.
| listener | Called on the owner after each connect; it must stay callable while the source is open. |
Reimplemented in morph::client::Source.
Definition at line 171 of file frontend.hpp.