OSSIA
Open Scenario System for Interactive Application
graph_interface.hpp
1 #pragma once
2 #include <ossia/dataflow/dataflow_fwd.hpp>
3 #include <ossia/dataflow/graph_edge.hpp>
4 #include <ossia/dataflow/transport.hpp>
5 #include <ossia/detail/audio_spin_mutex.hpp>
6 #include <ossia/detail/logger_fwd.hpp>
7 
8 #include <tcb/span.hpp>
9 
10 #include <smallfun.hpp>
11 
12 namespace spdlog
13 {
14 class logger;
15 }
16 namespace ossia
17 {
18 struct edge_pool;
19 struct bench_map;
20 struct connection;
21 class time_interval;
22 class OSSIA_EXPORT graph_interface
23 {
24 public:
25  graph_interface();
26  virtual ~graph_interface();
27  [[deprecated]] virtual void add_node(ossia::node_ptr) = 0;
28 
29  [[deprecated]] virtual void remove_node(const ossia::node_ptr&) = 0;
30 
31  [[deprecated]] virtual void connect(ossia::edge_ptr) = 0;
32 
33  [[deprecated]] virtual void disconnect(const ossia::edge_ptr&) = 0;
34 
35  [[deprecated]] virtual void disconnect(ossia::graph_edge*) = 0;
36 
37  [[deprecated]] virtual void mark_dirty() = 0;
38 
39  virtual void state(execution_state& e) = 0;
40 
41  virtual void clear() = 0;
42 
43  virtual void print(std::ostream&) = 0;
44 
45  [[nodiscard]] virtual tcb::span<ossia::graph_node* const> get_nodes() const noexcept
46  = 0;
47 
48  std::shared_ptr<edge_pool> pool;
49 
50  ossia::edge_ptr allocate_edge(
51  connection c, outlet_ptr pout, inlet_ptr pin, node_ptr pout_node,
52  node_ptr pin_node);
53 };
54 
55 struct graph_setup_options
56 {
57  enum
58  {
59  StaticFixed,
60  StaticBFS,
61  StaticTC,
62  Dynamic
63  } scheduling{};
64  enum
65  {
66  Creation,
67  XY,
68  YX,
69  Temporal
70  } order{};
71  enum
72  {
73  Merge,
74  Append,
75  Replace
76  } merge{};
77 
78  bool parallel{};
79  int parallel_threads = 8;
80  std::shared_ptr<ossia::logger_type> log{};
81  std::shared_ptr<bench_map> bench{};
82 };
83 
84 struct tick_setup_options
85 {
86  enum
87  {
88  Default,
89  Ordered,
90  Priorized,
91  Merged,
92  MergedThreaded,
93  DirectThreaded
94  } commit{};
95  enum
96  {
97  Buffer,
98  ScoreAccurate,
99  Precise
100  } tick{};
101 };
102 
103 OSSIA_EXPORT
104 std::shared_ptr<ossia::graph_interface> make_graph(const graph_setup_options&);
105 
106 }
Definition: git_info.h:7
spdlog::logger & logger() noexcept
Where the errors will be logged. Default is stderr.
Definition: context.cpp:104
ossia::value_with_unit merge(const value_with_unit &vu, const ossia::value &val, ossia::destination_index idx)
merge Merge a computed value in a unit-aware value
Definition: dataspace_visitors.cpp:311
std::ostream & print(std::ostream &out, const state_element &e)
print Print a state_element
Definition: state_element.cpp:23