v2.0.0
Loading...
Searching...
No Matches
mna_graph.cpp File Reference

Implementation of MnaGraph: node management, port connectivity, schema-aware validation, Kahn topological sort and JSON/CBOR round-trip. More...

#include "mna_graph.h"
#include "mna_op_registry.h"
#include <QJsonArray>
#include <QCborArray>
#include <QSet>
#include <QQueue>
Include dependency graph for mna_graph.cpp:

Go to the source code of this file.

Detailed Description

Implementation of MnaGraph: node management, port connectivity, schema-aware validation, Kahn topological sort and JSON/CBOR round-trip.

SPDX-License-Identifier: BSD-3-Clause Copyright (c) 2026 MNE-CPP Authors

Author
Christoph Dinh chris.nosp@m.toph.nosp@m..dinh.nosp@m.@mne.nosp@m.-cpp..nosp@m.org
Since
2.2.0
Date
April 2026

The implementation backs the graph with a single QList of MnaNode and resolves node ids through linear search, which stays cheap at the pipeline sizes MNA targets (tens to hundreds of nodes). MnaGraph::validate walks the node list, queries MnaOpRegistry for each opType, runs the per-node MnaOpSchema::validate, then sweeps the inter-node edges to check that every required input port is wired and that the MnaDataKind on both ends agrees.

MnaGraph::topologicalSort implements Kahn's algorithm over the input-port sourceNodeId references and surfaces an empty list when a cycle is present, which the validator turns into an explicit error. upstreamNodes / downstreamNodes use a QQueue-driven BFS to support incremental re-execution, and the JSON / CBOR codecs delegate every nested struct to its own codec so a project survives a round trip without loss.

Definition in file mna_graph.cpp.