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)
5  2023, 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 
31 #ifndef SRC_VAULT_GEAR_ENGINE_OBSERVER_H_
32 #define SRC_VAULT_GEAR_ENGINE_OBSERVER_H_
33 
34 
35 #include "lib/error.hpp"
39 #include "lib/symbol.hpp"
40 #include "lib/nocopy.hpp"
41 //#include "lib/util.hpp"
42 
43 //#include <string>
44 #include <utility>
45 #include <array>
46 
47 
48 namespace vault{
49 namespace gear {
50 
51  using lib::Symbol;
52 // using util::isnil;
53 // using std::string;
54  using std::move;
55 
60  {
61  protected:
62  static size_t constexpr RAW_SIZ = 3;
63  using Storage = std::array<int64_t, RAW_SIZ>;
64 
65  template<class DAT>
66  union Payload
67  {
68  static_assert (sizeof(DAT) <= RAW_SIZ * sizeof(int64_t));
69 
70  Storage raw;
71  DAT data;
72 
73  Payload() : raw{0} { }
74  Payload (DAT const& d) : data{d} { }
75  Payload (DAT && dr) : data{move(dr)} { }
76 
77  // default copy and assignment acceptable
78 
79  DAT const& operator= (DAT const& d) { data = d; return data; }
80  DAT const& operator= (DAT && dr) { data = move(dr); return data; }
81 
82  operator Storage&() { return raw; }
83  operator Storage&&() { return move(raw); }
84  };
85 
87  EngineEvent (Symbol msgID, Storage&& payload)
88  : message{msgID}
89  , storage_{move (payload)}
90  { }
91 
92  public:
93  EngineEvent()
94  : message{Symbol::BOTTOM}
95  , storage_{0}
96  { }
97 
98  // default copy and assignment acceptable
99 
100  Symbol message;
101 
102  private:
103  Storage storage_;
104  };
105 
106 
107 
115  {
116 
117  public:
118  explicit
120  { }
121 
122  void
123  dispatchEvent (size_t /*address*/, EngineEvent /*event*/)
124  {
125  /* TICKET #1347 actually move this event into a dispatcher queue */
126  }
127  };
128 
129 
130 
131 }}// namespace vault::gear
132 #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:37
Layer-1 of the Scheduler: queueing and prioritisation of activities.
Token or Atom with distinct identity.
Definition: symbol.hpp:117
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.