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//=============================================================================================================
68{
69public:
70 MnaGraph();
71
72 //=========================================================================================================
73 // Node management
74 //=========================================================================================================
75
76 void addNode(const MnaNode& node);
77 void removeNode(const QString& nodeId);
78 MnaNode& node(const QString& nodeId);
79 const MnaNode& node(const QString& nodeId) const;
80 QList<MnaNode>& nodes();
81 const QList<MnaNode>& nodes() const;
82 bool hasNode(const QString& nodeId) const;
83
84 //=========================================================================================================
85 // Graph-level ports
86 //=========================================================================================================
87
88 QList<MnaPort> graphInputs;
89 QList<MnaPort> graphOutputs;
90
91 //=========================================================================================================
92 // Parameter tree
93 //=========================================================================================================
94
96
97 //=========================================================================================================
98 // Connection helper
99 //=========================================================================================================
100
110 bool connect(const QString& srcNodeId, const QString& srcPortName,
111 const QString& dstNodeId, const QString& dstPortName);
112
113 //=========================================================================================================
114 // Validation
115 //=========================================================================================================
116
123 bool validate(QStringList* errors = nullptr) const;
124
125 //=========================================================================================================
126 // Topological sort
127 //=========================================================================================================
128
129 QStringList topologicalSort() const;
130
131 //=========================================================================================================
132 // Dependency queries
133 //=========================================================================================================
134
135 QStringList upstreamNodes(const QString& nodeId) const;
136 QStringList downstreamNodes(const QString& nodeId) const;
137 QStringList dirtyNodes() const;
138
139 //=========================================================================================================
140 // Serialization
141 //=========================================================================================================
142
143 QJsonObject toJson() const;
144 static MnaGraph fromJson(const QJsonObject& json);
145 QCborMap toCbor() const;
146 static MnaGraph fromCbor(const QCborMap& cbor);
147
148private:
149 QList<MnaNode> m_nodes;
150};
151
152} // namespace MNALIB
153
154#endif // MNA_GRAPH_H
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,...
Export/import macros, build-info accessors, and MNALIB namespace anchor for the MNE Analysis Containe...
#define MNASHARED_EXPORT
Definition mna_global.h:47
One operation in an MNA graph — opType, typed I/O ports, attributes, execution mode (Batch / Stream /...
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:88
QList< MnaPort > graphOutputs
Named, typed exit points.
Definition mna_graph.h:89
MnaParamTree paramTree
Hierarchical parameter store with formula-driven bindings.
Definition mna_graph.h:95
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:77
Path-keyed parameter store with formula-driven dynamic bindings.