diff --git a/src/proc/control/command-instance-manager.hpp b/src/proc/control/command-instance-manager.hpp index 9ed568f46..4212bce3a 100644 --- a/src/proc/control/command-instance-manager.hpp +++ b/src/proc/control/command-instance-manager.hpp @@ -87,6 +87,7 @@ namespace control { ~CommandInstanceManager(); Symbol newInstance (Symbol prototypeID, string invocationID); + Command& getInstance(Symbol instanceID); void dispatch (Symbol instanceID); bool contains (Symbol instanceID) const; diff --git a/src/proc/control/command-setup.cpp b/src/proc/control/command-setup.cpp index 170b7e893..dd69cbf02 100644 --- a/src/proc/control/command-setup.cpp +++ b/src/proc/control/command-setup.cpp @@ -54,6 +54,7 @@ using lib::Symbol; using lumiera::LifecycleHook; using lumiera::ON_GLOBAL_INIT; using std::string; +using util::unConst; using util::_Fmt; @@ -175,6 +176,18 @@ namespace control { } + Command& + CommandInstanceManager::getInstance (Symbol instanceID) + { + Command& instance = table_[instanceID]; + if (not instance) + throw error::Invalid (_Fmt{"Command instance '%s' is not (yet/anymore) active"} + % instanceID + , LUMIERA_ERROR_INVALID_COMMAND); + return instance; + } + + /** */ void CommandInstanceManager::dispatch (Symbol instanceID) @@ -184,7 +197,7 @@ namespace control { throw error::Logic (_Fmt{"attempt to dispatch command instance '%s' " "without creating a new instance from prototype beforehand"} % instanceID - , LUMIERA_ERROR_INVALID_COMMAND); + , error::LUMIERA_ERROR_LIFECYCLE); if (not instance.canExec()) throw error::State (_Fmt{"attempt to dispatch command instance '%s' " "without binding all arguments properly beforehand"} @@ -193,14 +206,15 @@ namespace control { REQUIRE (instance and instance.canExec()); dispatcher_.enqueue(move (instance)); - ENSURE (not instance); + instance.close(); } bool CommandInstanceManager::contains (Symbol instanceID) const { - return util::contains (table_, instanceID); + return util::contains (table_, instanceID) + and unConst(this)->table_[instanceID].isValid(); } diff --git a/tests/core/proc/control/command-instance-manager-test.cpp b/tests/core/proc/control/command-instance-manager-test.cpp index 974fcc82d..a1dcd573d 100644 --- a/tests/core/proc/control/command-instance-manager-test.cpp +++ b/tests/core/proc/control/command-instance-manager-test.cpp @@ -119,19 +119,18 @@ namespace test { Fixture fixture; CommandInstanceManager iManager{fixture}; Symbol instanceID = iManager.newInstance(COMMAND_PROTOTYPE, INVOCATION_ID); - CHECK (Command::defined(instanceID)); - CHECK (not Command::canExec(instanceID)); - Command cmd{instanceID}; + Command cmd = iManager.getInstance(instanceID); + CHECK (cmd); + CHECK (not cmd.canExec()); + cmd.bind(42); - CHECK (Command::canExec(instanceID)); + CHECK (cmd.canExec()); iManager.dispatch (instanceID); CHECK (not iManager.contains (instanceID)); CHECK (fixture.contains (instanceID)); - CHECK (Command::canExec(instanceID)); -#if false /////////////////////////////////////////////////////////////////////////////////////////////////////////////UNIMPLEMENTED :: TICKET #1089 -#endif /////////////////////////////////////////////////////////////////////////////////////////////////////////////UNIMPLEMENTED :: TICKET #1089 + VERIFY_ERROR (INVALID_COMMAND, iManager.getInstance (instanceID)); } }; diff --git a/wiki/thinkPad.ichthyo.mm b/wiki/thinkPad.ichthyo.mm index 7921eb924..e5e93fa15 100644 --- a/wiki/thinkPad.ichthyo.mm +++ b/wiki/thinkPad.ichthyo.mm @@ -11714,6 +11714,46 @@ + + + + + + + + + + + + + + + + + + + + + + + die Instanz kommt nicht in der Fixture-Queue an + + + + + + + + + + + + + + + + +
+ die Instanz kommt nicht in der Fixture-Queue an +