OSSIA
Open Scenario System for Interactive Application
matcher.hpp
1 #pragma once
2 
3 #include <ossia/network/base/node.hpp>
4 #include <ossia/network/base/value_callback.hpp>
5 #include <ossia/network/value/value.hpp>
6 
7 #include <ext.h>
8 
9 namespace ossia
10 {
11 namespace max_binding
12 {
13 
14 struct object_base;
15 
16 class matcher
17 {
18 public:
19  matcher(ossia::net::node_base* n, object_base* p); // constructor
20  ~matcher();
21  matcher(const matcher&) = delete;
22  matcher(matcher&& other) = delete;
23  matcher& operator=(const matcher&) = delete;
24  matcher& operator=(matcher&& other) = delete;
25 
26  void output_value(ossia::value v);
27  void remove_callback();
28 
29  ossia::net::node_base* get_node() const { return node; }
30  object_base* get_owner() const
31  {
32  return owner;
33  } // return the max object that holds this
34  const t_atom* get_atom_addr_ptr() const { return &m_addr; }
35  void set_addr_symbol();
36 
37  inline bool operator==(const matcher& rhs) { return (get_node() == rhs.node); }
38 
39  void set_dead() { m_dead = true; }
40  void set_zombie() { m_zombie = true; }
41  bool is_zombie() const { return m_zombie; }
42  bool is_locked() const { return m_lock; }
43  bool is_dead() const { return m_dead; }
44 
45  // holds the position of the matcher in the max object internal list
46  // this is used to output the 'instance' number of a ossia.remote with pattern matching
47  int m_index{0};
48 
49  //private:
50  // TODO rename those as m_node/m_owner/m_callbackit
51  ossia::net::node_base* node{};
52  ossia::net::parameter_base* orig_param{};
53  object_base* owner{};
54 
55  std::optional<ossia::callback_container<ossia::value_callback>::iterator> callbackit
56  = std::nullopt;
57 
58  bool m_dead{}; // true when Max object is being deleted
59  bool m_zombie{}; // true if node is deleted, t_matcher should be deleted asap
60  bool m_lock{};
61  t_atom m_addr{};
62 };
63 
64 } // namespace max
65 } // namespace ossia
The node_base class.
Definition: network/base/node.hpp:48
The parameter_base class.
Definition: ossia/network/base/parameter.hpp:48
The value class.
Definition: value.hpp:173
Definition: git_info.h:7