Table of Contents

Class NodeProcessor

Namespace
FlowGraph.Core.DataFlow
Assembly
FlowGraph.Core.dll

Base class for typed node processors with specific input/output types. Provides helper methods for registering ports and managing values.

public abstract class NodeProcessor : INodeProcessor
Inheritance
NodeProcessor
Implements
Derived
Inherited Members

Constructors

NodeProcessor(Node)

Creates a new node processor.

protected NodeProcessor(Node node)

Parameters

node Node

The node this processor is attached to.

Properties

AutoExecute

Gets whether this processor should auto-execute when inputs change.

public virtual bool AutoExecute { get; }

Property Value

bool

InputValues

Gets all input port values.

public IReadOnlyDictionary<string, IPortValue> InputValues { get; }

Property Value

IReadOnlyDictionary<string, IPortValue>

IsValid

Gets whether this processor is currently valid (all required inputs connected).

public virtual bool IsValid { get; }

Property Value

bool

Node

Gets the node this processor is attached to.

public Node Node { get; }

Property Value

Node

OutputValues

Gets all output port values.

public IReadOnlyDictionary<string, IPortValue> OutputValues { get; }

Property Value

IReadOnlyDictionary<string, IPortValue>

Methods

GetInputPort<T>(string)

Gets an input port by ID.

protected ReactivePort<T>? GetInputPort<T>(string portId)

Parameters

portId string

Returns

ReactivePort<T>

Type Parameters

T

GetInput<T>(string)

Gets a typed input value.

protected T? GetInput<T>(string portId)

Parameters

portId string

The port identifier.

Returns

T

The value, or default if not found.

Type Parameters

T

The expected type.

GetOutputPort<T>(string)

Gets an output port by ID.

protected ReactivePort<T>? GetOutputPort<T>(string portId)

Parameters

portId string

Returns

ReactivePort<T>

Type Parameters

T

Process()

Processes inputs and updates outputs. Called automatically when any input changes (if auto-execute is enabled).

public abstract void Process()

RegisterInput<T>(string, T?)

Registers an input port with a reactive value.

protected ReactivePort<T> RegisterInput<T>(string portId, T? initialValue = default)

Parameters

portId string

The port identifier (must match a port in Node.Inputs).

initialValue T

The initial value.

Returns

ReactivePort<T>

The created reactive port.

Type Parameters

T

The type of the port value.

RegisterOutput<T>(string, T?)

Registers an output port with a reactive value.

protected ReactivePort<T> RegisterOutput<T>(string portId, T? initialValue = default)

Parameters

portId string

The port identifier (must match a port in Node.Outputs).

initialValue T

The initial value.

Returns

ReactivePort<T>

The created reactive port.

Type Parameters

T

The type of the port value.

SetOutput<T>(string, T?)

Sets a typed output value.

protected void SetOutput<T>(string portId, T? value)

Parameters

portId string

The port identifier.

value T

The value to set.

Type Parameters

T

The value type.