Lumiera 0.pre.04~rc.1
»edit your freedom«
Loading...
Searching...
No Matches
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 67 of file nexus.hpp.

Public Member Functions

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

Protected Member Functions

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

Private Types

using RoutingTable = std::unordered_map< EntryID, Tangible *, EntryID::UseEmbeddedHash >
 

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 ()=default
 
 NonCopyable ()=default
 
 NonCopyable (NonCopyable const &)=delete
 
NonCopyableoperator= (NonCopyable const &)=delete
 

Constructor & Destructor Documentation

◆ Nexus()

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

Definition at line 173 of file nexus.hpp.

◆ ~Nexus()

~Nexus ( )
inline

Definition at line 177 of file nexus.hpp.

References Nexus::size().

+ Here is the call graph for this function:

Member Typedef Documentation

◆ RoutingTable

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

Definition at line 71 of file nexus.hpp.

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 83 of file nexus.hpp.

References Nexus::mark(), and Nexus::routingTable_.

Referenced by Nexus::mark(), and 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 99 of file nexus.hpp.

References Nexus::mark(), and Nexus::routingTable_.

+ 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 116 of file nexus.hpp.

References Nexus::routingTable_.

◆ 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 142 of file nexus.hpp.

References Nexus::routingTable_.

◆ 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 153 of file nexus.hpp.

References Nexus::routingTable_.

◆ operator string()

virtual operator string ( ) const
inlineprotectedvirtual

Reimplemented from BusTerm.

Reimplemented in TestNexus.

Definition at line 159 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 167 of file nexus.hpp.

References Nexus::routingTable_.

Referenced by Nexus::~Nexus().

+ Here is the caller graph for this function:

Member Data Documentation

◆ routingTable_

RoutingTable routingTable_
private
+ Inheritance diagram for Nexus:
+ Collaboration diagram for Nexus:

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