Skip to content

KDBindings::Binding

A combination of a root Node with an evaluator. More...

#include <binding.h>

Inherits from KDBindings::PropertyUpdater< T >, KDBindings::Private::Dirtyable

Public Functions

Name
Binding() =delete
Binding(Binding && other) =delete
Binding(Binding const & other) =delete
Binding(Private::Node< T > && rootNode, EvaluatorT const & evaluator)
Construct a new Binding with a specific evaluator.
~Binding() override
void evaluate()
virtual T get() const override
Binding & operator=(Binding && other) =delete
Binding & operator=(Binding const & other) =delete
virtual void setUpdateFunction(std::function< void(T &&)> const & updateFunction) override

Protected Functions

Name
const bool * dirtyVariable() const override
Private::Dirtyable ** parentVariable() override

Protected Attributes

Name
int m_bindingId
EvaluatorT m_evaluator
std::function< void(T &&)> m_propertyUpdateFunction
Private::Node< T > m_rootNode

Additional inherited members

Public Functions inherited from KDBindings::PropertyUpdater< T >

Name
PropertyUpdater() =default
PropertyUpdater(PropertyUpdater && other) =default
PropertyUpdater(PropertyUpdater const & other) =default
virtual ~PropertyUpdater() =default

Detailed Description

1
2
3
template <typename T ,
typename EvaluatorT  =BindingEvaluator>
class KDBindings::Binding;

A combination of a root Node with an evaluator.

Template Parameters:

  • T The type of the value that the Binding expression evaluates to.
  • EvaluatorT The type of the evaluator that is used to evaluate the Binding.

A root Node is formed whenever multiple properties are combined inside a expression and an evaluator is responsible for re-evaluating such an expression whenever any of the constituent properties change.

Public Functions Documentation

function Binding

1
Binding() =delete

A Binding is not default constructible.

function Binding

1
2
3
Binding(
    Binding && other
) =delete

A Binding can not be move constructed.

function Binding

1
2
3
Binding(
    Binding const & other
) =delete

A Binding cannot be copy constructed.

function Binding

1
2
3
4
inline explicit Binding(
    Private::Node< T > && rootNode,
    EvaluatorT const & evaluator
)

Construct a new Binding with a specific evaluator.

Parameters:

  • rootNode Represents that expression contained in the Binding.
  • evaluator Used to evaluate the expression contained in the Binding.

function ~Binding

1
inline ~Binding() override

Destructs the Binding by deregistering it from its evaluator.

function evaluate

1
inline void evaluate()

Re-evaluates the value of the Binding and notifies all dependants of the change.

function get

1
inline virtual T get() const override

Reimplements: KDBindings::PropertyUpdater::get

Returns the current value of the Binding.

function operator=

1
2
3
Binding & operator=(
    Binding && other
) =delete

A Binding can not be move assigned.

function operator=

1
2
3
Binding & operator=(
    Binding const & other
) =delete

A Binding cannot be copy assigned.

function setUpdateFunction

1
2
3
inline virtual void setUpdateFunction(
    std::function< void(T &&)> const & updateFunction
) override

Reimplements: KDBindings::PropertyUpdater::setUpdateFunction

Set the function that should be used to notify associated properties when the Binding re-evaluates.

Protected Functions Documentation

function dirtyVariable

1
inline const bool * dirtyVariable() const override

function parentVariable

1
inline Private::Dirtyable ** parentVariable() override

Protected Attributes Documentation

variable m_bindingId

1
int m_bindingId = -1;

The id of the Binding, used for keeping track of the Binding in its evaluator.

variable m_evaluator

1
EvaluatorT m_evaluator;

The evaluator responsible for evaluating this Binding.

variable m_propertyUpdateFunction

1
std::function< void(T &&)> m_propertyUpdateFunction = [](T &&) {};

The function used to notify associated properties when the Binding re-evaluates

variable m_rootNode

1
Private::Node< T > m_rootNode;

The root Node of the Binding represents the expression contained by the Binding.


Updated on 2022-04-12 at 00:03:53 +0000

Back to top