Lumiera  0.pre.03
»edit your freedom«
engine-observer.hpp
Go to the documentation of this file.
1 /*
2  ENGINE-OBSERVER.hpp - collection and maintenance of engine performance indicators
3 
4  Copyright (C) Lumiera.org
5  2023, Hermann Vosseler <Ichthyostega@web.de>
6 
7  This program is free software; you can redistribute it and/or
8  modify it under the terms of the GNU General Public License as
9  published by the Free Software Foundation; either version 2 of
10  the License, or (at your option) any later version.
11 
12  This program is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  GNU General Public License for more details.
16 
17  You should have received a copy of the GNU General Public License
18  along with this program; if not, write to the Free Software
19  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 
21 */
22 
23 
40 #ifndef SRC_VAULT_GEAR_ENGINE_OBSERVER_H_
41 #define SRC_VAULT_GEAR_ENGINE_OBSERVER_H_
42 
43 
44 #include "lib/error.hpp"
48 #include "lib/symbol.hpp"
49 #include "lib/nocopy.hpp"
50 //#include "lib/util.hpp"
51 
52 //#include <string>
53 #include <utility>
54 #include <array>
55 
56 
57 namespace vault{
58 namespace gear {
59 
60  using lib::Symbol;
61 // using util::isnil;
62 // using std::string;
63  using std::move;
64 
69  {
70  protected:
71  static size_t constexpr RAW_SIZ = 3;
72  using Storage = std::array<int64_t, RAW_SIZ>;
73 
74  template<class DAT>
75  union Payload
76  {
77  static_assert (sizeof(DAT) <= RAW_SIZ * sizeof(int64_t));
78 
79  Storage raw;
80  DAT data;
81 
82  Payload() : raw{0} { }
83  Payload (DAT const& d) : data{d} { }
84  Payload (DAT && dr) : data{move(dr)} { }
85 
86  // default copy and assignment acceptable
87 
88  DAT const& operator= (DAT const& d) { data = d; return data; }
89  DAT const& operator= (DAT && dr) { data = move(dr); return data; }
90 
91  operator Storage&() { return raw; }
92  operator Storage&&() { return move(raw); }
93  };
94 
96  EngineEvent (Symbol msgID, Storage&& payload)
97  : message{msgID}
98  , storage_{move (payload)}
99  { }
100 
101  public:
102  EngineEvent()
103  : message{Symbol::BOTTOM}
104  , storage_{0}
105  { }
106 
107  // default copy and assignment acceptable
108 
109  Symbol message;
110 
111  private:
112  Storage storage_;
113  };
114 
115 
116 
124  {
125 
126  public:
127  explicit
129  { }
130 
131  void
132  dispatchEvent (size_t /*address*/, EngineEvent /*event*/)
133  {
134  /* TICKET #1347 actually move this event into a dispatcher queue */
135  }
136  };
137 
138 
139 
140 }}// namespace vault::gear
141 #endif /*SRC_VAULT_GEAR_ENGINE_OBSERVER_H_*/
Low-level Render Engine event — abstracted storage base.
Memory management scheme for activities and parameter data passed through the Scheduler within the Lu...
Any copy and copy construction prohibited.
Definition: nocopy.hpp:46
Layer-1 of the Scheduler: queueing and prioritisation of activities.
Token or Atom with distinct identity.
Definition: symbol.hpp:126
Mix-Ins to allow or prohibit various degrees of copying and cloning.
Marker types to indicate a literal string and a Symbol.
Layer-2 of the Scheduler: coordination and interaction of activities.
Lumiera error handling (C++ interface).
EngineEvent(Symbol msgID, Storage &&payload)
base init for derived classes to implant custom payload
Vault-Layer implementation namespace root.
Collector and aggregator for performance data.