OSSIA
Open Scenario System for Interactive Application
expression_composition.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #include <ossia/detail/config.hpp>
4 
6 #include <ossia/editor/expression/operators.hpp>
7 
8 #include <memory>
9 
13 namespace ossia::expressions
14 {
19 class OSSIA_EXPORT expression_composition final : public expression_callback_container
20 {
21 public:
22  expression_composition(expression_ptr expr1, binary_operator op, expression_ptr expr2);
24  expression_composition& operator=(expression_composition&& other) = delete;
25 
26  expression_composition(const expression_composition& other) = delete;
27  expression_composition& operator=(const expression_composition& other) = delete;
28 
29  virtual ~expression_composition();
30 
31  bool evaluate() const;
32 
33  void update() const;
34  void reset();
35 
36  expression_base& get_first_operand() const;
37  binary_operator get_operator() const;
38  expression_base& get_second_operand() const;
39 
40 private:
41  void on_first_callback_added() override;
42  void on_removing_last_callback() override;
43 
44  bool do_evaluation(bool first, bool second) const;
45 
46  void first_callback(bool first_result);
47  void second_callback(bool second_result);
48 
49  expression_ptr m_first;
50  expression_ptr m_second;
51 
52  expression_callback_iterator m_firstIndex;
53  expression_callback_iterator m_secondIndex;
54 
55  binary_operator m_operator{};
56 };
57 }
expression_composition : logical composition (and, or, xor)
Definition: expression_composition.hpp:20