libtcspc.Node

class libtcspc.Node(*, input=None, output=None)[source]

Bases: ABC

Base class for a processing graph node.

All nodes are pure data objects that can be pickled or deep-copied. They are meant to be fully configured upon creation and not subsequently modified.

Nodes have named input and output ports. Many nodes representing processors have a single input port named "input" and a single output port named "output". Input and output ports represent the possible connections that can be made between nodes in a graph. Every node must have at least one input port, but may or may not have output ports.

In order to support checking for event type compatibility between nodes, a node is able to compute the set of events emitted on its output ports given the set of events received on its input ports. Also, they have the capability to generate C++ code fragments to instantiate executable code. Methods for these capabilities are usually not directly called from user code.

Initialize with the given ports.

A subclass’s __init__ must call this function if the node is not a single-input, single-output node.

Parameters:
  • input (Sequence[str] | None) – The names of the input ports of the node. If not given, the node has a single input port named “input”.

  • output (Sequence[str] | None) – The names of the output ports of the node. If not given, the node has a single output port named “output”.

final inputs()[source]

Return the names of the node’s input ports.

Return type:

tuple[str, …]

final outputs()[source]

Return the names of the node’s output ports.

Return type:

tuple[str, …]