GGBinding class
#include <GGUI/Public/Binding.h>
GGBinding: an expression (or a lambda) plus the target it reads from.
Public static variables
- static size_t InlineBytes constexpr
- the most a lambda and its captures take
Constructors, destructors, conversion operators
- GGBinding() defaulted
- No binding: not valid.
Public functions
- auto IsLambda() const -> bool
- Whether it is a lambda (BindLambda).
- auto IsBig() const -> bool
- Whether it reads big fields (BigField).
- auto IsBigValue() const -> bool
- A big field's value itself, as opposed to a ratio or comparison.
- auto IsCpuOnly() const -> bool
- Lambdas and anything over big fields.
- auto IsValid() const -> bool
- Whether it computes something.
- auto Target() const -> BindTarget
- Whose fields it reads.
- auto GetExpression() const -> const GGExpr&
- What it computes; empty for a lambda or big fields.
- auto Evaluate(const BindingReader& reader, bool& bValid) const -> float
- Its value now.
bValidis false if its target is gone or a field couldn't be read. - auto EvaluateBig(const BindingReader& reader, bool& bValid) const -> BigNumber
- Only for IsBigValue.
Friends
- auto operator==(const GGBinding& a, const GGBinding& b) -> bool
- The same target and computation: the same binding.
- auto GGBind(BindTarget target, const GGExpr& expression) -> GGBinding
- A binding of
expressionovertarget'sfields. - auto GGBind(BindTarget target, BigField field) -> GGBinding
- A big field's value (see BigField).
- auto GGBind(BindTarget target, BigRatio ratio) -> GGBinding
- A ratio of two big fields, 0..1.
- auto GGBind(BindTarget target, BigAtLeast comparison) -> GGBinding
- 1 if one big field is at least another, else 0.
-
template<typename TFn>auto BindLambda(BindTarget target, TFn fn) -> GGBinding
- Escape hatch:
fn(reader, target, bValid)computes the value. CPU only, and evaluated every update because its dependencies are unknown.