OSSIA
Open Scenario System for Interactive Application
ossia/preset/cue.hpp
1 #pragma once
2 #include <ossia/detail/config.hpp>
3 
4 #include <ossia/detail/hash_map.hpp>
5 #include <ossia/network/common/parameter_properties.hpp>
6 #include <ossia/network/value/value.hpp>
7 #include <ossia/preset/preset.hpp>
8 
9 #include <nano_observer.hpp>
10 
11 #include <optional>
12 
13 namespace ossia
14 {
15 namespace net
16 {
17 class node_base;
18 class device_base;
19 }
20 struct cue
21 {
22  std::string name{};
23  ossia::presets::preset preset;
24 };
25 
26 struct selection_filters
27 {
28  std::vector<std::string> selection;
29  std::vector<ossia::val_type> type;
30  std::vector<ossia::access_mode> access;
31  std::vector<ossia::bounding_mode> bounding;
32  std::vector<std::string> tags;
33 
34  enum visibility_t
35  {
36  visible,
37  invisible
38  };
39  std::optional<visibility_t> visibility;
40 };
41 
42 class OSSIA_EXPORT cues : Nano::Observer
43 {
44 public:
45  std::vector<cue> m_cues{{.name{"Init"}}};
46 
47  void set_device(ossia::net::device_base* dev);
48 
49  int size() const noexcept { return this->m_cues.size(); }
50  cue& current_cue() noexcept { return this->m_cues[m_current]; }
51  cue* get_cue(int idx) noexcept
52  {
53  return (idx >= 0 && idx < std::ssize(this->m_cues)) ? &this->m_cues[idx] : nullptr;
54  }
55  std::optional<int> find_cue(std::string_view name);
56  int get_cue(std::string_view name);
57 
58  void create(std::string_view name);
59 
60  void update(std::string_view name);
61  void update(int idx); // update cue by index
62  void update(); // update current cue
63 
64  void recall(std::string_view name);
65  void recall(int idx);
66  void recall();
67 
68  void remove(std::string_view name);
69  void remove(int idx);
70  void remove();
71  void clear();
72 
73  void move(std::string_view name, int index);
74  void move(int from, int to);
75 
76  void output(std::string_view name);
77  void output(std::string_view name, std::string_view pattern);
78 
79  void namespace_select(std::string_view pat);
80  void namespace_deselect(std::string_view pat);
81  void namespace_filter_all(const selection_filters& pat);
82  void namespace_filter_any(const selection_filters& pat);
83  void namespace_grab(std::string_view pat);
84 
85  void on_node_created(const ossia::net::node_base& n);
86  void on_node_removed(const ossia::net::node_base& n);
87 
88  //private:
90  int m_current{0};
91 
92  ossia::hash_set<ossia::net::node_base*> m_selection;
93 };
94 }
Root of a device tree.
Definition: ossia/network/base/device.hpp:58
The node_base class.
Definition: network/base/node.hpp:48
Definition: git_info.h:7
std::vector< std::string > tags
Tags applied to a node: {"model", "interesting", ...}.
Definition: node_attributes.hpp:71