31 #ifndef CONTROL_COMMAND_IMPL_H 32 #define CONTROL_COMMAND_IMPL_H 76 HandlingPattern::ID defaultPatt_;
79 template<
typename ARG>
82 typedef typename ARG::SIG_op SIG_op;
83 typedef typename ARG::SIG_cap SIG_cap;
84 typedef typename ARG::SIG_undo SIG_undo;
86 typedef function<SIG_op> Func_op;
87 typedef function<SIG_cap> Func_cap;
88 typedef function<SIG_undo> Func_undo;
90 #define _TY(_ID_) typename _Type<ARG>::_ID_ 98 template<
typename ARG>
100 ,_TY (Func_op)
const& operFunctor
101 ,_TY (Func_cap)
const& captFunctor
102 ,_TY (Func_undo)
const& undoFunctor
105 , undo_(pStorageHolder->tie (undoFunctor, captFunctor))
106 , pClo_(pStorageHolder)
132 , defaultPatt_{orig.defaultPatt_}
136 explicit operator bool()
const {
return isValid(); }
158 pClo_->accept(visitor);
167 pClo_->bindArguments (args);
173 pClo_->bindArguments (paramData);
179 pClo_->unbindArguments();
182 void invokeOperation() { do_(*pClo_); }
183 void invokeCapture() { undo_.captureState(*pClo_); }
184 void invokeUndo() { undo_(*pClo_); }
188 typedef HandlingPattern::ID PattID;
191 getDefaultHandlingPattern()
const 201 PattID currID = defaultPatt_;
202 defaultPatt_ =
newID;
221 and pClo_->isValid();
227 return isValid() and pClo_->isCaptured();
230 operator string()
const 232 return _Fmt(
"Cmd|valid:%s, exec:%s, undo:%s |%s")
236 % (pClo_? string(*pClo_) : util::FAILURE_INDICATOR);
Core of a Steam-Layer command: functor containing the operation to be executed.
Any copy and copy construction prohibited.
bool canExec() const
< state check: sufficiently defined to be invoked
void prepareClone(CommandImplCloneBuilder &visitor) const
assist with building a clone copy of this CommandImpl.
bool isValid() const
< validity self-check: is basically usable.
PattID setHandlingPattern(PattID newID)
define a handling pattern to be used by default
Steam-Layer implementation namespace root.
A front-end for using printf-style formatting.
Specialised version of the command Mutation functor, used to implement the UNDO functionality.
Token or Atom with distinct identity.
Mix-Ins to allow or prohibit various degrees of copying and cloning.
Symbol cmdID
human-readable marker for diagnostics, will be (re)assigned when activating this CommandImpl ...
Steam-Layer command frontend.
Visitor to support creating a CommandImpl clone.
bool canUndo() const
< state check: has undo state been captured?
Unspecific command functor for implementing Steam-Layer Command.
A closure enabling self-contained execution of commands within the SteamDispatcher.
Steam-Layer Command implementation.
static HandlingPattern const & get(ID id)
retrieve the pre-configured pattern
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.
object-like record of data.
CommandImpl(CommandImpl const &orig, UndoMutation const &newUndo, shared_ptr< CmdClosure > const &newClosure)
Interface: Operation Skeleton how to invoke or undo a command.
string newID(Symbol prefix)
create a random new ID