v2.0.0
Loading...
Searching...
No Matches
mna_graph_executor.h
Go to the documentation of this file.
1//=============================================================================================================
30
31#ifndef MNA_GRAPH_EXECUTOR_H
32#define MNA_GRAPH_EXECUTOR_H
33
34//=============================================================================================================
35// INCLUDES
36//=============================================================================================================
37
38#include "mna_global.h"
39#include "mna_node.h"
40
41//=============================================================================================================
42// QT INCLUDES
43//=============================================================================================================
44
45#include <QString>
46#include <QMap>
47#include <QVariant>
48#include <QVariantMap>
49#include <QObject>
50#include <functional>
51
52//=============================================================================================================
53// FORWARD DECLARATIONS
54//=============================================================================================================
55
56namespace MNALIB
57{
58class MnaGraph;
59}
60
61//=============================================================================================================
62// DEFINE NAMESPACE MNALIB
63//=============================================================================================================
64
65namespace MNALIB
66{
67
68//=============================================================================================================
78{
79public:
83 struct Context
84 {
86 QMap<QString, QVariant> results;
87
89 QVariantMap graphInputs;
90
92 QString abortedNode;
93 };
94
95 //=========================================================================================================
104 {
105 MnaGraph* graph = nullptr;
106 QMap<QString, QObject*> livePlugins;
107 bool running = false;
108 QStringList executionOrder;
109 };
110
117 static Context execute(MnaGraph& graph, const QVariantMap& graphInputs);
118
125 static Context executeIncremental(MnaGraph& graph, Context& existing);
126
133 static QVariantMap executeNode(const MnaNode& node,
134 const QVariantMap& inputs);
135
137 using ProgressCallback = std::function<void(const QString& nodeId,
138 int current, int total)>;
139
145
146 //=========================================================================================================
147 // Stream-mode execution
148 //=========================================================================================================
149
152 using PluginFactory = std::function<QObject*(const QString& opType)>;
153
171 static StreamContext startStream(MnaGraph& graph, PluginFactory factory);
172
179 static void stopStream(StreamContext& ctx);
180
181private:
183 static void applyParamTree(MnaGraph& graph);
184
189 static bool runNode(MnaGraph& graph, MnaNode& node, Context& ctx);
190
192 static QList<MnaVerificationResult> runChecks(const MnaGraph& graph, const MnaNode& node, const QString& phase, const QVariantMap& scope);
193
194 static ProgressCallback s_progressCallback;
195};
196
197} // namespace MNALIB
198
199#endif // MNA_GRAPH_EXECUTOR_H
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).
In-memory DAG of MnaNode operations with validation, topological sort and JSON/CBOR persistence.
Definition mna_graph.h:68
Stateless batch and stream-mode runner for an MnaGraph.
static void setProgressCallback(ProgressCallback cb)
static Context executeIncremental(MnaGraph &graph, Context &existing)
static StreamContext startStream(MnaGraph &graph, PluginFactory factory)
static QVariantMap executeNode(const MnaNode &node, const QVariantMap &inputs)
std::function< void(const QString &nodeId, int current, int total)> ProgressCallback
Progress callback type.
std::function< QObject *(const QString &opType)> PluginFactory
static void stopStream(StreamContext &ctx)
static Context execute(MnaGraph &graph, const QVariantMap &graphInputs)
QMap< QString, QVariant > results
nodeId::portName → data (QVariant wrapping domain objects or file paths)
QVariantMap graphInputs
Graph-level inputs (populated before execution).
QString abortedNode
Node whose failed "error" check stopped the run (empty if it ran to the end).
QStringList executionOrder
Topological order used for startup/shutdown.
bool running
Whether the stream is active.
MnaGraph * graph
The pipeline graph (owned externally).
QMap< QString, QObject * > livePlugins
nodeId → live plugin instance (QObject* avoids scan dependency)
Single executable step in an MNA pipeline graph, with attributes, typed ports, exec mode,...
Definition mna_node.h:77