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

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

Description

Steam-Layer Command implementation.

Data record holding together the parts necessary for command execution

  • command operation functor
  • a functor to UNDO the command effect
  • closure holding actual parameters and UNDO state
    Remarks
    the ctor is templated on the concrete type of operation arguments. This information is erased (discarded) immediately after construction. Usually, CommandImpl instances are created within the registry. The implementation type of the closure is StorageHolder<SIG_OPER,Mem>
    See also
    CmdClosure Closure interface
    StorageHolder
    Mutation

Definition at line 68 of file command-impl.hpp.

Public Types

typedef HandlingPattern::ID PattID
 

Public Member Functions

template<typename ARG >
 CommandImpl (shared_ptr< ARG > pStorageHolder, _TY(Func_op) const &operFunctor, _TY(Func_cap) const &captFunctor, _TY(Func_undo) const &undoFunctor)
 build a new implementation frame, and do the initial wiring. More...
 
 CommandImpl (CommandImpl const &orig, UndoMutation const &newUndo, shared_ptr< CmdClosure > const &newClosure)
 
bool canExec () const
 < state check: sufficiently defined to be invoked
 
bool canUndo () const
 < state check: has undo state been captured?
 
void discardArguments ()
 
PattID getDefaultHandlingPattern () const
 
void invokeCapture ()
 
void invokeOperation ()
 
void invokeUndo ()
 
bool isValid () const
 < validity self-check: is basically usable.
 
 operator bool () const
 
 operator string () const
 
void prepareClone (CommandImplCloneBuilder &visitor) const
 assist with building a clone copy of this CommandImpl. More...
 
void setArguments (Arguments &args)
 
void setArguments (lib::diff::Rec const &paramData)
 
PattID setHandlingPattern (PattID newID)
 define a handling pattern to be used by default More...
 

Public Attributes

Symbol cmdID
 human-readable marker for diagnostics, will be (re)assigned when activating this CommandImpl
 

Classes

struct  _Type
 

Private Attributes

HandlingPattern::ID defaultPatt_
 
Mutation do_
 
shared_ptr< CmdClosurepClo_
 
UndoMutation undo_
 

Additional Inherited Members

- Private Member Functions inherited from NonCopyable
 NonCopyable (NonCopyable const &)=delete
 
NonCopyableoperator= (NonCopyable const &)=delete
 

Class Documentation

◆ steam::control::CommandImpl::_Type

struct steam::control::CommandImpl::_Type
Class Members
typedef SIG_op SIG_op
typedef SIG_cap SIG_cap
typedef SIG_undo SIG_undo
typedef function< SIG_op > Func_op
typedef function< SIG_cap > Func_cap
typedef function< SIG_undo > Func_undo
+ Collaboration diagram for CommandImpl::_Type< ARG >:

Constructor & Destructor Documentation

◆ CommandImpl() [1/2]

CommandImpl ( shared_ptr< ARG >  pStorageHolder,
_TY(Func_op) const &  operFunctor,
_TY(Func_cap) const &  captFunctor,
_TY(Func_undo) const &  undoFunctor 
)
inline

build a new implementation frame, and do the initial wiring.

On the interface the specific type is discarded afterwards. This information is still kept though, as encoded into the vtable of the embedded FunErasure objects holding the command operation and undo functors, and the vtable of the embedded CmdClosure

Definition at line 99 of file command-impl.hpp.

◆ CommandImpl() [2/2]

CommandImpl ( CommandImpl const &  orig,
UndoMutation const &  newUndo,
shared_ptr< CmdClosure > const &  newClosure 
)
inline

cloning service for the CommandRegistry: effectively this is a copy ctor, but as we rely on a argument holder (without knowing the exact type), we need to delegate the cloning of the arguments down to where the exact type info is still available; thus, a CommandImplCloneBuilder is first passed as a visitor down and then calls back to perform the copy, providing an new (clone) closure and UNDO functor already correctly wired to collaborate.

See also
prepareClone

Definition at line 126 of file command-impl.hpp.

References CommandImpl::cmdID, and CommandImpl::isValid().

+ Here is the call graph for this function:

Member Function Documentation

◆ prepareClone()

void prepareClone ( CommandImplCloneBuilder visitor) const
inline

assist with building a clone copy of this CommandImpl.

By accepting the clone builder as a visitor and dispatching this visitation down into the concrete closure, the builder can re-gain the fully typed context available on creation of the ComandImpl. Within this context, for the clone to be created, the UndoMutation has to be re-wired, otherwise it would continue to cooperate with original closure.

Definition at line 155 of file command-impl.hpp.

Referenced by CommandRegistry::createCloneImpl().

+ Here is the caller graph for this function:

◆ setHandlingPattern()

PattID setHandlingPattern ( PattID  newID)
inline

define a handling pattern to be used by default

Returns
ID of the currently defined default pattern

Definition at line 199 of file command-impl.hpp.

References steam::mobject::session::test::anonymous_namespace{defs-manager-impl-test.cpp}::newID().

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

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