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

Description

Test:
CommandInstanceManager is responsible for providing individual clone copies from a basic command definition, to be bound with actual arguments and finally handed over to the SteamDispatcher for invocation.
See also
steam::control::CommandInstanceManager

Definition at line 105 of file command-instance-manager-test.cpp.

Private Member Functions

virtual void run (Arg)
 
void verify_duplicates ()
 
void verify_extendedUsage ()
 
void verify_fallback ()
 
void verify_instanceIdentity ()
 
void verify_lifecycle ()
 
void verify_simpleUsage ()
 

Member Function Documentation

◆ verify_simpleUsage()

void verify_simpleUsage ( )
inlineprivate
Test:
demonstrate the transparent instance generation (»fire and forget«)
  • when just specifying a global commandID and arguments, an anonymous instance will be created on-the-fly, bound and dispatched, without leaving any traces in the global or local registry
  • when dispatching a global commandID, where the corresponding prototype entry is already fully bound and ready for execution, likewise an anonymous clone copy is created and dispatched.
Remarks
these simplified use cases cover a large fraction of all usages, and most notably, the internal registry embedded within the CommandInstanceManager won't be used at all.

Definition at line 132 of file command-instance-manager-test.cpp.

◆ verify_extendedUsage()

void verify_extendedUsage ( )
inlineprivate
Test:
demonstrate the complete command instance usage pattern.

Definition at line 166 of file command-instance-manager-test.cpp.

◆ verify_instanceIdentity()

void verify_instanceIdentity ( )
inlineprivate
Test:
relation of command, instanceID and concrete instance The CommandInstanceManager provides the notion of a current instance, which can then be used to bind arguments.

When done, it will be dispatched, and then go through the SteamDispatcher's CommandQueue (in this test, we use just a dummy Fixture, which only enqueues the dispatched commands.

The following notions need to be kept apart

  • a command is the operation definition. It is registered with a commandID.
  • the instance ID is a decorated commandID and serves to keep different usage contexts of the same command (prototype) apart. For each instanceID there is at any given time maximally one concrete instance "opened"
  • the concrete command instance is what can be bound and executed. It retains it's own identity, even after being handed over for dispatch. Consequently, a given instance can sit in the dispatcher queue to await invocation, while the next instance for the same instance ID is already opened in the CommandInstanceManager for binding arguments.

Definition at line 210 of file command-instance-manager-test.cpp.

◆ verify_duplicates()

void verify_duplicates ( )
inlineprivate
Test:
there can be only one active "opened" instance The CommandInstanceManager opens (creates) a new instance by cloning from the prototype.

Unless this instance is dispatched, it does not allow to open a further instance (for the same instanceID). But of course it allows to open a different instance from the same prototype, but with a different invocationID and hence a different instanceID

Definition at line 311 of file command-instance-manager-test.cpp.

◆ verify_lifecycle()

void verify_lifecycle ( )
inlineprivate
Test:
verify sane command lifecycle is enforced
  • instance need to be opened (created) prior to access
  • can not dispatch an instance not yet created
  • can not create new instance before dispatching the existing one
  • can not dispatch an instance before binding its arguments
  • can not access an instance already dispatched

Definition at line 339 of file command-instance-manager-test.cpp.

◆ verify_fallback()

void verify_fallback ( )
inlineprivate
Test:
the instance manager automatically falls back on globally registered commands, when the given ID is not and was not known locally

Definition at line 376 of file command-instance-manager-test.cpp.

+ Inheritance diagram for CommandInstanceManager_test:
+ Collaboration diagram for CommandInstanceManager_test:

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