Commands: draft usage of CommandInstanceManager (#1089)
This commit is contained in:
parent
12a7d96d9f
commit
a91d03b60a
5 changed files with 221 additions and 12 deletions
|
|
@ -28,7 +28,7 @@
|
|||
** This creates the specific twist that possible command instances for invocation can and will
|
||||
** be formed during an extended time period, non-deterministically -- since the actual context
|
||||
** depends on the user interactions. Within the UI, there is a dedicated mechanism to form such
|
||||
** command invocation similar to forming sentences of a language (with subject, predication and
|
||||
** command invocations similar to forming sentences of a language (with subject, predication and
|
||||
** possibly some further objects). The UI manages several InteractionStateManager instances to
|
||||
** observe and pick up contextual state, finally leading to a complete parametrisation of a command.
|
||||
** The CommandInstanceManager is a service to support this process; it prepares command instances
|
||||
|
|
|
|||
|
|
@ -122,6 +122,11 @@ return: 0
|
|||
END
|
||||
|
||||
|
||||
PLANNED "Command instance management" CommandInstanceManager_test <<END
|
||||
return: 0
|
||||
END
|
||||
|
||||
|
||||
TEST "Dispatcher loop control logic" DispatcherLooper_test <<END
|
||||
return: 0
|
||||
END
|
||||
|
|
|
|||
130
tests/core/proc/control/command-instance-manager-test.cpp
Normal file
130
tests/core/proc/control/command-instance-manager-test.cpp
Normal file
|
|
@ -0,0 +1,130 @@
|
|||
/*
|
||||
CommandInstanceManager(Test) - verify helper for setup of actual command definitions
|
||||
|
||||
Copyright (C) Lumiera.org
|
||||
2017, Hermann Vosseler <Ichthyostega@web.de>
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2 of
|
||||
the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
* *****************************************************/
|
||||
|
||||
/** @file command-instance-manager-test.cpp
|
||||
** unit test \ref CommandInstanceManager_test
|
||||
*/
|
||||
|
||||
|
||||
#include "lib/test/run.hpp"
|
||||
#include "proc/control/command-instance-manager.hpp"
|
||||
#include "proc/control/command-dispatch.hpp"
|
||||
//#include "proc/control/command-def.hpp"
|
||||
#include "lib/format-string.hpp"
|
||||
#include "lib/format-cout.hpp"
|
||||
#include "lib/util.hpp"
|
||||
|
||||
#include <string>
|
||||
#include <regex>
|
||||
|
||||
|
||||
namespace proc {
|
||||
namespace control {
|
||||
namespace test {
|
||||
|
||||
using lib::Literal;
|
||||
using std::string;
|
||||
using std::regex;
|
||||
using std::regex_replace;
|
||||
using util::isnil;
|
||||
using util::_Fmt;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
namespace { // Test fixture....
|
||||
|
||||
struct Fixture
|
||||
: CommandDispatch
|
||||
{
|
||||
bool has_commands_in_queue = false;
|
||||
|
||||
|
||||
/* == Interface: CommandDispatch == */
|
||||
|
||||
void
|
||||
clear() override
|
||||
{
|
||||
UNIMPLEMENTED("DummyDispatch-Interface: clear");
|
||||
}
|
||||
|
||||
void
|
||||
enqueue (Command) override
|
||||
{
|
||||
UNIMPLEMENTED("DummyDispatch-Interface: enqueue");
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/***********************************************************************//**
|
||||
* @test CommandInstanceManager is responsible for providing individual
|
||||
* clone copies from a basic command definition, to be bound with
|
||||
* actual arguments and finally handed over to the ProcDispatcher
|
||||
* for invocation.
|
||||
*
|
||||
* @see proc::control::CommandInstanceManager
|
||||
*/
|
||||
class CommandInstanceManager_test : public Test
|
||||
{
|
||||
|
||||
virtual void
|
||||
run (Arg)
|
||||
{
|
||||
verify_standardUsage();
|
||||
}
|
||||
|
||||
|
||||
/** @test demonstrate the standard usage pattern of...
|
||||
*/
|
||||
void
|
||||
verify_standardUsage()
|
||||
{
|
||||
UNIMPLEMENTED("standard usage cycle");
|
||||
#if false /////////////////////////////////////////////////////////////////////////////////////////////////////////////UNIMPLEMENTED :: TICKET #1089
|
||||
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};
|
||||
///TODO bind arguments
|
||||
CHECK (Command::canExec(instanceID));
|
||||
|
||||
iManager.dispatch (instanceID);
|
||||
CHECK (not iManager.contains (instanceID));
|
||||
CHECK (fixture.contains (instanceID));
|
||||
CHECK (Command::canExec(instanceID));
|
||||
#endif /////////////////////////////////////////////////////////////////////////////////////////////////////////////UNIMPLEMENTED :: TICKET #1089
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/** Register this test class... */
|
||||
LAUNCHER (CommandInstanceManager_test, "unit controller");
|
||||
|
||||
|
||||
}}} // namespace proc::control::test
|
||||
|
|
@ -280,4 +280,4 @@ namespace test {
|
|||
LAUNCHER (CommandSetup_test, "unit controller");
|
||||
|
||||
|
||||
}}} // namespace proc::control::test
|
||||
}}} // namespace proc::cmd::test
|
||||
|
|
|
|||
|
|
@ -788,7 +788,7 @@
|
|||
<node CREATED="1484877868015" ID="ID_1612427727" MODIFIED="1484877878730" TEXT="über die Rolle des GUI-Modells nachdenken!"/>
|
||||
</node>
|
||||
</node>
|
||||
<node CREATED="1481320772830" FOLDED="true" HGAP="21" ID="ID_1607125695" MODIFIED="1488423342658" VSHIFT="11">
|
||||
<node CREATED="1481320772830" FOLDED="true" HGAP="21" ID="ID_1607125695" MODIFIED="1490986155474" VSHIFT="11">
|
||||
<richcontent TYPE="NODE"><html>
|
||||
<head>
|
||||
|
||||
|
|
@ -1272,7 +1272,7 @@
|
|||
<icon BUILTIN="idea"/>
|
||||
</node>
|
||||
</node>
|
||||
<node CREATED="1483748175610" FOLDED="true" HGAP="31" ID="ID_73597248" MODIFIED="1488423342540" VSHIFT="16">
|
||||
<node CREATED="1483748175610" FOLDED="true" HGAP="31" ID="ID_73597248" MODIFIED="1490986131069" VSHIFT="16">
|
||||
<richcontent TYPE="NODE"><html>
|
||||
<head>
|
||||
|
||||
|
|
@ -1542,7 +1542,7 @@
|
|||
<icon BUILTIN="button_ok"/>
|
||||
</node>
|
||||
</node>
|
||||
<node CREATED="1482464658193" FOLDED="true" HGAP="-14" ID="ID_726798260" MODIFIED="1488423342541" TEXT="Ausgestaltung" VSHIFT="29">
|
||||
<node CREATED="1482464658193" FOLDED="true" HGAP="-14" ID="ID_726798260" MODIFIED="1490986126286" TEXT="Ausgestaltung" VSHIFT="29">
|
||||
<icon BUILTIN="button_ok"/>
|
||||
<node CREATED="1482465840843" FOLDED="true" ID="ID_818984499" MODIFIED="1488423308107" TEXT="Entwurf">
|
||||
<icon BUILTIN="stop-sign"/>
|
||||
|
|
@ -1915,7 +1915,7 @@
|
|||
</html></richcontent>
|
||||
</node>
|
||||
</node>
|
||||
<node COLOR="#338800" CREATED="1485917582383" FOLDED="true" HGAP="163" ID="ID_394170572" MODIFIED="1489460652863" TEXT="Struktur" VSHIFT="-30">
|
||||
<node COLOR="#338800" CREATED="1485917582383" FOLDED="true" HGAP="163" ID="ID_394170572" MODIFIED="1490986104297" TEXT="Struktur" VSHIFT="-30">
|
||||
<icon BUILTIN="button_ok"/>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1485917587927" ID="ID_891876702" MODIFIED="1485917622265" TEXT="wohin kommen jetzt die Funktionen, die gebunden werden">
|
||||
<icon BUILTIN="help"/>
|
||||
|
|
@ -11669,10 +11669,14 @@
|
|||
<linktarget COLOR="#606d94" DESTINATION="ID_346158251" ENDARROW="Default" ENDINCLINATION="842;21;" ID="Arrow_ID_726918944" SOURCE="ID_898481930" STARTARROW="None" STARTINCLINATION="1012;0;"/>
|
||||
<icon BUILTIN="idea"/>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1489191208557" ID="ID_632390561" MODIFIED="1489191213157" TEXT="#1088 Command definition registration">
|
||||
<icon BUILTIN="flag-yellow"/>
|
||||
<node CREATED="1489196546018" ID="ID_1282964530" MODIFIED="1489196556661" TEXT="ggfs nur vorläufige Lösung"/>
|
||||
<node CREATED="1489196562816" ID="ID_1001161089" MODIFIED="1489196567059" TEXT="siehe DummyCommand"/>
|
||||
<node COLOR="#338800" CREATED="1489191208557" FOLDED="true" ID="ID_632390561" MODIFIED="1490986212354" TEXT="#1088 Command definition registration">
|
||||
<icon BUILTIN="button_ok"/>
|
||||
<node CREATED="1490986190364" ID="ID_266121409" MODIFIED="1490986197777" TEXT="CommandSetup helper">
|
||||
<icon BUILTIN="button_ok"/>
|
||||
</node>
|
||||
<node CREATED="1490986198683" ID="ID_658767230" MODIFIED="1490986204279" TEXT="Build-Skript vertagt">
|
||||
<icon BUILTIN="hourglass"/>
|
||||
</node>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1489191229098" ID="ID_341428100" MODIFIED="1489191638320" TEXT="#1089 Command instance management">
|
||||
<linktarget COLOR="#584d79" DESTINATION="ID_341428100" ENDARROW="Default" ENDINCLINATION="1995;-1317;" ID="Arrow_ID_879741123" SOURCE="ID_1331796226" STARTARROW="None" STARTINCLINATION="334;-13;"/>
|
||||
|
|
@ -11685,6 +11689,23 @@
|
|||
<arrowlink DESTINATION="ID_119293304" ENDARROW="Default" ENDINCLINATION="183;-268;" ID="Arrow_ID_1691148413" STARTARROW="None" STARTINCLINATION="363;0;"/>
|
||||
</node>
|
||||
</node>
|
||||
<node CREATED="1490985775995" ID="ID_1920622498" MODIFIED="1490985782446" TEXT="Instance-Manager">
|
||||
<node CREATED="1490985786138" ID="ID_664659428" MODIFIED="1490985793244" TEXT="einfache Komponente"/>
|
||||
<node CREATED="1490985793793" ID="ID_511499018" MODIFIED="1490985798436" TEXT="wo">
|
||||
<node CREATED="1490985799639" ID="ID_1798979341" MODIFIED="1490985804979" TEXT="SessionCommandService"/>
|
||||
<node CREATED="1490985805518" ID="ID_937609414" MODIFIED="1490985814593" TEXT="damit vom SessionLoopThread gemanaged"/>
|
||||
</node>
|
||||
<node CREATED="1490985820613" ID="ID_1526182884" MODIFIED="1490985823408" TEXT="API">
|
||||
<node CREATED="1490985825844" ID="ID_1072463021" MODIFIED="1490985853020" TEXT="neue Instanz">
|
||||
<node CREATED="1490986239341" ID="ID_1121928421" MODIFIED="1490986243065" TEXT="ID dekorieren"/>
|
||||
<node CREATED="1490986243557" ID="ID_1457927529" MODIFIED="1490986249952" TEXT="slot / smart-ptr erzeugen"/>
|
||||
</node>
|
||||
<node CREATED="1490985938597" ID="ID_90790203" MODIFIED="1490985955039" TEXT="Dispatch">
|
||||
<node CREATED="1490986252963" ID="ID_1745967844" MODIFIED="1490986257991" TEXT="smart-ptr move"/>
|
||||
<node CREATED="1490986258483" ID="ID_462607969" MODIFIED="1490986261422" TEXT="slot leeren"/>
|
||||
</node>
|
||||
</node>
|
||||
</node>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1489191252503" ID="ID_1621107057" MODIFIED="1489191308469" TEXT="#1090 Command access for UI-Elements">
|
||||
<arrowlink COLOR="#758ba4" DESTINATION="ID_827179653" ENDARROW="Default" ENDINCLINATION="173;83;" ID="Arrow_ID_57938013" STARTARROW="None" STARTINCLINATION="550;-93;"/>
|
||||
|
|
@ -11904,12 +11925,13 @@
|
|||
<node CREATED="1489781404925" ID="ID_1918933171" MODIFIED="1489781408881" TEXT="Command-ID">
|
||||
<node CREATED="1489781409876" ID="ID_1973020417" MODIFIED="1489781419119" TEXT="Bais-ID ist ein string"/>
|
||||
</node>
|
||||
<node CREATED="1489781426978" ID="ID_1543445405" MODIFIED="1489781434517" TEXT="konkrete Definition">
|
||||
<node CREATED="1489781426978" ID="ID_1543445405" MODIFIED="1490985671060" TEXT="konkrete Definition">
|
||||
<icon BUILTIN="button_ok"/>
|
||||
<node CREATED="1489781443184" ID="ID_966382785" MODIFIED="1489781445387" TEXT="Ort">
|
||||
<node CREATED="1489781447639" ID="ID_588776773" MODIFIED="1489781474176" TEXT="proc/cmd/*-cmd.cpp"/>
|
||||
<node CREATED="1489781476355" ID="ID_1953562265" MODIFIED="1489781480998" TEXT="Namespace proc::cmd"/>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1489781611257" ID="ID_179887792" MODIFIED="1489781650026" TEXT="brauche">
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1489781611257" FOLDED="true" ID="ID_179887792" MODIFIED="1490985665139" TEXT="brauche">
|
||||
<icon BUILTIN="messagebox_warning"/>
|
||||
<node CREATED="1489781616257" ID="ID_1645536558" MODIFIED="1489781625283" TEXT="Schema für ID-Konstanten"/>
|
||||
<node CREATED="1489781628743" ID="ID_1733247268" MODIFIED="1489781635194" TEXT="Mechanismus, der die Definition treibt"/>
|
||||
|
|
@ -12029,6 +12051,58 @@
|
|||
</node>
|
||||
</node>
|
||||
</node>
|
||||
<node CREATED="1490985673313" ID="ID_1705714293" MODIFIED="1490985677228" TEXT="Instanzen">
|
||||
<node CREATED="1490985683359" ID="ID_476048128" MODIFIED="1490985691466" TEXT="Instanz-Manager">
|
||||
<node CREATED="1490985692550" ID="ID_300485716" MODIFIED="1490985696321" TEXT="einfache Komponente"/>
|
||||
<node CREATED="1490985710963" ID="ID_447657694" MODIFIED="1490985717974" TEXT="keinerlei Lifecycle-Magie"/>
|
||||
<node CREATED="1490985720722" ID="ID_1386937508" MODIFIED="1490985736292" TEXT="ist nur eine Registry mit etwas Funktionalität">
|
||||
<node CREATED="1490986294710" ID="ID_558020871" MODIFIED="1490986301601" TEXT="Comand-IDs dekorieren"/>
|
||||
<node CREATED="1490986302197" ID="ID_1305641719" MODIFIED="1490986308216" TEXT="fortlaufenden Zähler verwalten">
|
||||
<node CREATED="1490986345879" ID="ID_1736956933" MODIFIED="1490986393723" TEXT="denn: Dispatch bedeutet Verzögerung">
|
||||
<richcontent TYPE="NOTE"><html>
|
||||
<head>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<p>
|
||||
...also ist eine Instanz durchaus noch am Leben,
|
||||
</p>
|
||||
<p>
|
||||
während bereits die nächste Instanz für das GUI ausgegeben wurde.
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
||||
</richcontent>
|
||||
<icon BUILTIN="idea"/>
|
||||
</node>
|
||||
<node CREATED="1490986395088" ID="ID_52247198" MODIFIED="1490986412151" TEXT="Stets nur eine Instanz im Instance-manager">
|
||||
<icon BUILTIN="yes"/>
|
||||
</node>
|
||||
<node CREATED="1490986336425" ID="ID_1955343463" MODIFIED="1490986430233" TEXT="Konsequenz: leerer Eintrag">
|
||||
<richcontent TYPE="NOTE"><html>
|
||||
<head>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<p>
|
||||
...damit die Nummer erhalten bleibt
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
||||
</richcontent>
|
||||
</node>
|
||||
</node>
|
||||
<node CREATED="1490986309084" ID="ID_1432845924" MODIFIED="1490986319583" TEXT="sicher Übergabe an Dispatch">
|
||||
<node CREATED="1490986320434" ID="ID_1807848022" MODIFIED="1490986324558" TEXT="Dispatch als Closure"/>
|
||||
<node CREATED="1490986325626" ID="ID_167499115" MODIFIED="1490986333421" TEXT="Exception-Safety!"/>
|
||||
</node>
|
||||
</node>
|
||||
<node CREATED="1490985696821" ID="ID_564026288" MODIFIED="1490985706464" TEXT="wird vom SessionCommandService betrieben"/>
|
||||
</node>
|
||||
<node CREATED="1490985748207" ID="ID_1314513556" MODIFIED="1490985751457" TEXT="Instanzbildung">
|
||||
<node CREATED="1490985756381" ID="ID_1346029720" MODIFIED="1490985767448" TEXT="wird durch ID-Dekoration getrieben"/>
|
||||
</node>
|
||||
</node>
|
||||
</node>
|
||||
</node>
|
||||
</node>
|
||||
|
|
|
|||
Loading…
Reference in a new issue