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

Classes

struct  _Type
 

Public Types

using PattID = HandlingPattern::ID
 

Public Attributes

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

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.
 
 ~CommandImpl ()
 
 CommandImpl (CommandImpl const &orig, UndoMutation const &newUndo, shared_ptr< CmdClosure > const &newClosure)
 
 operator bool () const
 
void prepareClone (CommandImplCloneBuilder &visitor) const
 assist with building a clone copy of this CommandImpl.
 
void setArguments (Arguments &args)
 
void setArguments (lib::diff::Rec const &paramData)
 
void discardArguments ()
 
void invokeOperation ()
 
void invokeCapture ()
 
void invokeUndo ()
 
PattID getDefaultHandlingPattern () const
 
PattID setHandlingPattern (PattID newID)
 define a handling pattern to be used by default
 
bool isValid () const
 < validity self-check: is basically usable.
 
bool canExec () const
 < state check: sufficiently defined to be invoked
 
bool canUndo () const
 < state check: has undo state been captured?
 
 operator string () const
 

Private Attributes

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

Additional Inherited Members

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

Constructor & Destructor Documentation

◆ CommandImpl() [1/2]

template<typename ARG >
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()

Definition at line 107 of file command.cpp.

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


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 >:

Member Typedef Documentation

◆ PattID

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

Member Function Documentation

◆ operator bool()

operator bool ( ) const
inlineexplicit

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

References CommandImpl::isValid().

+ Here is the call graph for this function:

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

References CommandImpl::pClo_.

◆ setArguments() [1/2]

void setArguments ( Arguments args)
inline

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

References CommandImpl::pClo_.

◆ setArguments() [2/2]

void setArguments ( lib::diff::Rec const paramData)
inline

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

References CommandImpl::pClo_.

◆ discardArguments()

void discardArguments ( )
inline

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

References CommandImpl::pClo_.

◆ invokeOperation()

void invokeOperation ( )
inline

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

References CommandImpl::do_, and CommandImpl::pClo_.

Referenced by SimulatedCommandHandler::performExec().

+ Here is the caller graph for this function:

◆ invokeCapture()

void invokeCapture ( )
inline

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

References UndoMutation::captureState(), CommandImpl::pClo_, and CommandImpl::undo_.

Referenced by SimulatedCommandHandler::performExec().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ invokeUndo()

void invokeUndo ( )
inline

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

References CommandImpl::pClo_, and CommandImpl::undo_.

Referenced by SimulatedCommandHandler::performUndo().

+ Here is the caller graph for this function:

◆ getDefaultHandlingPattern()

PattID getDefaultHandlingPattern ( ) const
inline

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

References CommandImpl::defaultPatt_.

◆ 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 CommandImpl::defaultPatt_.

◆ isValid()

bool isValid ( ) const
inline

< validity self-check: is basically usable.

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

References CommandImpl::defaultPatt_, HandlingPattern::get(), HandlingPattern::isValid(), and CommandImpl::pClo_.

Referenced by CommandImpl::canExec(), CommandImpl::canUndo(), CommandImpl::operator bool(), and CommandImpl::operator string().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ canExec()

bool canExec ( ) const
inline

< state check: sufficiently defined to be invoked

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

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

Referenced by CommandImpl::operator string().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ canUndo()

bool canUndo ( ) const
inline

< state check: has undo state been captured?

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

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

Referenced by CommandImpl::operator string().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ operator string()

operator string ( ) const
inline

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

References CommandImpl::canExec(), CommandImpl::canUndo(), CommandImpl::isValid(), and CommandImpl::pClo_.

+ Here is the call graph for this function:

Member Data Documentation

◆ do_

Mutation do_
private

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

Referenced by CommandImpl::invokeOperation().

◆ undo_

UndoMutation undo_
private

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

Referenced by CommandImpl::invokeCapture(), and CommandImpl::invokeUndo().

◆ pClo_

◆ defaultPatt_

◆ cmdID

Symbol cmdID

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

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

+ Inheritance diagram for CommandImpl:
+ Collaboration diagram for CommandImpl:

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