From 9af20b7cf6a1953a8b6bc66a0602849cd21fde79 Mon Sep 17 00:00:00 2001 From: Ichthyostega Date: Sat, 28 Nov 2015 20:55:28 +0100 Subject: [PATCH] WIP: BusTerm needs to be a concrete class ...providing the standard implementation of UI-Bus connectivity. It seems reasonable to place all of the UI-Bus implementation into a single translation unit --- src/gui/ctrl/bus-controller.cpp | 72 ++++++++++++++++++++++------ src/gui/ctrl/bus-term.hpp | 25 ++++++---- tests/gui/abstract-tangible-test.cpp | 1 + tests/gui/test/nexus.cpp | 2 +- 4 files changed, 75 insertions(+), 25 deletions(-) diff --git a/src/gui/ctrl/bus-controller.cpp b/src/gui/ctrl/bus-controller.cpp index fb8d93b02..3ae85846f 100644 --- a/src/gui/ctrl/bus-controller.cpp +++ b/src/gui/ctrl/bus-controller.cpp @@ -22,11 +22,15 @@ /** @file bus-controller.cpp - ** Service for bus-controller. - ** This header defines the basics of... + ** Implementation of the UI backbone service for messaging. + ** Any globally relevant widget or controller within the Lumiera UI + ** is connected to the [UI-Bus][ui-bus.hpp], which is largely implemented + ** within this compilation unit. [Clients][gui::model::Tangible] typically + ** use the [BusTerm-Interface][bus-term.hpp] to route generic actions and + ** receive notifications, state changes and mutations. ** - ** @note as of X/2015 this is complete bs - ** @todo WIP ///////////////////////TICKET # + ** @note as of 11/2015 this is complete WIP_WIP + ** @todo WIP ///////////////////////TICKET #975 ** ** @see ////TODO_test usage example ** @see bus-controller.cpp implementation @@ -37,6 +41,7 @@ #include "lib/util.hpp" //#include "lib/symbol.hpp" //#include "include/logging.h" +#include "gui/ctrl/bus-term.hpp" #include "gui/ctrl/bus-controller.hpp" //#include @@ -51,7 +56,7 @@ using util::isnil; namespace gui { -namespace controller { +namespace ctrl { namespace { // internal details @@ -59,21 +64,60 @@ namespace controller { - //NA::~NA() { } + BusTerm::~BusTerm() { } // emit VTables here... - /** - * - * @param id - * @return - */ - string - fun (string& id) + /** Builder function: establish and wire + * a new BusTerm as connected to this one */ + BusTerm&& + BusTerm::attach (ID newAddress) { - return "x"+id; + return std::move( BusTerm(newAddress, *this)); } + + /* ==== standard implementation of the BusTerm interface ==== */ + + void + BusTerm::act (GenNode command) + { + UNIMPLEMENTED("issue command"); + } + + + /** */ + void + BusTerm::note (GenNode mark) + { + UNIMPLEMENTED("send notification downstream"); + } + + + /** */ + void + BusTerm::note (ID subject, GenNode mark) + { + UNIMPLEMENTED("send notification to subject"); + } + + + /** */ + void + BusTerm::mark (GenNode mark) + { + UNIMPLEMENTED("record state mark"); + } + + + /** */ + void + BusTerm::mark (ID subject, GenNode mark) + { + UNIMPLEMENTED("forward state mark from subject"); + } + + }} // namespace gui::ctrl diff --git a/src/gui/ctrl/bus-term.hpp b/src/gui/ctrl/bus-term.hpp index 780f47384..4b3c0c856 100644 --- a/src/gui/ctrl/bus-term.hpp +++ b/src/gui/ctrl/bus-term.hpp @@ -57,6 +57,7 @@ #include "lib/diff/gen-node.hpp" #include +#include #include @@ -90,26 +91,30 @@ namespace ctrl{ * some element. */ class BusTerm - : boost::noncopyable { - EntryID endpointID_; + using ID = lib::idi::BareEntryID; + + ID endpointID_; BusTerm& theBus_; public: virtual ~BusTerm(); ///< this is an interface - virtual void act (GenNode command) =0; - virtual void note (GenNode mark) =0; - virtual void mark (GenNode mark) =0; + virtual void act (GenNode command); + virtual void note (GenNode mark); + virtual void mark (GenNode mark); - virtual void act (EntryID subject, GenNode command) =0; - virtual void note (EntryID subject, GenNode mark) =0; - virtual void mark (EntryID subject, GenNode mark) =0; + virtual void note (ID subject, GenNode mark); + virtual void mark (ID subject, GenNode mark); - BusTerm&& attach (EntryID newAddress); + BusTerm&& attach (ID newAddress); + + /** may be moved, but not copied, + * due to the embedded identity */ + BusTerm(BusTerm&&) = default; protected: - BusTerm(EntryID identity, BusTerm& attached_to =*this) + BusTerm(ID identity, BusTerm& attached_to) : endpointID_(identity) , theBus_(attached_to) { } diff --git a/tests/gui/abstract-tangible-test.cpp b/tests/gui/abstract-tangible-test.cpp index 05a49ed9a..25301f911 100644 --- a/tests/gui/abstract-tangible-test.cpp +++ b/tests/gui/abstract-tangible-test.cpp @@ -47,6 +47,7 @@ #include "lib/test/run.hpp" #include "lib/test/test-helper.hpp" +#include "lib/error.hpp" //#include "gui/model/session-facade.hpp" //#include "gui/model/diagnostics.hpp" //#include "lib/util.hpp" diff --git a/tests/gui/test/nexus.cpp b/tests/gui/test/nexus.cpp index 35946e9cb..54c8d9cde 100644 --- a/tests/gui/test/nexus.cpp +++ b/tests/gui/test/nexus.cpp @@ -35,7 +35,7 @@ //#include "lib/util.hpp" //#include "lib/symbol.hpp" //#include "include/logging.h" -#include "gui/test/nexus.hpp" +#include "test/nexus.hpp" //#include //#include