morph 0.1.0
Asynchronous bridge between GUI thread and business models
Loading...
Searching...
No Matches
morph::ui::BridgeDispatcher Class Referencefinal

A Dispatcher over the bridge's model-free seams: bindByType, executeRaw and the string-keyed attach, through RawHandler. More...

#include <interpreter.hpp>

Inheritance diagram for morph::ui::BridgeDispatcher:
morph::ui::Dispatcher

Public Member Functions

 BridgeDispatcher (bridge::Bridge &bridge, exec::IExecutor *cbExec, Evaluator evaluator={})
 Dispatches through bridge, and evaluates through evaluator.
std::shared_ptr< ModelChannel > bind (std::string const &typeId, bridge::BindSharing sharing, std::string const &instanceKey) override
 Binds through a RawHandler.
Public Member Functions inherited from morph::ui::Dispatcher
 Dispatcher (Dispatcher const &)=delete
Dispatcher & operator= (Dispatcher const &)=delete
 Dispatcher (Dispatcher &&)=delete
Dispatcher & operator= (Dispatcher &&)=delete

Detailed Description

A Dispatcher over the bridge's model-free seams: bindByType, executeRaw and the string-keyed attach, through RawHandler.

An evaluation goes through the Evaluator it was given, since that envelope belongs to the UI service, not the bridge; without one it is refused with a std::runtime_error. It has no offline queue of its own: queueOffline is ignored unless a QueueingDispatcher wraps it. A shared binding without a key is bound unattached, which the bridge refuses at the first call; the interpreter never binds one, since a "shared" alias is a stateless model's and binds privately.

Definition at line 125 of file interpreter.hpp.

Constructor & Destructor Documentation

◆ BridgeDispatcher()

morph::ui::BridgeDispatcher::BridgeDispatcher ( bridge::Bridge & bridge,
exec::IExecutor * cbExec,
Evaluator evaluator = {} )
inline

Dispatches through bridge, and evaluates through evaluator.

Parameters
bridgeThe bridge. Borrowed: it must outlive every channel.
cbExecThe executor replies are delivered on: the runtime's owner. Borrowed.
evaluatorWhat answers an evaluate query; empty to refuse them.

Definition at line 131 of file interpreter.hpp.

Member Function Documentation

◆ bind()

std::shared_ptr< ModelChannel > morph::ui::BridgeDispatcher::bind ( std::string const & typeId,
bridge::BindSharing sharing,
std::string const & instanceKey )
inlinenodiscardoverridevirtual

Binds through a RawHandler.

Parameters
typeIdThe model's registered type id.
sharingPrivate, or shared.
instanceKeyFor a shared binding, the key to attach to; empty to stay unattached.
Returns
The channel; destroying it deregisters the binding.

Implements morph::ui::Dispatcher.

Definition at line 140 of file interpreter.hpp.


The documentation for this class was generated from the following file: