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
This commit is contained in:
Fischlurch 2015-11-28 20:55:28 +01:00
parent 809ed36b56
commit 9af20b7cf6
4 changed files with 75 additions and 25 deletions

View file

@ -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 <boost/noncopyable.hpp>
@ -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

View file

@ -57,6 +57,7 @@
#include "lib/diff/gen-node.hpp"
#include <boost/noncopyable.hpp>
#include <utility>
#include <string>
@ -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)
{ }

View file

@ -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"

View file

@ -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 <boost/noncopyable.hpp>
//#include <string>