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

#include "steam/control/command-def.hpp"

Description

Helper class used solely for defining a Command-Object.

This technique is known as "fluent API", see http://en.wikipedia.org/wiki/Fluent_interface The basic idea is for the user to create a disposable instance of this definition helper, only for calling a chain of definition functions, which internally build the actual Command object. Finally, the created Command object will be stored into a registry or handed over to the SteamDispatcher. To give an example:

CommandDefinition ("test.command1")
.operation (command1::operate) // provide the function to be executed as command
.captureUndo (command1::capture) // provide the function capturing Undo state
.undoOperation (command1::undoIt) // provide the function which might undo the command
.bind (obj, randVal) // bind to the actual command parameters
.executeSync(); // convenience call, forwarding the Command to dispatch.

Definition at line 268 of file command-def.hpp.

Public Member Functions

 CommandDef (Symbol cmdID)
 
 ~CommandDef ()
 when starting a CommandDef, we immediately place a yet empty Command object into the index, just assuming it will be defined properly and consequently get valid at some point. More...
 
bool isValid () const
 is this a valid command definition? especially. More...
 
template<typename FUN >
auto operation (FUN operation_to_define)
 
 operator bool () const
 

Private Types

using Activation = stage::Activation
 
using PImpl = stage::ImplInstance
 

Private Member Functions

Commandactivate (PImpl &&completedDef)
 callback from completed command definition stage: "arm up" the command handle object and register it with the CommandRegistry. More...
 
- Private Member Functions inherited from NonCopyable
 NonCopyable (NonCopyable const &)=delete
 
NonCopyableoperator= (NonCopyable const &)=delete
 

Private Attributes

Symbol id_
 
Command prototype_
 

Constructor & Destructor Documentation

◆ ~CommandDef()

~CommandDef ( )

when starting a CommandDef, we immediately place a yet empty Command object into the index, just assuming it will be defined properly and consequently get valid at some point.

But in case this doesn't happen (e.g. because the definition is aborted), we need to clean up this empty pre-registration...

Definition at line 326 of file command.cpp.

Member Function Documentation

◆ isValid()

bool isValid ( ) const

is this a valid command definition? especially.

  • the prototype command is initialised properly
  • there is a command definition registered for our command ID
  • and the registered command uses the same underlying command impl record than our prototype

Definition at line 340 of file command.cpp.

◆ activate()

Command& activate ( PImpl &&  completedDef)
inlineprivate

callback from completed command definition stage: "arm up" the command handle object and register it with the CommandRegistry.

Definition at line 311 of file command-def.hpp.

References Command::activate().

+ Here is the call graph for this function:
+ Inheritance diagram for CommandDef:
+ Collaboration diagram for CommandDef:

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