Lumiera  0.pre.03
»edit your freedom«
StorageHolder< SIG, MEM > Class Template Reference

#include "steam/control/command-storage-holder.hpp"

Description

template<typename SIG, typename MEM>
class steam::control::StorageHolder< SIG, MEM >

This is "the" top level CmdClosure implementation.

It is a specifically typed CmdClosure, which serves for actually allocating storage to hold the command arguments and the UNDO state (memento) for Steam-Layer commands. Both the contained components within StorageHolder can be in empty state; there are no distinct lifecycle limitations. StorageHolder is part of Steam-Layer command's implementation and should not be used standalone.

Definition at line 80 of file command-storage-holder.hpp.

Public Types

typedef CommandSignature< SIG, MEM >::CaptureSig SIG_cap
 
typedef CommandSignature< SIG, MEM >::OperateSig SIG_op
 
typedef CommandSignature< SIG, MEM >::UndoOp_Sig SIG_undo
 

Public Member Functions

 StorageHolder ()
 per default, all data within StorageHolder is set up in empty state. More...
 
 StorageHolder (StorageHolder const &oAh)
 copy construction allowed(but no assignment). More...
 
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
 
virtual void bindArguments (lib::diff::Rec const &paramData) override
 assign a new set of parameter values to this. More...
 
bool canUndo () const
 has undo state capturing been invoked?
 
void clearStorage ()
 
bool empty () const
 
MementoTie< SIG, MEM > & getMementoWiring ()
 just re-access an existing memento storage wiring. More...
 
virtual void invoke (CmdFunctor const &func) override
 invoke functor using the stored parameter values
 
virtual bool isCaptured () const override
 does this closure hold captured UNDO state?
 
virtual bool isValid () const override
 does this closure hold a valid argument tuple?
 
MEM & memento ()
 direct "backdoor" access to stored memento value. More...
 
virtual operator string () const override
 
StorageHolderoperator= (StorageHolder const &)=delete
 copy construction allowed(but no assignment)
 
void storeTuple (ArgTuple const &argTup)
 store a new argument tuple within this StorageHolder, discarding any previously stored arguments
 
MementoTie< SIG, MEM > & tie (function< SIG_undo > const &undoFunc, function< SIG_cap > const &captureFunc)
 create a new memento storage wiring, discarding existing memento state. More...
 
virtual void unbindArguments () override
 discard any argument data and return to empty state
 
- Public Member Functions inherited from CmdClosure
 operator bool () const
 

Private Types

using ArgHolder = OpClosure< SIG >
 
using Args = typename lib::meta::RebindTupleTypes< ArgTuple >::Seq
 
using ArgTuple = typename ArgHolder::ArgTuple
 
using ArgumentBuff = InPlaceBuffer< ArgHolder >
 
using MementoBuff = InPlaceBuffer< MemHolder >
 
using MemHolder = MementoTie< SIG, MEM >
 

Private Attributes

ArgumentBuff arguments_
 
MementoBuff memento_
 

Constructor & Destructor Documentation

◆ StorageHolder() [1/2]

StorageHolder ( )
inline

per default, all data within StorageHolder is set up in empty state.

Later on, the command arguments are to be provided by #bind , whereas the undo functions will be wired by tie

Definition at line 171 of file command-storage-holder.hpp.

◆ StorageHolder() [2/2]

StorageHolder ( StorageHolder< SIG, MEM > const &  oAh)
inline

copy construction allowed(but no assignment).

Remarks
rationale is to support immutable argument values, which means default/copy construction is OK

Definition at line 180 of file command-storage-holder.hpp.

References StorageHolder< SIG, MEM >::operator=().

+ Here is the call graph for this function:

Member Function Documentation

◆ bindArguments()

virtual void bindArguments ( lib::diff::Rec const &  paramData)
inlineoverridevirtual

assign a new set of parameter values to this.

Note
the values are passed packaged into a sequence of GenNode elements. This is the usual way arguments are passed from the UI-Bus

Implements CmdClosure.

Definition at line 130 of file command-storage-holder.hpp.

References StorageHolder< SIG, MEM >::storeTuple().

+ Here is the call graph for this function:

◆ tie()

MementoTie<SIG,MEM>& tie ( function< SIG_undo > const &  undoFunc,
function< SIG_cap > const &  captureFunc 
)
inline

create a new memento storage wiring, discarding existing memento state.

Note
any bound undo/capture functions based on the previously held MementoTie are silently invalidated; using them will likely cause memory corruption!

Definition at line 235 of file command-storage-holder.hpp.

◆ getMementoWiring()

MementoTie<SIG,MEM>& getMementoWiring ( )
inline

just re-access an existing memento storage wiring.

Used when cloning the closure

Definition at line 244 of file command-storage-holder.hpp.

◆ memento()

MEM& memento ( )
inline

direct "backdoor" access to stored memento value.

Exceptions
LUMIERA_ERROR_MISSING_MEMENTOwhen invoked prior to tie(..) and capturing any state

Definition at line 255 of file command-storage-holder.hpp.

+ Inheritance diagram for StorageHolder< SIG, MEM >:
+ Collaboration diagram for StorageHolder< SIG, MEM >:

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