44 #ifndef CONTROL_COMMAND_STORAGE_HOLDER_H 45 #define CONTROL_COMMAND_STORAGE_HOLDER_H 79 template<
typename SIG,
typename MEM>
89 using ArgTuple =
typename ArgHolder::ArgTuple;
90 using Args =
typename lib::meta::RebindTupleTypes<ArgTuple>::Seq;
106 return arguments_->isValid();
112 return memento_->isValid();
147 throw err::State{
"Lifecycle error: can't bind functor, " 148 "command arguments not yet provided" 149 , LERR_(UNBOUND_ARGUMENTS)};
151 arguments_->invoke(func);
156 operator string()
const override 158 return "Command-State{ arguments=" 159 + (arguments_->isValid()? string(*arguments_) :
"unbound")
160 +
", "+
string(*memento_)+
"}" 184 if (oAh.arguments_->isValid())
185 arguments_.template create<ArgHolder> (*oAh.arguments_);
188 memento_.template create<MemHolder> (*oAh.memento_);
207 bool canUndo ()
const {
return memento_->isValid(); }
208 bool empty ()
const {
return !arguments_->isValid(); }
216 arguments_.template create<ArgHolder> (argTup);
222 arguments_.template create<ArgHolder>();
227 typedef typename CommandSignature<SIG,MEM>::OperateSig SIG_op;
228 typedef typename CommandSignature<SIG,MEM>::CaptureSig SIG_cap;
229 typedef typename CommandSignature<SIG,MEM>::UndoOp_Sig SIG_undo;
235 tie (function<SIG_undo>
const& undoFunc,
236 function<SIG_cap>
const& captureFunc)
238 return memento_.template create<MemHolder> (undoFunc,captureFunc);
257 return memento_->getState();
Implementation of the concrete (sub)-closure of a command, responsible for invoking the actual comman...
bool canUndo() const
has undo state capturing been invoked?
Abstract foundation for building custom allocation managers.
void buildCloneContext(ARG const &origArgHolder)
to be executed from within the specifically typed context of a concrete command StorageHolder; alloca...
virtual void unbindArguments() override
discard any argument data and return to empty state
MEM & memento()
direct "backdoor" access to stored memento value.
StorageHolder(StorageHolder const &oAh)
copy construction allowed(but no assignment).
Steam-Layer implementation namespace root.
StorageHolder & operator=(StorageHolder const &)=delete
copy construction allowed(but no assignment)
MementoTie< SIG, MEM > & tie(function< SIG_undo > const &undoFunc, function< SIG_cap > const &captureFunc)
create a new memento storage wiring, discarding existing memento state.
closure to deal with the actual command operation.
A special binding used by Steam-Layer commands for capturing UNDO state information.
MementoTie< SIG, MEM > & getMementoWiring()
just re-access an existing memento storage wiring.
Derived specific exceptions within Lumiera's exception hierarchy.
virtual bool isValid() const override
does this closure hold a valid argument tuple?
Helper allowing type erasure while holding the actual object inline.
virtual void invoke(CmdFunctor const &func) override
invoke functor using the stored parameter values
Visitor to support creating a CommandImpl clone.
void storeTuple(ArgTuple const &argTup)
store a new argument tuple within this StorageHolder, discarding any previously stored arguments ...
Helper for creating an implementation clone, based on the visitor pattern.
virtual void bindArguments(lib::diff::Rec const ¶mData) override
assign a new set of parameter values to this.
Buffer to place and maintain an object instance privately within another object.
virtual bool isCaptured() const override
does this closure hold captured UNDO state?
void accept(CommandImplCloneBuilder &visitor) const override
assist with creating a clone copy; this results in invocation of the copy ctor
virtual void bindArguments(Arguments &args) override
assign a new parameter tuple to this
object-like record of data.
Binding together state capturing and execution of the undo operation.
This is "the" top level CmdClosure implementation.
StorageHolder()
per default, all data within StorageHolder is set up in empty state.