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

Description

fake interface backbone and unit test rig for simulated command and presentation state handling. This implementation embodies the routing functionality as found in the real nexus, and additionally also implements the handler functions of the [stage::ctrl::CoreService]. The latter allows us to intercept command invocations and presentation state messages

Definition at line 101 of file test-nexus.cpp.

Public Member Functions

EventLoggetLog ()
 
void installCommandHandler (CommandHandler newHandler=CommandHandler())
 
void installStateMarkHandler (StateMarkHandler newHandler=StateMarkHandler())
 
- Public Member Functions inherited from Nexus
 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...
 
BusTerm attach (ID, Tangible &newNode)
 Builder function: establish and wire a new BusTerm. More...
 
ID getID () const
 
void note (GenNode const &mark)
 record state mark from this subject
 

Private Types

using CommandHandler = test::Nexus::CommandHandler
 
using StateMarkHandler = test::Nexus::StateMarkHandler
 

Private Member Functions

virtual void act (GenNode const &command)
 prepare or trigger invocation of a command. More...
 
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 void note (ID subject, GenNode const &mark) override
 capture and record a "state mark" for later replay for restoring UI state. 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...
 

Private Attributes

CommandHandler commandHandler_
 
EventLog log_ {this}
 
StateMarkHandler stateMarkHandler_
 

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 Member Functions inherited from BusTerm
 BusTerm (ID identity, BusTerm &attached_to)
 
bool isShortCircuit (ID) const noexcept
 
- Protected Attributes inherited from BusTerm
EntryID endpointID_
 
BusTermtheBus_
 

Member Function Documentation

◆ act()

virtual void act ( GenNode const &  command)
inlineprivatevirtual

prepare or trigger invocation of a command.

Parameters
commanda GenNode either holding command parameters
Remarks
some commands can simply be invoked right away, but in the general case, a command needs to be prepared with suitable arguments prior to being invoked, which can be a multi-step process. The stage::interact::InteractionState is used to conduct this argument binding process from within the UI. Here, at the UI-Bus interface, we're just interested in the fact that some command is to be bound and invoked. This information is forwarded to the command receiver service, which in turn talks to the steam dispatcher.
Note
no information regarding the origin of this command invocation is captured. If a command needs a subject, this has to be bound as an command argument beforehand.
See also
stage::model::Tangible::issueCommand()
steam::control::SessionCommand

Reimplemented from BusTerm.

Definition at line 115 of file test-nexus.cpp.

◆ note()

virtual void note ( ID  subject,
GenNode const &  mark 
)
inlineoverrideprivatevirtual

capture and record a "state mark" for later replay for restoring UI state.

Parameters
subjectthe endpoint-ID of the emitting element
markthe actual state update or notification message to be remembered
Remarks
relevant changes to presentation state, which are to be recalled and restored later, are emitted from the place they occur, packaged as "state mark" messages. This assumes the presence of some dedicated presentation state manager, attached and listening somewhere at a core service location. Such a core presentation state service has additional shared understanding of the state mark's meaning; it is assumed to track cumulated state, which will be replayed later when it comes to restoring some presentation state.

Reimplemented from BusTerm.

Definition at line 125 of file test-nexus.cpp.

◆ mark()

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

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

Definition at line 133 of file test-nexus.cpp.

◆ markAll()

virtual size_t markAll ( GenNode const &  mark)
inlineoverrideprivatevirtual

broadcast a notification to all connected terminal nodes.

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

Reimplemented from Nexus.

Definition at line 149 of file test-nexus.cpp.

◆ change()

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

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

Definition at line 159 of file test-nexus.cpp.

◆ routeAdd()

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

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

Definition at line 176 of file test-nexus.cpp.

References lib::idi::instanceTypeID().

+ Here is the call graph for this function:

◆ routeDetach()

virtual void routeDetach ( ID  node)
inlineoverrideprivatevirtualnoexcept

deactivate and remove a down-link route.

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

Reimplemented from Nexus.

Definition at line 188 of file test-nexus.cpp.

+ Inheritance diagram for TestNexus:
+ Collaboration diagram for TestNexus:

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