v2.0.0
Loading...
Searching...
No Matches
mna_graph.h
Go to the documentation of this file.
1//=============================================================================================================
29
30#ifndef MNA_GRAPH_H
31#define MNA_GRAPH_H
32
33//=============================================================================================================
34// INCLUDES
35//=============================================================================================================
36
37#include "mna_global.h"
38#include "mna_node.h"
39#include "mna_port.h"
40#include "mna_param_tree.h"
41
42//=============================================================================================================
43// QT INCLUDES
44//=============================================================================================================
45
46#include <QString>
47#include <QStringList>
48#include <QList>
49#include <QJsonObject>
50#include <QCborMap>
51
52//=============================================================================================================
53// DEFINE NAMESPACE MNALIB
54//=============================================================================================================
55
56namespace MNALIB
57{
58
59//=============================================================================================================
66{
67public:
68 MnaGraph();
69
70 //=========================================================================================================
71 // Node management
72 //=========================================================================================================
73
74 void addNode(const MnaNode& node);
75 void removeNode(const QString& nodeId);
76 MnaNode& node(const QString& nodeId);
77 const MnaNode& node(const QString& nodeId) const;
78 QList<MnaNode>& nodes();
79 const QList<MnaNode>& nodes() const;
80 bool hasNode(const QString& nodeId) const;
81
82 //=========================================================================================================
83 // Graph-level ports
84 //=========================================================================================================
85
86 QList<MnaPort> graphInputs;
87 QList<MnaPort> graphOutputs;
88
89 //=========================================================================================================
90 // Parameter tree
91 //=========================================================================================================
92
94
95 //=========================================================================================================
96 // Connection helper
97 //=========================================================================================================
98
104 bool connect(const QString& srcNodeId, const QString& srcPortName,
105 const QString& dstNodeId, const QString& dstPortName);
106
107 //=========================================================================================================
108 // Validation
109 //=========================================================================================================
110
117 bool validate(QStringList* errors = nullptr) const;
118
119 //=========================================================================================================
120 // Topological sort
121 //=========================================================================================================
122
123 QStringList topologicalSort() const;
124
125 //=========================================================================================================
126 // Dependency queries
127 //=========================================================================================================
128
129 QStringList upstreamNodes(const QString& nodeId) const;
130 QStringList downstreamNodes(const QString& nodeId) const;
131 QStringList dirtyNodes() const;
132
133 //=========================================================================================================
134 // Serialization
135 //=========================================================================================================
136
137 QJsonObject toJson() const;
138 static MnaGraph fromJson(const QJsonObject& json);
139 QCborMap toCbor() const;
140 static MnaGraph fromCbor(const QCborMap& cbor);
141
142private:
143 QList<MnaNode> m_nodes;
144};
145
146} // namespace MNALIB
147
148#endif // MNA_GRAPH_H
One operation in an MNA graph — opType, typed I/O ports, attributes, execution mode (Batch / Stream /...
Export/import macros, build-info accessors, and MNALIB namespace anchor for the MNE Analysis Containe...
#define MNASHARED_EXPORT
Definition mna_global.h:47
Hierarchical parameter store with formula-driven dynamic bindings shared across an MNA graph.
Typed input or output slot on a graph node — carries an MnaDataKind, an upstream link,...
MNE Analysis Container Format (mna/mnx).
MnaNode & node(const QString &nodeId)
Definition mna_graph.cpp:79
void addNode(const MnaNode &node)
Definition mna_graph.cpp:60
bool validate(QStringList *errors=nullptr) const
QStringList dirtyNodes() const
bool hasNode(const QString &nodeId) const
QStringList downstreamNodes(const QString &nodeId) const
QCborMap toCbor() const
void removeNode(const QString &nodeId)
Definition mna_graph.cpp:67
QList< MnaPort > graphInputs
Named, typed entry points.
Definition mna_graph.h:86
QList< MnaPort > graphOutputs
Named, typed exit points.
Definition mna_graph.h:87
MnaParamTree paramTree
Hierarchical parameter store with formula-driven bindings.
Definition mna_graph.h:93
QList< MnaNode > & nodes()
QJsonObject toJson() const
QStringList topologicalSort() const
static MnaGraph fromJson(const QJsonObject &json)
QStringList upstreamNodes(const QString &nodeId) const
bool connect(const QString &srcNodeId, const QString &srcPortName, const QString &dstNodeId, const QString &dstPortName)
static MnaGraph fromCbor(const QCborMap &cbor)
Single executable step in an MNA pipeline graph, with attributes, typed ports, exec mode,...
Definition mna_node.h:75
Path-keyed parameter store with formula-driven dynamic bindings.