34 using std::runtime_error::runtime_error;
66 *
const_cast<bool *
>(
dirtyVar) =
true;
71 (*parentVar)->markDirty();
86template<
typename ResultType>
99template<
typename ResultType>
110 return m_interface->evaluate();
120 return m_interface->isDirty();
124 std::unique_ptr<NodeInterface<ResultType>> m_interface;
151template<
typename PropertyType>
158 setProperty(property);
167 setProperty(*
other.m_property);
184 return m_property->
get();
190 if (&property != m_property) {
191 m_property = &property;
195 m_property =
nullptr;
201 m_property =
nullptr;
211 m_property = &property;
223 mutable bool m_dirty;
232 template<
typename Op>
234 : m_parent{
nullptr }, m_dirty{
true }, m_op{
std::move(
op) }, m_values{
std::move(arguments)... }, m_result(reevaluate())
237 std::is_convertible_v<decltype(m_op(std::declval<Ts>()...)),
ResultType>,
238 "The result of the Operator must be convertible to the ReturnType of the Node");
243 template<std::
size_t I>
251 template<std::
size_t I>
255 std::get<I>(m_values).setParent(
this);
264 m_result = reevaluate();
275 template<std::size_t...
Is>
276 ResultType reevaluate_helper(std::index_sequence<Is...>)
const
278 return m_op(std::get<Is>(m_values).
evaluate()...);
285 return reevaluate_helper(std::make_index_sequence<
sizeof...(
Ts)>());
289 mutable bool m_dirty;
292 std::tuple<Node<Ts>...> m_values;
A ConnectionHandle represents the connection of a Signal to a slot (i.e. a function that is called wh...
const T & evaluate() const override
ConstantNode(const T &value)
Dirtyable ** parentVariable() override
const bool * dirtyVariable() const override
void setParent(Dirtyable *newParent)
virtual const bool * dirtyVariable() const =0
virtual ~Dirtyable()=default
virtual Dirtyable ** parentVariable()=0
virtual const ResultType & evaluate() const =0
Node(std::unique_ptr< NodeInterface< ResultType > > &&nodeInterface)
void setParent(Dirtyable *newParent)
const ResultType & evaluate() const
auto setParents() -> std::enable_if_t< I< sizeof...(Ts)>
virtual ~OperatorNode()=default
const bool * dirtyVariable() const override
const ResultType & evaluate() const override
Dirtyable ** parentVariable() override
auto setParents() -> std::enable_if_t< I==sizeof...(Ts)>
OperatorNode(Op &&op, Node< Ts > &&...arguments)
const PropertyType & evaluate() const override
PropertyNode(PropertyNode< PropertyType > &&)=delete
const bool * dirtyVariable() const override
PropertyNode(const PropertyNode< PropertyType > &other)
Dirtyable ** parentVariable() override
PropertyNode(Property< PropertyType > &property)
void propertyMoved(Property< PropertyType > &property)
A PropertyDestroyedError is thrown whenever a binding is evaluated that references a property that no...
PropertyDestroyedError()=delete
A property represents a value that can be part of or the result of data binding.
Signal< const T & > & valueChanged() const
Signal & destroyed() const
ConnectionHandle connect(std::function< void(Args...)> const &slot)
typename operator_node_result< Operator, Ts... >::type operator_node_result_t
The main namespace of the KDBindings library.