48using std::ostringstream;
58 LUMIERA_ERROR_DEFINE (INVALID_ARGUMENTS,
"Arguments provided for binding doesn't match stored command function parameters");
59 LUMIERA_ERROR_DEFINE (UNBOUND_ARGUMENTS,
"Command mutation functor not yet usable, because arguments aren't bound");
60 LUMIERA_ERROR_DEFINE (MISSING_MEMENTO,
"Undo functor not yet usable, because no undo state has been captured");
74 if (!handle->isValid())
76 ,
LERR_(INVALID_COMMAND));
84 throw error::State (
"Lifecycle error: command arguments not bound"
85 ,
LERR_(UNBOUND_ARGUMENTS));
93 throw error::State (
"Lifecycle error: command has not yet captured UNDO information"
94 ,
LERR_(UNBOUND_ARGUMENTS));
125 ,
LERR_(INVALID_COMMAND));
143 return cmd?
cmd.newInstance()
173 impl().cmdID = cmdID;
187 ___check_notBottom (
this,
"Cloning");
202 ___check_notBottom (
this,
"Cloning");
233 "ID \"%s\" is already in use")
236 ,
LERR_(DUPLICATE_COMMAND));
253 ___check_notBottom (
this,
"Binding arguments of");
266 ___check_notBottom (
this,
"Binding arguments of");
281 ___check_notBottom (
this,
"Un-binding arguments of");
309 return com.isValid();
353 and impl().canExec();
361 and impl().canUndo();
368 return isValid()? impl().cmdID
389 Command::operator string()
const
393 repr <<
"Command(\""<<getID()<<
"\") ";
414 ___check_notBottom (
this,
"Invoking");
415 ___check_isBound (
this);
426 ___check_notBottom (
this,
"UNDOing");
427 ___check_canUndo (
this);
459 ___check_notBottom (
this,
"Accessing");
460 return impl().getDefaultHandlingPattern();
467 ___check_notBottom (
this,
"Configuring");
468 return impl().setHandlingPattern(
pattID);
Access point to singletons and other kinds of dependencies designated by type.
CommandImpl & impl() const
Handle & activate(CommandImpl *impl, DEL whenDead)
Activation of the handle by the managing service.
Token or Atom with distinct identity.
shared_ptr< XX > create(ARGS &&...args)
object-like record of data.
bool isValid() const
is this a valid command definition? especially.
~CommandDef()
when starting a CommandDef, we immediately place a yet empty Command object into the index,...
Visitor to support creating a CommandImpl clone.
Steam-Layer Command implementation.
Registry managing command implementation objects (Singleton).
static lib::Depend< CommandRegistry > instance
storage for the singleton factory used to access CommandRegistry
Command queryIndex(Symbol cmdID)
query the command index by ID
shared_ptr< CommandImpl > createCloneImpl(CommandImpl const &refObject)
create an allocation for holding a clone of the given CommandImpl data.
TypedAllocationManager allocator_
Handle object representing a single Command instance to be used by client code.
ExecResult execSync()
invoke using a default "synchronous" execution pattern
void duplicate_detected(Symbol) const
HandlingPattern::ID setHandlingPattern(HandlingPattern::ID)
define a handling pattern to be used by default
static Command maybeGetNewInstance(Symbol cmdID)
try to access an existing command definition and immediately create a new clone copy by calling newIn...
static size_t definition_count()
static Command fetchDef(Symbol cmdID)
Command & unbind()
discard any argument data previously bound.
void activate(shared_ptr< CommandImpl > &&, Symbol cmdID=0)
void setArguments(Arguments &)
Command newInstance() const
create independent (anonymous) clone copy of this command
Symbol getID() const noexcept
static Command get(Symbol cmdID)
Access existing command for use.
HandlingPattern::ID getDefaultHandlingPattern() const
static bool remove(Symbol cmdID)
Command storeDef(Symbol newCmdID) const
create a clone definition
static size_t instance_count()
Result (Status) of command execution.
Interface: Operation Skeleton how to invoke or undo a command.
static HandlingPattern const & get(ID id)
retrieve the pre-configured pattern
A front-end for using printf-style formatting.
Actually defining a command and binding it to execution parameters.
Helper for creating an implementation clone, based on the visitor pattern.
Top level of the command implementation.
Managing command definitions and the storage of individual command objects.
Steam-Layer command frontend.
#define LUMIERA_ERROR_DEFINE(err, msg)
Definition and initialisation of an error constant.
Lumiera error handling (C++ interface).
Pre-defined command execution skeletons.
LumieraError< LERR_(STATE)> State
LumieraError< LERR_(LOGIC)> Logic
LumieraError< LERR_(INVALID)> Invalid
Lumiera public interface.
void ___check_notBottom(const Command *handle, lib::Literal operation_descr)
bool was_activated(Command const &com)
void ___check_isBound(const Command *handle)
Command registered_for(Symbol id)
void ___check_canUndo(const Command *handle)
Steam-Layer implementation namespace root.
Marker types to indicate a literal string and a Symbol.
CStr cStr(std::string const &rendered)
convenience shortcut: forced conversion to c-String via string.
Tiny helper functions and shortcuts to be used everywhere Consider this header to be effectively incl...