• OctoMY API
  • OctoMY API Reference
  • eval Namespace
  • eval Namespace

    The expression system: GLSL expressions declared, compiled and evaluated. More...

    Header: #include <eval>

    Namespaces

    namespace internal

    Classes

    class Graph
    class Program

    Functions

    eval::Result<QVariant> evaluate(const QString &expression, eval::Backend hint = Backend::Interpreted)
    eval::Result<QVariant> evaluate(const QString &expression, const QHash<QString, QVariant> &inputs, eval::Backend hint = Backend::Interpreted)

    Detailed Description

    libeval turns GLSL expressions into runnable programs. A caller declares input slots and output expressions on an eval::Graph and compiles it to an immutable eval::Program. eval::evaluate() does all of this in one call for a single expression.

    Namespaces

    namespace eval::internal

    Classes

    class Graph

    The edit-time form of an expression program: input slots and output expressions. More...

    class Program

    An immutable compiled expression program, produced by an eval::Graph. More...

    Function Documentation

    eval::Result<QVariant> eval::evaluate(const QString &expression, eval::Backend hint = Backend::Interpreted)

    Parses, type-checks, compiles and evaluates expression, and returns its value or the diagnostics that stopped it.

    hint selects the backend. The default, Backend::Interpreted, keeps a casual caller off the JIT's compile latency. Every call parses and compiles again, so a hot loop must hold an eval::Program instead.

    eval::Result<QVariant> eval::evaluate(const QString &expression, const QHash<QString, QVariant> &inputs, eval::Backend hint = Backend::Interpreted)

    Each entry in inputs becomes an input slot named by its key, set to its value, before expression is evaluated. The slot type follows the QVariant type: float, double, bool, uint, qint64 and quint64 keep their type, and any other type, int included, becomes a float slot.

    This is an overloaded function.