53 #ifndef CONTROL_COMMAND_DEF_H 54 #define CONTROL_COMMAND_DEF_H 84 using std::placeholders::_1;
85 using std::tuple_size;
100 using Activation = function<Command&(ImplInstance &&)>;
105 template<
typename SIG>
108 , CompletedDefinition<SIG>
116 : prototype_(definedCommand)
118 REQUIRE (prototype_);
120 TRACE (command_dbg,
"Completed definition of %s.",
cStr(prototype_));
124 typedef HandlingPattern::ID PattID;
142 return prototype_.bindArg(params);
163 prototype_.bindArg<> (std::tuple<>());
171 template<
typename SIG,
typename MEM>
175 typedef typename CmdType::OperateSig CommandOperationSig;
176 typedef typename CmdType::UndoOp_Sig UndoOperationSig;
177 typedef typename CmdType::CaptureSig UndoCaptureSig;
178 typedef typename CmdType::CmdArgs CmdArgs;
180 typedef function<CommandOperationSig> OperFunc;
181 typedef function<UndoOperationSig> UndoFunc;
182 typedef function<UndoCaptureSig> CaptFunc;
184 Activation activatePrototype_;
185 OperFunc operFunctor_;
186 CaptFunc captFunctor_;
187 UndoFunc undoFunctor_;
191 OperFunc
const& commandOperation,
192 CaptFunc
const& undoCapOperation)
193 : activatePrototype_(whenComplete)
194 , operFunctor_(commandOperation)
195 , captFunctor_(undoCapOperation)
201 undoOperation (UndoOperationSig how_to_Undo)
203 undoFunctor_ = UndoFunc (how_to_Undo);
204 REQUIRE (operFunctor_);
205 REQUIRE (undoFunctor_);
206 REQUIRE (captFunctor_);
221 template<
typename U_SIG>
232 template<
typename SIG>
235 Activation callback_;
236 function<SIG> operation_;
238 BasicDefinition(Activation
const& whenComplete, function<SIG>
const& operation)
239 : callback_(whenComplete)
240 , operation_(operation)
244 template<
typename FUN2>
246 captureUndo (FUN2 how_to_capture_UndoState)
249 using UndoCapSig =
typename UndoSignature<Sig2>::CaptureSig;
252 function<UndoCapSig> captureOperation (how_to_capture_UndoState);
253 return SpecificUndoDefinition (callback_, operation_, captureOperation);
284 using Activation = stage::Activation;
291 TRACE (command_dbg,
"starting CommandDef('%s')...", cmdID.c() );
298 template<
typename FUN>
300 operation (FUN operation_to_define)
304 function<Sig> opera1 (operation_to_define);
311 explicit operator bool()
const {
return isValid(); }
313 bool isValid()
const;
322 prototype_.
activate (move (completedDef), id_);
Helper class used solely for defining a Command-Object.
HandlingPattern::ID setHandlingPattern(HandlingPattern::ID)
define a handling pattern to be used by default
CompletedDefinition setHandlingPattern(PattID newID)
allow for defining the default execution pattern, which is used by Command::operator() ...
A template metaprogramming technique for manipulating collections of types.
CStr cStr(std::string const &rendered)
convenience shortcut: forced conversion to c-String via string.
typename BuildTupleType< TYPES >::Type Tuple
Build a std::tuple from types given as type sequence.
Core of a Steam-Layer command: functor containing the operation to be executed.
Mixin-templates providing arbitrary function call operators and argument binding functions.
shared_ptr< CommandImpl > newCommandImpl(function< SIG_OPER > &operFunctor, function< SIG_CAPT > &captFunctor, function< SIG_UNDO > &undoFunctor)
set up a new command implementation frame
Any copy and copy construction prohibited.
Top level of the command implementation.
void activate(shared_ptr< CommandImpl > &&, Symbol cmdID=0)
Managing command definitions and the storage of individual command objects.
This header is for including and configuring NoBug.
Registry managing command implementation objects (Singleton).
Steam-Layer implementation namespace root.
Metaprogramming with tuples-of-types and the std::tuple record.
Token or Atom with distinct identity.
Mix-Ins to allow or prohibit various degrees of copying and cloning.
type re-binding helper: create a suitable UndoDefinition type, based on the UndoSignature template in...
Metaprogramming tools for transforming functor types.
Marker types to indicate a literal string and a Symbol.
Lumiera GTK UI implementation root.
Tiny helper functions and shortcuts to be used everywhere Consider this header to be effectively incl...
Command & bindArg(Tuple< CmdArgs > const ¶ms)
allow to bind immediately to a set of arguments.
Steam-Layer command frontend.
void maybeArm_if_zero_parameters()
Helper: automatically "bind" and make executable a command, for the case when the command operation t...
static Command fetchDef(Symbol cmdID)
Lumiera error handling (C++ interface).
Handle object representing a single Command instance to be used by client code.
Command & activate(PImpl &&completedDef)
callback from completed command definition stage: "arm up" the command handle object and register it ...
Metaprogramming helper for building Command function signatures.
Metaprogramming helpers for deriving the precise function signatures necessary to implement a given c...
Metaprogramming: Helpers for manipulating lists-of-types.
string newID(Symbol prefix)
create a random new ID
static lib::Depend< CommandRegistry > instance
storage for the singleton factory used to access CommandRegistry
Variation of AcceptArgumentBinding, allowing to control the return type of the generated bind(...