OSSIA
Open Scenario System for Interactive Application
execution_log.hpp
1 #pragma once
2 #include <ossia/detail/config.hpp>
3 
4 #if 0
5 #define OSSIA_EXECUTION_LOG 1
6 #include <ossia/dataflow/graph/graph_utils.hpp>
7 #include <ossia/dataflow/graph_node.hpp>
8 #include <ossia/dataflow/token_request.hpp>
9 #include <ossia/detail/json.hpp>
10 
11 #include <rapidjson/prettywriter.h>
12 
13 #include <functional>
14 
15 namespace ossia
16 {
17 struct on_destruct {
18  std::function<void()> dest;
19  template<typename F>
20  inline on_destruct(F t): dest{std::move(t)} { }
21  inline on_destruct(on_destruct&& t): dest{std::move(t.dest)} { t.dest = [] {}; }
22  inline on_destruct& operator=(on_destruct&& t) { dest = std::move(t.dest); t.dest = [] {}; return *this; }
23 
24  inline on_destruct() = delete;
25  inline on_destruct(const on_destruct& t) = delete;
26  inline on_destruct& operator=(const on_destruct& t) = delete;
27 
28  inline ~on_destruct() { dest(); }
29 };
30 struct OSSIA_EXPORT execution_log
31 {
32  rapidjson::StringBuffer buf;
33  rapidjson::PrettyWriter<rapidjson::StringBuffer> w{buf};
34 
35 
36  [[nodiscard]]
37  on_destruct init();
38 
39  [[nodiscard]]
40  on_destruct start_tick();
41 
42  [[nodiscard]]
43  on_destruct start_temporal();
44 
45  [[nodiscard]]
46  on_destruct interval_start_start_tick(const std::string& name);
47 
48  [[nodiscard]]
49  on_destruct interval_start_run_tick(const std::string& name, time_value old_date, time_value new_date, time_value offset);
50 
51  [[nodiscard]]
52  on_destruct process_state(const std::string& name);
53 
54  [[nodiscard]]
55  on_destruct start_dataflow();
56 
57  [[nodiscard]]
58  on_destruct log_executed_nodes(const ossia::graph_t&, const std::vector<graph_node*>& );
59 
60  [[nodiscard]]
61  on_destruct start_commit();
62 
63 
64  void commit();
65 };
66 
67 extern OSSIA_EXPORT execution_log g_exec_log;
68 }
69 
70 #endif
Definition: git_info.h:7