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//=============================================================================================================
76{
77public:
81 struct Context
82 {
84 QMap<QString, QVariant> results;
85
87 QVariantMap graphInputs;
88 };
89
90 //=========================================================================================================
99 {
100 MnaGraph* graph = nullptr;
101 QMap<QString, QObject*> livePlugins;
102 bool running = false;
103 QStringList executionOrder;
104 };
105
112 static Context execute(MnaGraph& graph, const QVariantMap& graphInputs);
113
120 static Context executeIncremental(MnaGraph& graph, Context& existing);
121
128 static QVariantMap executeNode(const MnaNode& node,
129 const QVariantMap& inputs);
130
132 using ProgressCallback = std::function<void(const QString& nodeId,
133 int current, int total)>;
134
139
140 //=========================================================================================================
141 // Stream-mode execution
142 //=========================================================================================================
143
146 using PluginFactory = std::function<QObject*(const QString& opType)>;
147
165 static StreamContext startStream(MnaGraph& graph, PluginFactory factory);
166
173 static void stopStream(StreamContext& ctx);
174
175private:
176 static ProgressCallback s_progressCallback;
177};
178
179} // namespace MNALIB
180
181#endif // MNA_GRAPH_EXECUTOR_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
MNE Analysis Container Format (mna/mnx).
In-memory DAG of MnaNode operations with validation, topological sort and JSON/CBOR persistence.
Definition mna_graph.h:66
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< QObject *(const QString &opType)> PluginFactory
static void stopStream(StreamContext &ctx)
static Context execute(MnaGraph &graph, const QVariantMap &graphInputs)
std::function< void(const QString &nodeId, int current, int total)> ProgressCallback
Progress callback type.
QMap< QString, QVariant > results
nodeId::portName → data (QVariant wrapping domain objects or file paths)
QVariantMap graphInputs
Graph-level inputs (populated before execution).
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:75