Skip to main content

MnaOpSchemaAttr

Namespace: MNALIB  ·  Library: MNA Library

#include <mna/mna_op_schema.h>

struct MNALIB::MnaOpSchemaAttr

Attribute descriptor within an operation schema.

src/examples/ex_mna/main.cpp
QStringList problems;
const bool nodeValid = registry.schema("ex_affine").validate(graph.node("scale"), &problems);
MnaNode unset = graph.node("source");
unset.attributes.clear(); // "value" is required
const bool unsetValid = registry.schema("ex_constant").validate(unset);
const MnaOpSchemaPort affineIn = registry.schema("ex_affine").inputPorts.first(); // "in", Matrix, required
const MnaOpSchemaAttr affineGain = registry.schema("ex_affine").attributes.first(); // "gain", double, default 1

Example​

Used in examples​

ex_mna​

MNA library: register operations, build and run a graph, bind parameters and save a project.

src/examples/ex_mna/main.cpp, line 141
unset.attributes.clear(); // "value" is required
const bool unsetValid = registry.schema("ex_constant").validate(unset);
const MnaOpSchemaPort affineIn = registry.schema("ex_affine").inputPorts.first(); // "in", Matrix, required
const MnaOpSchemaAttr affineGain = registry.schema("ex_affine").attributes.first(); // "gain", double, default 1
ok &= expect(nodeValid && problems.isEmpty() && !unsetValid && affineIn.name == "in" && affineIn.required && affineGain.name == "gain" && affineGain.defaultValue.toDouble() == 1.0 && graph.validate() && graph.topologicalSort() == QStringList({"source", "scale", "shift"}),
"MnaOpSchema accepts the wired node and rejects a missing required attribute; graph order source -> scale -> shift");

Authors of this file​