Lumiera  0.pre.03
»edit your freedom«
activity-lang.cpp
Go to the documentation of this file.
1 /*
2  ActivityLang - definition language framework for scheduler activities
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 
25 #include "lib/format-obj.hpp"
26 #include "lib/symbol.hpp"
27 #include "vault/gear/scheduler.hpp"
28 
29 #include <string>
30 #include <boost/functional/hash.hpp>
31 
32 using std::string;
33 using lib::Symbol;
34 using lib::time::Time;
36 
37 
38 namespace vault{
39 namespace gear {
40  namespace activity {
41  Hook::~Hook() { } // emit VTable here...
42  }
44  HashVal
45  hash_value (ManifestationID const& id)
46  {
47  return boost::hash_value (uint32_t{id});
48  }
49 
50  Symbol WorkTiming::WORKSTART{"WorkStart"};
51  Symbol WorkTiming::WORKSTOP {"WorkStop"};
52 
54 
55 
56  Activity::operator string() const
57  {
58  return string{"Act("}
59  + showVerb()
60  + util::showAdr(this)
61  + ": "
62  + showData()
63  + "; ⤵ "
64  + (next? next->showVerb()+util::showAdr(*next)
65  : util::BOTTOM_INDICATOR)
66  + ")";
67  }
68 
69  string
70  Activity::showVerb() const
71  {
72  switch (verb_) {
73  case INVOKE: return "INVOKE";
74  case WORKSTART: return "WORKSTART";
75  case WORKSTOP: return "WORKSTOP";
76  case NOTIFY: return "NOTIFY";
77  case GATE: return "GATE";
78  case POST: return "POST";
79  case FEED: return "FEED";
80  case HOOK: return "HOOK";
81  case TICK: return "TICK";
82  default: NOTREACHED ("uncovered Activity verb diagnostics.");
83  }
84  }
85 
86  string
87  Activity::showData() const
88  {
89  switch (verb_) {
90  case INVOKE:
91  return util::showPtr (data_.invocation.task)
92  + ", "
93  + util::toString(TimeValue{data_.invocation.time});
94  case WORKSTART:
95  case WORKSTOP:
96  return util::toString(TimeValue{data_.timing.instant})
97  + ", quality="
98  + util::toString(data_.timing.quality);
99  case NOTIFY:
100  return util::showAdr(data_.notification.target)
101  + ", timing:"
102  + util::toString(Time{data_.notification.timing});
103  case GATE:
104  return "<"
105  + util::toString(data_.condition.rest)
106  + ", until "
107  + util::toString(Time{data_.condition.dead});
108  case POST:
109  return "["
110  + util::toString(Time{data_.timeWindow.life})
111  + "…"
112  + util::toString(Time{data_.timeWindow.dead})
113  + "]";
114  case FEED:
115  return "{"
116  + util::toString(data_.feed.one)
117  + "::"
118  + util::toString(data_.feed.two)
119  + "}";
120  case HOOK:
121  return util::showPtr (data_.callback.hook)
122  + "("
123  + util::toString(data_.callback.arg)
124  + ")";
125  case TICK:
126  return "◆ ";
127  default:
128  NOTREACHED ("uncovered Activity verb in activation function.");
129  }
130  }
131 
132 
133 }} // namespace vault::gear
Lumiera&#39;s internal time value datatype.
Definition: timevalue.hpp:299
Token or Atom with distinct identity.
Definition: symbol.hpp:117
Service for coordination and dispatch of render activities.
Marker for current (and obsolete) manifestations of a CalcStream processed by the Render-Engine...
Definition: activity.hpp:84
Marker types to indicate a literal string and a Symbol.
A language framework to define and interconnect scheduler activity verbs.
virtual ~Hook()
this is an interface
Simple functions to represent objects, for debugging and diagnostics.
size_t HashVal
a STL compatible hash value
Definition: hash-value.h:52
basic constant internal time value.
Definition: timevalue.hpp:133
Vault-Layer implementation namespace root.