Lumiera  0.pre.03
»edit your freedom«
Nexus Class Reference

#include "stage/ctrl/nexus.hpp"

Description

Central hub of the UI-Bus.

This special implementation of the [BusTerm] interface maintains a routing table and manages the connections to individual UI-Elements. The nexus relies on a dedicated (up)link to the [CoreService] to handle command invocation and presentation state. This is implemented by wiring the aforementioned CoreService terminal as "up-link", while actually defining special handling overrides for all other kinds of messages. The purpose of the Nexus is to route all these other kinds of messages.

Thus, the "uplink", which is in fact the CoreService, is left to handle

  • the *act* messages (command invocation)
  • the *note* messages (upstream state change notification)
Todo:
write type comment

Definition at line 76 of file nexus.hpp.

Public Member Functions

 Nexus (BusTerm &uplink_to_CoreService, ID identity=lib::idi::EntryID< Nexus >())
 
size_t size () const
 
- Public Member Functions inherited from BusTerm
 BusTerm (BusTerm &&)=default
 may be moved, but not copied, due to the embedded identity
 
virtual ~BusTerm ()
 this is an interface More...
 
virtual void act (GenNode const &command)
 prepare or trigger invocation of a command. More...
 
BusTerm attach (ID, Tangible &newNode)
 Builder function: establish and wire a new BusTerm. More...
 
ID getID () const
 
virtual void note (ID subject, GenNode const &mark)
 capture and record a "state mark" for later replay for restoring UI state. More...
 
void note (GenNode const &mark)
 record state mark from this subject
 

Protected Member Functions

virtual bool change (ID subject, MutationMessage &&diff) override
 direct a mutation message towards the indicated Tangible. More...
 
virtual bool mark (ID subject, GenNode const &mark) override
 route mark messages down to the individual Tangible. More...
 
virtual size_t markAll (GenNode const &mark) override
 broadcast a notification to all connected terminal nodes. More...
 
virtual operator string () const
 
virtual BusTermrouteAdd (ID identity, Tangible &newNode) override
 add a new down-link connection to the routing table More...
 
virtual void routeDetach (ID node) noexcept override
 deactivate and remove a down-link route. More...
 
- Protected Member Functions inherited from BusTerm
 BusTerm (ID identity, BusTerm &attached_to)
 
bool isShortCircuit (ID) const noexcept
 

Private Types

typedef std::unordered_map< EntryID, Tangible *, EntryID::UseEmbeddedHashRoutingTable
 

Private Attributes

RoutingTable routingTable_
 

Additional Inherited Members

- Public Types inherited from BusTerm
using ID = EntryID const &
 
- Protected Types inherited from BusTerm
using EntryID = lib::idi::BareEntryID
 
using Tangible = stage::model::Tangible
 
- Protected Attributes inherited from BusTerm
EntryID endpointID_
 
BusTermtheBus_
 
- Private Member Functions inherited from NonCopyable
 NonCopyable (NonCopyable const &)=delete
 
NonCopyableoperator= (NonCopyable const &)=delete
 

Member Function Documentation

◆ mark()

virtual bool mark ( ID  subject,
GenNode const &  mark 
)
inlineoverrideprotectedvirtual

route mark messages down to the individual Tangible.

Note
only messages to elements currently registered in the routing table are dispatched. All other messages are dropped without further effect.

Reimplemented from BusTerm.

Reimplemented in TestNexus.

Definition at line 92 of file nexus.hpp.

References steam::mobject::session::query::anonymous_namespace{fake-configrules.cpp}::entry().

Referenced by Nexus::markAll().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ markAll()

virtual size_t markAll ( GenNode const &  mark)
inlineoverrideprotectedvirtual

broadcast a notification to all connected terminal nodes.

Note
just uses the contents of the current routing table in arbitrary order.

Reimplemented from BusTerm.

Reimplemented in TestNexus.

Definition at line 108 of file nexus.hpp.

References steam::mobject::session::query::anonymous_namespace{fake-configrules.cpp}::entry(), and Nexus::mark().

+ Here is the call graph for this function:

◆ change()

virtual bool change ( ID  subject,
MutationMessage &&  diff 
)
inlineoverrideprotectedvirtual

direct a mutation message towards the indicated Tangible.

Remarks
this is the intended way how to populate or manipulate the contents of the user interface from lower layers. By sending a diff message, any structural or content changes can be described without actually knowing the concrete implementation of the UI model elements subject to this change

Reimplemented from BusTerm.

Reimplemented in TestNexus.

Definition at line 125 of file nexus.hpp.

References steam::mobject::session::query::anonymous_namespace{fake-configrules.cpp}::entry().

+ Here is the call graph for this function:

◆ routeAdd()

virtual BusTerm& routeAdd ( ID  identity,
Tangible &  newNode 
)
inlineoverrideprotectedvirtual

add a new down-link connection to the routing table

Parameters
identitythe endpoint-ID used to address the new element to be connected to the bus.
newNodeto add the address (!) into the routing table
Returns
backlink for the new Tangible's BusTerm to attach itself to the Nexus.
Note
at call time, the second param, the newNode will typically be just a Tangible (and not a subclass yet), since this function is invoked from ctor.

Reimplemented from BusTerm.

Reimplemented in TestNexus.

Definition at line 151 of file nexus.hpp.

◆ routeDetach()

virtual void routeDetach ( ID  node)
inlineoverrideprotectedvirtualnoexcept

deactivate and remove a down-link route.

Note
will be invoked by the dtor of the node's BusTerm.

Reimplemented from BusTerm.

Reimplemented in TestNexus.

Definition at line 162 of file nexus.hpp.

+ Inheritance diagram for Nexus:
+ Collaboration diagram for Nexus:

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