v2.0.0
Loading...
Searching...
No Matches
MNALIB::MnaGraphExecutor Class Reference

Graph executor for MNA pipelines. More...

#include <mna_graph_executor.h>

Classes

struct  Context
struct  StreamContext

Public Types

using ProgressCallback
 Progress callback type.
using PluginFactory = std::function<QObject*(const QString& opType)>

Static Public Member Functions

static Context execute (MnaGraph &graph, const QVariantMap &graphInputs)
static Context executeIncremental (MnaGraph &graph, Context &existing)
static QVariantMap executeNode (const MnaNode &node, const QVariantMap &inputs)
static void setProgressCallback (ProgressCallback cb)
static StreamContext startStream (MnaGraph &graph, PluginFactory factory)
static void stopStream (StreamContext &ctx)

Detailed Description

Graph executor for MNA pipelines.

Executes a computational graph by traversing nodes in topological order and invoking registered operation functions.

Definition at line 79 of file mna_graph_executor.h.

Member Typedef Documentation

◆ PluginFactory

using MNALIB::MnaGraphExecutor::PluginFactory = std::function<QObject*(const QString& opType)>

Factory callback: given a node's opType, create the corresponding live plugin. Returns nullptr if the opType is unknown. The host app provides this callback.

Definition at line 150 of file mna_graph_executor.h.

◆ ProgressCallback

Initial value:
std::function<void(const QString& nodeId,
int current, int total)>

Progress callback type.

Definition at line 136 of file mna_graph_executor.h.

Member Function Documentation

◆ execute()

MnaGraphExecutor::Context MnaGraphExecutor::execute ( MnaGraph & graph,
const QVariantMap & graphInputs )
static

Execute the full graph (all nodes in topological order).

Parameters
graphThe graph to execute.
graphInputsNamed inputs fed into graph-level input ports.
Returns
Execution context with all results.

Definition at line 65 of file mna_graph_executor.cpp.

◆ executeIncremental()

MnaGraphExecutor::Context MnaGraphExecutor::executeIncremental ( MnaGraph & graph,
Context & existing )
static

Execute only dirty nodes and their downstream dependents.

Parameters
graphThe graph to execute.
existingExisting context with prior results.
Returns
Updated context.

Definition at line 135 of file mna_graph_executor.cpp.

◆ executeNode()

QVariantMap MnaGraphExecutor::executeNode ( const MnaNode & node,
const QVariantMap & inputs )
static

Execute a single node (for testing/debugging).

Parameters
nodeThe node to execute.
inputsInput data keyed by port name.
Returns
Output data keyed by port name.

Definition at line 194 of file mna_graph_executor.cpp.

◆ setProgressCallback()

void MnaGraphExecutor::setProgressCallback ( ProgressCallback cb)
static

Set a progress callback invoked for each node execution.

Definition at line 328 of file mna_graph_executor.cpp.

◆ startStream()

MnaGraphExecutor::StreamContext MnaGraphExecutor::startStream ( MnaGraph & graph,
PluginFactory factory )
static

Start stream-mode execution of a graph.

  1. Validates the graph
  2. Performs topological sort
  3. For each node, calls factory to instantiate a live plugin
  4. Applies MnaParamTree values to node attributes
  5. Wires connections based on port dataKind matching

The mna library does NOT depend on MNE Scan — the host app provides the factory and is responsible for wiring Qt signal/slot connections between the returned QObject* instances.

Parameters
[in,out]graphThe pipeline graph.
[in]factoryCallback that maps opType → live QObject* plugin.
Returns
Stream context. Check ctx.running to see if startup succeeded.

Definition at line 337 of file mna_graph_executor.cpp.

◆ stopStream()

void MnaGraphExecutor::stopStream ( StreamContext & ctx)
static

Stop a running stream. Iterates nodes in reverse topological order and deletes the live plugin objects.

Parameters
[in,out]ctxThe stream context to stop.

Definition at line 395 of file mna_graph_executor.cpp.


The documentation for this class was generated from the following files: