Lumiera 0.pre.04
»edit your freedom«
Loading...
Searching...
No Matches
bus-term.hpp
Go to the documentation of this file.
1/*
2 BUS-TERM.hpp - connection point for UI elements to the UI-Bus
3
4 Copyright (C)
5 2015, Hermann Vosseler <Ichthyostega@web.de>
6
7  **Lumiera** is free software; you can redistribute it and/or modify it
8  under the terms of the GNU General Public License as published by the
9  Free Software Foundation; either version 2 of the License, or (at your
10  option) any later version. See the file COPYING for further details.
11
12*/
13
14
49#ifndef STAGE_CTRL_BUS_TERM_H
50#define STAGE_CTRL_BUS_TERM_H
51
52
53#include "lib/error.hpp"
54#include "lib/nocopy.hpp"
55#include "lib/idi/entry-id.hpp"
56#include "lib/diff/gen-node.hpp"
57
58#include <utility>
59#include <string>
60
61
62namespace lib {
63 namespace diff { class MutationMessage; }
64}
65namespace stage {
66namespace model {
67 class Tangible;
68}
69namespace ctrl{
70
74 using std::string;
75
76
96 class BusTerm
98 {
99 protected:
102
105
106 public:
107 using ID = EntryID const&;
108
109 virtual ~BusTerm();
110
111 virtual void act (GenNode const& command);
112 virtual void note (ID subject, GenNode const& mark);
113 virtual bool mark (ID subject, GenNode const& mark);
114
115 virtual size_t markAll (GenNode const& mark);
116 virtual bool change (ID subject, MutationMessage&& diff);
117
118 virtual operator string() const;
119
120 void note (GenNode const& mark);
121
122 ID getID() const { return endpointID_; }
123
124
125 BusTerm attach (ID, Tangible& newNode);
126
129 BusTerm(BusTerm&&) = default;
130
131 protected:
140 BusTerm(ID identity, BusTerm& attached_to)
141 : endpointID_(identity)
142 , theBus_(attached_to)
143 { }
144
145 virtual BusTerm& routeAdd(ID,Tangible&);
146 virtual void routeDetach(ID) noexcept;
147
148 bool isShortCircuit(ID) const noexcept;
149 };
150
151
152
153
155 inline void
156 BusTerm::note (GenNode const& mark)
157 {
158 theBus_.note (this->endpointID_, mark);
159 }
160
162 inline bool
163 BusTerm::isShortCircuit(ID otherID) const noexcept
164 {
165 return &theBus_ == this
166 or otherID == endpointID_;
167 }
168
169
170
171}} // namespace stage::ctrl
172#endif /*STAGE_CTRL_BUS_TERM_H*/
type erased baseclass for building a combined hash and symbolic ID.
Definition entry-id.hpp:134
connection point at the UI-Bus.
Definition bus-term.hpp:98
virtual bool mark(ID subject, GenNode const &mark)
route a state update or notification to the given subject.
Definition ui-bus.cpp:151
bool isShortCircuit(ID) const noexcept
Definition bus-term.hpp:163
BusTerm(ID identity, BusTerm &attached_to)
Definition bus-term.hpp:140
BusTerm(BusTerm &&)=default
may be moved, but not copied, due to the embedded identity
virtual void act(GenNode const &command)
prepare or trigger invocation of a command.
Definition ui-bus.cpp:113
stage::model::Tangible Tangible
Definition bus-term.hpp:101
BusTerm attach(ID, Tangible &newNode)
Builder function: establish and wire a new BusTerm.
Definition ui-bus.cpp:86
virtual BusTerm & routeAdd(ID, Tangible &)
Definition ui-bus.cpp:197
virtual void routeDetach(ID) noexcept
Definition ui-bus.cpp:208
virtual ~BusTerm()
this is an interface
Definition ui-bus.cpp:66
virtual void note(ID subject, GenNode const &mark)
capture and record a "state mark" for later replay for restoring UI state.
Definition ui-bus.cpp:132
virtual bool change(ID subject, MutationMessage &&diff)
alter and reshape the designated subject by applying the given diff message.
Definition ui-bus.cpp:185
virtual size_t markAll(GenNode const &mark)
broadcast a notification message to all currently connected bus terminals.
Definition ui-bus.cpp:166
EntryID const & ID
Definition bus-term.hpp:107
Interface common to all UI elements of relevance for the Lumiera application.
Definition tangible.hpp:160
Types marked with this mix-in may be moved but not copied.
Definition nocopy.hpp:50
Bare symbolic and hash ID used for accounting of asset like entries.
Lumiera error handling (C++ interface).
Generic building block for tree shaped (meta)data structures.
Implementation namespace for support and library code.
Lumiera GTK UI implementation root.
Definition guifacade.cpp:37
lib::idi::BareEntryID const & ID
Mix-Ins to allow or prohibit various degrees of copying and cloning.
generic data element node within a tree
Definition gen-node.hpp:224
Opaque message to effect a structural change on a target, which is likewise only known in an abstract...
typed symbolic and hash ID for asset-like position accounting.
Definition entry-id.hpp:219