6 #include <ossia/editor/expression/expression_generic.hpp>
47 namespace ossia::expressions
54 OSSIA_EXPORT
bool evaluate(
const expression_base& e);
55 inline bool evaluate(
const expression_ptr& e)
67 OSSIA_EXPORT
void update(
const expression_base& e);
68 inline void update(
const expression_ptr& e)
77 OSSIA_EXPORT
void reset(expression_base& e);
78 inline void reset(
const expression_ptr& e)
89 OSSIA_EXPORT
bool operator==(
const expression_base& lhs,
const expression_base& rhs);
90 OSSIA_EXPORT
bool operator!=(
const expression_base& lhs,
const expression_base& rhs);
95 OSSIA_EXPORT expression_callback_iterator
96 add_callback(expression_base&, expression_result_callback);
101 OSSIA_EXPORT
void remove_callback(expression_base&, expression_callback_iterator);
107 OSSIA_EXPORT std::size_t callback_count(expression_base&);
113 OSSIA_EXPORT
const expression_base& expression_true();
118 OSSIA_EXPORT
const expression_base& expression_false();
132 return std::make_unique<expression_base>(ossia::in_place_type<expression_bool>,
true);
137 const auto p = e.target<expression_bool>();
138 return p && p->evaluate();
148 return std::make_unique<expression_base>(ossia::in_place_type<expression_bool>,
false);
156 template <
typename... Args>
157 expression_ptr make_expression_atom(Args&&... args)
159 return std::make_unique<expression_base>(
160 ossia::in_place_type<expression_atom>, std::forward<Args>(args)...);
163 expression_ptr make_expression_atom(
164 const ossia::expressions::expression_atom::val_t& lhs,
165 ossia::expressions::comparator c,
166 const ossia::expressions::expression_atom::val_t& rhs);
168 expression_ptr make_expression_atom(
169 ossia::expressions::expression_atom::val_t&& lhs, ossia::expressions::comparator c,
170 ossia::expressions::expression_atom::val_t&& rhs);
177 template <
typename... Args>
180 return std::make_unique<expression_base>(
181 ossia::in_place_type<expression_bool>, std::forward<Args>(args)...);
189 template <
typename... Args>
192 return std::make_unique<expression_base>(
193 ossia::in_place_type<expression_composition>, std::forward<Args>(args)...);
201 template <
typename... Args>
204 return std::make_unique<expression_base>(
205 ossia::in_place_type<expression_not>, std::forward<Args>(args)...);
213 template <
typename... Args>
216 return std::make_unique<expression_base>(
217 ossia::in_place_type<expression_pulse>, std::forward<Args>(args)...);
220 template <
typename T,
typename... Args>
221 expression_ptr make_expression_generic(Args&&... args)
224 std::is_base_of<expression_generic_base, T>::value,
225 "Must inherit from expression_generic_base");
227 return std::make_unique<expression_base>(
228 ossia::in_place_type<expression_generic>,
229 std::make_unique<T>(std::forward<Args>(args)...));
expression_ptr make_expression_composition(Args &&... args)
make_expression_composition
Definition: expression.hpp:190
expression_ptr make_expression_bool(Args &&... args)
make_expression_bool
Definition: expression.hpp:178
expression_ptr make_expression_pulse(Args &&... args)
make_expression_pulse
Definition: expression.hpp:214
expression_ptr make_expression_not(Args &&... args)
make_expression_not
Definition: expression.hpp:202
expression_ptr make_expression_false()
make_expression_false
Definition: expression.hpp:146
expression_ptr make_expression_true()
make_expression_true
Definition: expression.hpp:130
expressions::expression_base expression
Definition: expression_fwd.hpp:222