Lumiera  0.pre.03
»edityourfreedom«
Nexus Class Reference

#include "gui/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 >())
 
 ~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 More...
 
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 More...
 

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 = gui::model::Tangible
 
- Protected Attributes inherited from BusTerm
EntryID endpointID_
 
BusTermtheBus_
 
- Private Member Functions inherited from NonCopyable
 NonCopyable ()=default
 
 NonCopyable (NonCopyable const &)=delete
 
 ~NonCopyable ()=default
 
NonCopyableoperator= (NonCopyable const &)=delete
 

Member Typedef Documentation

◆ RoutingTable

typedef std::unordered_map<EntryID, Tangible*, EntryID::UseEmbeddedHash> RoutingTable
private

Definition at line 80 of file nexus.hpp.

Constructor & Destructor Documentation

◆ Nexus()

Nexus ( BusTerm uplink_to_CoreService,
ID  identity = lib::idi::EntryID<Nexus>() 
)
inlineexplicit

Definition at line 182 of file nexus.hpp.

◆ ~Nexus()

~Nexus ( )
inline

Definition at line 186 of file nexus.hpp.

References Nexus::size().

+ Here is the call graph for this function:

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.

Definition at line 92 of file nexus.hpp.

Referenced by Nexus::markAll().

+ 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.

Definition at line 108 of file nexus.hpp.

References 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.

Definition at line 125 of file nexus.hpp.

References DiffApplicator< TAR >::consume().

+ 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.

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.

Definition at line 162 of file nexus.hpp.

◆ operator string()

virtual operator string ( ) const
inlineprotectedvirtual

Reimplemented from BusTerm.

Definition at line 168 of file nexus.hpp.

References lib::idi::instanceTypeID().

+ Here is the call graph for this function:

◆ size()

size_t size ( ) const
inline

Definition at line 176 of file nexus.hpp.

Referenced by Nexus::~Nexus().

+ Here is the caller graph for this function:

Member Data Documentation

◆ routingTable_

RoutingTable routingTable_
private

Definition at line 82 of file nexus.hpp.

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

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