35 #ifndef CONTROL_COMMAND_STORAGE_HOLDER_H 36 #define CONTROL_COMMAND_STORAGE_HOLDER_H 70 template<
typename SIG,
typename MEM>
80 using ArgTuple =
typename ArgHolder::ArgTuple;
81 using Args =
typename lib::meta::RebindTupleTypes<ArgTuple>::Seq;
97 return arguments_->isValid();
103 return memento_->isValid();
138 throw err::State{
"Lifecycle error: can't bind functor, " 139 "command arguments not yet provided" 140 , LERR_(UNBOUND_ARGUMENTS)};
142 arguments_->invoke(func);
147 operator string()
const override 149 return "Command-State{ arguments=" 150 + (arguments_->isValid()? string(*arguments_) :
"unbound")
151 +
", "+
string(*memento_)+
"}" 175 if (oAh.arguments_->isValid())
176 arguments_.template create<ArgHolder> (*oAh.arguments_);
179 memento_.template create<MemHolder> (*oAh.memento_);
198 bool canUndo ()
const {
return memento_->isValid(); }
199 bool empty ()
const {
return !arguments_->isValid(); }
207 arguments_.template create<ArgHolder> (argTup);
213 arguments_.template create<ArgHolder>();
218 typedef typename CommandSignature<SIG,MEM>::OperateSig SIG_op;
219 typedef typename CommandSignature<SIG,MEM>::CaptureSig SIG_cap;
220 typedef typename CommandSignature<SIG,MEM>::UndoOp_Sig SIG_undo;
226 tie (function<SIG_undo>
const& undoFunc,
227 function<SIG_cap>
const& captureFunc)
229 return memento_.template create<MemHolder> (undoFunc,captureFunc);
248 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.