OSSIA
Open Scenario System for Interactive Application
expression_atom.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #include <ossia/detail/config.hpp>
4 
5 #include <ossia/detail/nullable_variant.hpp>
7 #include <ossia/editor/expression/operators.hpp>
8 #include <ossia/network/base/parameter.hpp>
9 #include <ossia/network/value/value.hpp>
10 
11 #include <memory>
12 
16 namespace ossia::expressions
17 {
22 class OSSIA_EXPORT expression_atom final : public expression_callback_container
23 {
24 public:
25  using val_t = ossia::nullable_variant<ossia::value, ossia::destination>;
27  const value& lhs, comparator op = comparator::EQUAL, const value& rhs = impulse{});
29  const destination& lhs, comparator op = comparator::EQUAL,
30  const value& rhs = impulse{});
31  expression_atom(const destination& lhs, comparator op, const destination& rhs);
32  expression_atom(const value& lhs, comparator op, const destination& rhs);
33 
34  struct dummy_t
35  {
36  };
37  expression_atom(const val_t& lhs, comparator op, const val_t& rhs, dummy_t);
38 
39  expression_atom(expression_atom&& other) = delete;
40  expression_atom& operator=(expression_atom&& other) = delete;
41 
42  expression_atom(const expression_atom& other) = delete;
43  expression_atom& operator=(const expression_atom& other) = delete;
44 
45  virtual ~expression_atom();
46 
47  bool evaluate() const;
48  void update() const;
49  void reset();
50 
51  const val_t& get_first_operand() const;
52  comparator get_operator() const;
53  const val_t& get_second_operand() const;
54 
55  bool operator()(const ossia::value& first, const ossia::value& second) const;
56  bool operator()(const ossia::value& first, const ossia::destination& second) const;
57  bool operator()(const ossia::destination& first, const ossia::value& second) const;
58  bool
59  operator()(const ossia::destination& first, const ossia::destination& second) const;
60 
61  constexpr inline bool
62  operator()(const ossia::value& v, const ossia::monostate& m) const noexcept
63  {
64  return false;
65  }
66  constexpr inline bool
67  operator()(const ossia::destination& v, const ossia::monostate& m) const noexcept
68  {
69  return false;
70  }
71  constexpr inline bool
72  operator()(const ossia::monostate& v, const ossia::value& m) const noexcept
73  {
74  return false;
75  }
76  constexpr inline bool
77  operator()(const ossia::monostate& v, const ossia::destination& m) const noexcept
78  {
79  return false;
80  }
81  constexpr inline bool
82  operator()(const ossia::monostate& v, const ossia::monostate& m) const noexcept
83  {
84  return false;
85  }
86 
87 private:
88  bool operator()(const ossia::value& first, const val_t& second) const;
89  bool operator()(const val_t& first, const ossia::value& second) const;
90  void on_first_callback_added() override;
91  void on_removing_last_callback() override;
92  void first_value_callback(const ossia::value& value);
93  void second_value_callback(const ossia::value& value);
94 
95  val_t m_first;
96  val_t m_second;
97 
98  net::parameter_base::callback_index m_firstCallback;
99  net::parameter_base::callback_index m_secondCallback;
100 
101  comparator m_operator{};
102 };
103 }
expression_atom : numeric operators in expressions.
Definition: expression_atom.hpp:23
The value class.
Definition: value.hpp:173