6#include <ossia/editor/expression/expression_generic.hpp>
47namespace ossia::expressions
54OSSIA_EXPORT
bool evaluate(
const expression_base& e);
55inline bool evaluate(
const expression_ptr& e)
67OSSIA_EXPORT
void update(
const expression_base& e);
68inline void update(
const expression_ptr& e)
77OSSIA_EXPORT
void reset(expression_base& e);
78inline void reset(
const expression_ptr& e)
89OSSIA_EXPORT
bool operator==(
const expression_base& lhs,
const expression_base& rhs);
90OSSIA_EXPORT
bool operator!=(
const expression_base& lhs,
const expression_base& rhs);
95OSSIA_EXPORT expression_callback_iterator
96add_callback(expression_base&, expression_result_callback);
101OSSIA_EXPORT
void remove_callback(expression_base&, expression_callback_iterator);
107OSSIA_EXPORT std::size_t callback_count(expression_base&);
113OSSIA_EXPORT
const expression_base& expression_true();
118OSSIA_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);
156template <
typename... Args>
157expression_ptr make_expression_atom(Args&&... args)
159 return std::make_unique<expression_base>(
160 ossia::in_place_type<expression_atom>, std::forward<Args>(args)...);
163expression_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);
168expression_ptr make_expression_atom(
169 ossia::expressions::expression_atom::val_t&& lhs, ossia::expressions::comparator c,
170 ossia::expressions::expression_atom::val_t&& rhs);
177template <
typename... Args>
180 return std::make_unique<expression_base>(
181 ossia::in_place_type<expression_bool>, std::forward<Args>(args)...);
189template <
typename... Args>
192 return std::make_unique<expression_base>(
193 ossia::in_place_type<expression_composition>, std::forward<Args>(args)...);
201template <
typename... Args>
204 return std::make_unique<expression_base>(
205 ossia::in_place_type<expression_not>, std::forward<Args>(args)...);
213template <
typename... Args>
216 return std::make_unique<expression_base>(
217 ossia::in_place_type<expression_pulse>, std::forward<Args>(args)...);
220template <
typename T,
typename... Args>
221expression_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