Skip to main content

ClikaRT::graph::RewriteMatch

struct

Header: ClikaRT/graph/rewrite.h

transforms::rewrite: a transform written as a rule. The rule finds every occurrence of a Pattern, keeps the ones its condition accepts, and replaces each with the values its replacement computes from the occurrence's inputs, through ModelGraph::replace, so every rule an edit keeps (the type rule, the count, validate-first) holds for the rule too. optimize runs it as it runs a transform you write with Transform::from_function: one report row, the order runs_after keeps, and the failure that ends the run and leaves the graph as optimize found it.

One occurrence a rule rewrites, read on the graph as the rule's earlier replacements in the same iteration left it.

Data members​

nodes​

std::vector<std::optional<Node>> nodes

The matched node per pattern node, in add_node order, as Match::nodes holds them: std::nullopt for an optional node the occurrence lacks.

Declared in ClikaRT/graph/rewrite.h, line 36

inputs​

std::vector<Value> inputs

The values the occurrence reads from outside it: every input of a matched node that no matched node makes, in pattern-node order and then input-port order, each listed once. A constant is one of them.

Declared in ClikaRT/graph/rewrite.h, line 40

outputs​

std::vector<Value> outputs

The values the occurrence makes that a node outside it reads or the graph returns, in the same order, each listed once. A value a matched node reads is an output too when a node outside reads it as well.

Declared in ClikaRT/graph/rewrite.h, line 44