Lumiera  0.pre.03
»edit your freedom«
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 
62 namespace lib {
63  namespace diff { class MutationMessage; }
64 }
65 namespace stage {
66 namespace model {
67  class Tangible;
68 }
69 namespace ctrl{
70 
71  using lib::idi::EntryID;
72  using lib::diff::GenNode;
74  using std::string;
75 
76 
96  class BusTerm
98  {
99  protected:
102 
103  EntryID endpointID_;
104  BusTerm& theBus_;
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:133
connection point at the UI-Bus.
Definition: bus-term.hpp:96
Types marked with this mix-in may be moved but not copied.
Definition: nocopy.hpp:49
typed symbolic and hash ID for asset-like position accounting.
Definition: entry-id.hpp:126
Opaque message to effect a structural change on a target, which is likewise only known in an abstract...
Implementation namespace for support and library code.
Mix-Ins to allow or prohibit various degrees of copying and cloning.
Lumiera GTK UI implementation root.
Definition: guifacade.cpp:37
Generic building block for tree shaped (meta)data structures.
BusTerm(ID identity, BusTerm &attached_to)
Definition: bus-term.hpp:140
Lumiera error handling (C++ interface).
Bare symbolic and hash ID used for accounting of asset like entries.
Interface common to all UI elements of relevance for the Lumiera application.
Definition: tangible.hpp:156
generic data element node within a tree
Definition: gen-node.hpp:222