From 2e9bd78791f83a1fd2b3b0988e045ea04c3858e4 Mon Sep 17 00:00:00 2001 From: Ichthyostega Date: Mon, 9 Jan 2017 03:24:17 +0100 Subject: [PATCH] consider to extend the command handling protocol on UI-Bus (#1058) --- src/gui/ctrl/command-handler.hpp | 42 +++++++++------- src/gui/ctrl/core-service.hpp | 22 ++------- src/gui/notification-service.hpp | 8 +-- src/gui/ui-bus.cpp | 3 +- wiki/thinkPad.ichthyo.mm | 84 ++++++++++++++++++++++++-------- 5 files changed, 97 insertions(+), 62 deletions(-) diff --git a/src/gui/ctrl/command-handler.hpp b/src/gui/ctrl/command-handler.hpp index a399a1b23..082474974 100644 --- a/src/gui/ctrl/command-handler.hpp +++ b/src/gui/ctrl/command-handler.hpp @@ -37,8 +37,6 @@ ** a delegate to implement those translation tasks on receipt of a ** command related UI-bus message. ** - ** @todo initial draft and WIP-WIP-WIP as of 1/2017 - ** ** @see AbstractTangible_test::invokeCommand() ** @see gui::test::Nexus::prepareDiagnosticCommandHandler() ** @@ -50,33 +48,20 @@ #include "lib/error.hpp" -//#include "include/logging.h" -//#include "lib/idi/entry-id.hpp" -#include "include/session-command-facade.h" -#include "proc/control/command-def.hpp" -//#include "gui/notification-service.hpp" -//#include "gui/ctrl/bus-term.hpp" -//#include "gui/ctrl/nexus.hpp" -//#include "lib/util.hpp" -//#include "gui/model/tangible.hpp" #include "lib/diff/gen-node.hpp" -//#include "lib/idi/entry-id.hpp" +#include "include/session-command-facade.h" #include -//#include namespace gui { namespace ctrl{ + namespace error = lumiera::error; -// using lib::HashVal; -// using util::isnil; -// using lib::idi::EntryID; using lib::diff::Rec; using lib::diff::GenNode; using lib::diff::DataCap; using proc::control::SessionCommand; -// using std::string; /** @@ -90,15 +75,35 @@ namespace ctrl{ : public DataCap::Predicate , boost::noncopyable { + GenNode::ID const& commandID_; + /** @todo unimplemented extension of command protocol + * to clone a given command definition prototype + * @param subID additional identifier to extend command-ID + * @return extended command ID, comprised of the basic ID, as given by + * the GenNode::ID of the commandMsg (see CommandHandler(GenNode)), + * extended by the subID and some random digits. + * @throw error::Logic always, not yet implemented ///////////////////////////////////////////////////TICKET #1058 consider extension of UI-Bus protocol + */ bool - handle (Rec const& bindingArgs) override ///< the argument binding message + handle (string const& subID) override ///< the "bang!" message (command invocation) + { + throw error::Logic ("Extended Protocol for cloning command prototypes (Ticket #1058)" + , error::LUMIERA_ERROR_UNIMPLEMENTED); + } + + + /** handle command argument binding message */ + bool + handle (Rec const& bindingArgs) override { SessionCommand::facade().bindArg (commandID_, bindingArgs); return true; } + + /** handle the "bang!" message (trigger invocation) */ bool handle (int const&) override ///< the "bang!" message (command invocation) { @@ -106,6 +111,7 @@ namespace ctrl{ return true; } + public: CommandHandler (GenNode const& commandMsg) : commandID_{commandMsg.idi} diff --git a/src/gui/ctrl/core-service.hpp b/src/gui/ctrl/core-service.hpp index 986ebec93..676b714fe 100644 --- a/src/gui/ctrl/core-service.hpp +++ b/src/gui/ctrl/core-service.hpp @@ -39,9 +39,8 @@ ** both CoreService and Nexus are mutually interdependent from an operational ** perspective, since they exchange messages in both directions. ** - ** @todo initial draft and WIP-WIP-WIP as of 12/2015 - ** - ** @see TODO_abstract-tangible-test.cpp + ** @see AbstractTangible_test + ** @see BusTerm_test ** */ @@ -52,39 +51,26 @@ #include "lib/error.hpp" #include "include/logging.h" -//#include "lib/idi/entry-id.hpp" +#include "lib/idi/entry-id.hpp" #include "include/session-command-facade.h" #include "gui/notification-service.hpp" #include "gui/ctrl/command-handler.hpp" #include "gui/ctrl/bus-term.hpp" #include "gui/ctrl/nexus.hpp" -//#include "lib/util.hpp" -//#include "gui/model/tangible.hpp" -//#include "lib/diff/record.hpp" -#include "lib/idi/entry-id.hpp" #include -//#include namespace gui { namespace ctrl{ -// using lib::HashVal; -// using util::isnil; -// using lib::idi::EntryID; -// using lib::diff::Record; -// using std::string; - /** - * Attachment point to "central services" within the UI-Bus. + * Attachment point to »central services« within the UI-Bus. * This special implementation of the [BusTerm] interface receives and * handles those messages to be processed by centralised services: * - commands need to be sent down to Proc-Layer * - presentation state messages need to be recorded and acted upon. - * - * @todo write type comment */ class CoreService : public BusTerm diff --git a/src/gui/notification-service.hpp b/src/gui/notification-service.hpp index bb178b235..01cf2137f 100644 --- a/src/gui/notification-service.hpp +++ b/src/gui/notification-service.hpp @@ -73,15 +73,15 @@ namespace gui { /* === Interface Lifecycle === */ - typedef lumiera::InstanceHandle< LUMIERA_INTERFACE_INAME(lumieraorg_GuiNotification, 0) - , GuiNotification - > ServiceInstanceHandle; + using ServiceInstanceHandle = lumiera::InstanceHandle< LUMIERA_INTERFACE_INAME(lumieraorg_GuiNotification, 0) + , GuiNotification + > ; lib::SingletonRef implInstance_; ServiceInstanceHandle serviceInstance_; public: - NotificationService(); + NotificationService(); /////////////////////////////////////////////////////////TICKET #1047 : define GuiNotification }; diff --git a/src/gui/ui-bus.cpp b/src/gui/ui-bus.cpp index 5a8d61752..b4365034c 100644 --- a/src/gui/ui-bus.cpp +++ b/src/gui/ui-bus.cpp @@ -103,7 +103,8 @@ namespace ctrl { /* ==== standard implementation of the BusTerm interface ==== */ /** prepare or trigger invocation of a command. - * @param command a GenNode holding parameters invocation trigger + * @param command a GenNode either holding command parameters + * or an int to signal actual command invocation * @remarks some commands can simply be invoked right away, but * in the general case, command preparation and invocation * is a multi-step process. The gui::interact::InvocationTrail diff --git a/wiki/thinkPad.ichthyo.mm b/wiki/thinkPad.ichthyo.mm index a3b4349b6..83a7c2111 100644 --- a/wiki/thinkPad.ichthyo.mm +++ b/wiki/thinkPad.ichthyo.mm @@ -296,7 +296,7 @@ - + @@ -407,8 +407,9 @@ - - + + + @@ -492,7 +493,8 @@ - + + @@ -705,7 +707,7 @@ - + @@ -740,8 +742,8 @@ - - + + @@ -822,7 +824,7 @@ - + @@ -875,6 +877,20 @@ + + + + + + +

+ vertagt; Ticket #1058 +

+ + +
+ +
@@ -915,6 +931,9 @@
+ + +
@@ -8279,7 +8298,7 @@
- + @@ -8849,8 +8868,10 @@
- - + + + + @@ -8959,8 +8980,17 @@ - - + + + + + + + + + + + @@ -8974,6 +9004,18 @@ + + + + + + + + + + + + @@ -11479,13 +11521,13 @@ - + - + - + @@ -11508,15 +11550,15 @@ - - - + + + + - - +