44 #ifndef CONTROL_COMMAND_DEF_H 45 #define CONTROL_COMMAND_DEF_H 75 using std::placeholders::_1;
76 using std::tuple_size;
91 using Activation = function<Command&(ImplInstance &&)>;
96 template<
typename SIG>
99 , CompletedDefinition<SIG>
107 : prototype_(definedCommand)
109 REQUIRE (prototype_);
111 TRACE (command_dbg,
"Completed definition of %s.",
cStr(prototype_));
115 typedef HandlingPattern::ID PattID;
133 return prototype_.bindArg(params);
154 prototype_.bindArg<> (std::tuple<>());
162 template<
typename SIG,
typename MEM>
166 typedef typename CmdType::OperateSig CommandOperationSig;
167 typedef typename CmdType::UndoOp_Sig UndoOperationSig;
168 typedef typename CmdType::CaptureSig UndoCaptureSig;
169 typedef typename CmdType::CmdArgs CmdArgs;
171 typedef function<CommandOperationSig> OperFunc;
172 typedef function<UndoOperationSig> UndoFunc;
173 typedef function<UndoCaptureSig> CaptFunc;
175 Activation activatePrototype_;
176 OperFunc operFunctor_;
177 CaptFunc captFunctor_;
178 UndoFunc undoFunctor_;
182 OperFunc
const& commandOperation,
183 CaptFunc
const& undoCapOperation)
184 : activatePrototype_(whenComplete)
185 , operFunctor_(commandOperation)
186 , captFunctor_(undoCapOperation)
192 undoOperation (UndoOperationSig how_to_Undo)
194 undoFunctor_ = UndoFunc (how_to_Undo);
195 REQUIRE (operFunctor_);
196 REQUIRE (undoFunctor_);
197 REQUIRE (captFunctor_);
212 template<
typename U_SIG>
223 template<
typename SIG>
226 Activation callback_;
227 function<SIG> operation_;
229 BasicDefinition(Activation
const& whenComplete, function<SIG>
const& operation)
230 : callback_(whenComplete)
231 , operation_(operation)
235 template<
typename FUN2>
237 captureUndo (FUN2 how_to_capture_UndoState)
240 using UndoCapSig =
typename UndoSignature<Sig2>::CaptureSig;
243 function<UndoCapSig> captureOperation (how_to_capture_UndoState);
244 return SpecificUndoDefinition (callback_, operation_, captureOperation);
275 using Activation = stage::Activation;
282 TRACE (command_dbg,
"starting CommandDef('%s')...", cmdID.c() );
289 template<
typename FUN>
291 operation (FUN operation_to_define)
295 function<Sig> opera1 (operation_to_define);
302 explicit operator bool()
const {
return isValid(); }
304 bool isValid()
const;
313 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(...