From 44bb044eee36642d8ae210be36f6f51fae41c8e8 Mon Sep 17 00:00:00 2001 From: Ichthyostega Date: Sun, 14 Feb 2016 02:20:51 +0100 Subject: [PATCH] message broadcast implementation unit test PASS ...was indeed dead easy to implement --- src/gui/ctrl/bus-controller.cpp | 15 +++++++++++++++ src/gui/ctrl/bus-term.hpp | 2 ++ src/gui/ctrl/nexus.hpp | 11 +++++++++++ tests/gui/bus-term-test.cpp | 32 +++++++++++++++++++++++++------- tests/gui/test/test-nexus.cpp | 19 +++++++++++++++++++ 5 files changed, 72 insertions(+), 7 deletions(-) diff --git a/src/gui/ctrl/bus-controller.cpp b/src/gui/ctrl/bus-controller.cpp index 5610ac628..8adf0764f 100644 --- a/src/gui/ctrl/bus-controller.cpp +++ b/src/gui/ctrl/bus-controller.cpp @@ -156,6 +156,21 @@ namespace ctrl { } + /** broadcast a notification message to all currently connected bus terminals. + * @param mark the actual state update or notification message to be delivered + * @return number of notified terminals. + * @remarks this call assumes that "somewhere" within the UI-Bus + * a distribution node or hub is installed, with the ability + * to find all currently connected terminals. In the standard + * configuration this is implemented by the ctrl::Nexus + */ + size_t + BusTerm::markAll (GenNode const& mark) + { + return theBus_.markAll (mark); + } + + /** * @internal establish new down-link connection form UI-Bus * @param node reference to the [Tangible] to be connected. diff --git a/src/gui/ctrl/bus-term.hpp b/src/gui/ctrl/bus-term.hpp index c7d59b055..c696f5a7a 100644 --- a/src/gui/ctrl/bus-term.hpp +++ b/src/gui/ctrl/bus-term.hpp @@ -110,6 +110,8 @@ namespace ctrl{ virtual void note (ID subject, GenNode const& mark); virtual bool mark (ID subject, GenNode const& mark); + virtual size_t markAll (GenNode const& mark); + virtual operator string() const; void note (GenNode const& mark); diff --git a/src/gui/ctrl/nexus.hpp b/src/gui/ctrl/nexus.hpp index 42b880e65..0956a86f0 100644 --- a/src/gui/ctrl/nexus.hpp +++ b/src/gui/ctrl/nexus.hpp @@ -103,6 +103,17 @@ namespace ctrl{ } } + /** broadcast a notification to all connected terminal nodes. + * @note just uses the contents of the current routing table in arbitrary order. + */ + virtual size_t + markAll (GenNode const& mark) override + { + for (auto& entry : routingTable_) + this->mark (entry.first, mark); + return routingTable_.size(); + } + /** add a new down-link connection to the routing table * @param identity the [endpoint-ID](\ref BusTerm::endpointID_) used * to address the new element to be connected to the bus. diff --git a/tests/gui/bus-term-test.cpp b/tests/gui/bus-term-test.cpp index 6409cfe10..95f897158 100644 --- a/tests/gui/bus-term-test.cpp +++ b/tests/gui/bus-term-test.cpp @@ -308,10 +308,6 @@ namespace test { CHECK (mockA.isExpanded()); CHECK (not mockC.isExpanded()); CHECK (not mockC.isTouched()); - - cout << "____Nexus-Log_________________\n" - << util::join(gui::test::Nexus::getLog(), "\n") - << "\n───╼━━━━━━━━━╾────────────────"< ZombieNexus" <