diff --git a/src/proc/control/command-impl-clone-builder.hpp b/src/proc/control/command-impl-clone-builder.hpp index 3f68fdcee..ce18a24a2 100644 --- a/src/proc/control/command-impl-clone-builder.hpp +++ b/src/proc/control/command-impl-clone-builder.hpp @@ -29,10 +29,10 @@ ** command implementation need to be cloned and re-wired with the cloned partners, ** which requires re-creating the specifically typed context used at initial setup. ** - ** Ticket #301 : it may well be that the need for such a facility is a symptom of - ** misaligned design, but I rather doubt so -- because both the memento holder and + ** @todo Ticket #301 : it may well be that the need for such a facility is a symptom + ** of misaligned design, but I rather doubt so -- because both the memento holder and ** the command closure need a specifically typed context, and there is no reason - ** for combining them into a single facility. + ** for combining them into a single facility. ** ** @see CommandRegistry#createCloneImpl ** @see CommandImpl @@ -46,26 +46,17 @@ #ifndef CONTROL_COMMAND_IMPL_CLONE_BUILDER_H #define CONTROL_COMMAND_IMPL_CLONE_BUILDER_H -//#include "proc/control/command.hpp" -//#include "proc/control/command-closure.hpp" #include "proc/control/command-mutation.hpp" #include "lib/typed-allocation-manager.hpp" #include "lib/opaque-holder.hpp" -//#include "lib/bool-checkable.hpp" #include -//#include - -//#include -//#include namespace proc { namespace control { using lib::TypedAllocationManager; -// using std::function; -// using std::shared_ptr; using lib::InPlaceBuffer; @@ -159,7 +150,7 @@ namespace control { { REQUIRE (!newContext_->isValid(), "Lifecycle-Error"); - newContext_.create (origArgHolder, allocator_); + newContext_.create (origArgHolder, allocator_); } diff --git a/src/proc/control/command.cpp b/src/proc/control/command.cpp index c4abfcbc6..d0abdfd19 100644 --- a/src/proc/control/command.cpp +++ b/src/proc/control/command.cpp @@ -349,14 +349,29 @@ namespace control { } + namespace { + const Symbol ANONYMOUS_CMD_SYMBOL("_anonymous_"); + } + Symbol Command::getID() const { + ////////////////////////////////////////////////////////////////////TODO do we need no-throw guarantee here? Symbol id = CommandRegistry::instance().findDefinition (*this); - if (!id) - throw error::State("Encountered a NIL command handle while expecting a bound one." - ,error::LUMIERA_ERROR_BOTTOM_VALUE); - return id; + return id? id + : ANONYMOUS_CMD_SYMBOL; + } + + + /** @return `true` when this command (front-end) was never registered + * with the CommandRegistry; typically this is the case with instances + * created from a prototype, when calling Command::newInstance instead + * of invoking Command::storeDef(Symbol). + */ + bool + Command::isAnonymous() const + { + return not CommandRegistry::instance().findDefinition (*this); } @@ -367,13 +382,8 @@ namespace control { Command::operator string() const { ostringstream repr; - repr << "Command"; ////////////////////////////////////////////////////////////////////TODO do we need no-throw guarantee here? - Symbol id = CommandRegistry::instance().findDefinition (*this); - if (id) - repr << "(\""<