holoscan::IOSpec
holoscan::IOSpec
holoscan::IOSpec
Class to define the specification of an input/output port of an Operator.
An interaction point between two operators. Operators ingest data at Input ports and publish data at Output ports. Receiver, Transmitter, and MessageRouter in GXF would be replaced with the concept of Input/Output Port of the Operator and the Flow (Edge) of the Application Workflow in the Framework.
Construct a new IOSpec object
Construct a new IOSpec object.
Parameters
The pointer to the operator specification that contains this input/output.
The name of this input/output.
The type of this input/output.
The type info of the data of this input/output.
The size of the input/output queue.
The queue policy (optional).
Get the operator specification that contains this input/output.
Returns: The pointer to the operator specification that contains this input/output.
Get the name of this input/output.
Returns: The name of this input/output.
Get the input/output type.
Returns: The input/output type.
Get the receiver/transmitter type.
Returns: The receiver type (for inputs) or transmitter type (for outputs)
Get the type info of the data of this input/output.
Returns: The type info of the data of this input/output.
Get the memory block size of this input/output.
Returns: The memory block size of this input/output.
Get the device pointer of this input/output.
Returns: The device pointer of this input/output.
Get the conditions of this input/output.
Returns: The reference to the conditions of this input/output.
Add a condition to this input/output.
The following ConditionTypes are supported:
Returns: The reference to this IOSpec.
Parameters
The type of the condition.
The arguments of the condition.
Get the connector (transmitter or receiver) of this input/output.
Returns: The connector (transmitter or receiver) of this input/output.
Set a topic name for this port (Publish/Subscribe connectors only).
If the connector type is kDefault, it is automatically changed to kPubSub and the topic is applied. If the connector type is already kPubSub, the topic is set on the existing connector. For any other connector type (e.g. kUCX, kDoubleBuffer), a warning is logged and the topic is ignored unless replace_connector is true, in which case the existing connector is replaced with a Pub/Sub connector.
When both publisher and subscriber use the same topic, add_flow() is optional; add_operator() for each is sufficient — Pub/Sub backend discovery matches by topic.
Returns: Reference to this IOSpec.
Parameters
Topic name (must match between publisher and subscriber ports).
If true, explicitly non-PubSub connectors are replaced with a Pub/Sub connector for this port.
Set a QoS profile for this port (Publish/Subscribe connectors only).
Uses the backend-independent nvidia::gxf::QoSProfile struct. Named presets (e.g. QoSProfile::SensorData(), QoSProfile::Reliable()) and the fluent builder API are both supported.
If the connector type is kDefault, it is automatically changed to kPubSub and the QoS is applied. If the connector type is already kPubSub, the QoS is set on the existing connector. For any other connector type, a warning is logged and the QoS is ignored.
Example:
The DDS backend maps QoSProfile through dds_qos_profiles.hpp. Other backends (e.g. Zenoh, UCX) would map the same struct to their own QoS mechanisms.
Returns: Reference to this IOSpec.
Parameters
The QoS profile to apply.
Example
Set the queue size of the input/output port.
Note: This value is only used for initializing input ports. ‘queue_size_’ is set by the ‘OperatorSpec::input()’ method or this method. If the queue size is set to ‘any size’ (IOSpec::kAnySize in C++ or IOSpec.ANY_SIZE in Python), the connector/condition settings will be ignored. If the queue size is set to other values, the default connector (DoubleBufferReceiver/UcxReceiver) and condition (MessageAvailableCondition) will use the queue size for initialization (‘capacity’ for the connector and ‘min_size’ for the condition) if they are not set.
Note: For input ports, a queue size greater than 1 will also set the default MessageAvailableCondition min_size to the same value unless you override the port condition. This enables batched execution. Holoscan emits a warning in the default-condition case. If you only want buffering without batching, explicitly set min_size=1. Holoscan plans to introduce an explicit batch_size configuration and change queue_size/size to control queue capacity only; setting min_size explicitly now will make future migration straightforward.
Returns: The reference to this IOSpec.
Parameters
The queue size of the input/output port.
Set the queue policy of the input/output port.
Note: This value is only used for initializing input and output ports. ‘queue_policy_’ is set by the ‘OperatorSpec::input()’, ‘OperatorSpec::output()’ or ‘IOSpec::queue_policy’ method.
The following IOSpec::QueuePolicy values are supported:
Returns: The reference to this IOSpec.
Parameters
The queue policy of the input/output port.
Get a YAML representation of the IOSpec.
Returns: YAML node including the parameters of this component.
Get a description of the IOSpec.
Returns: YAML string.
See also: to_yaml_node()
Get the unique identifier for this IOSpec.
The unique identifier follows the pattern: “{operator.qualified_name()}.{port_name}” This is used for data logging and identification purposes. The unique_id is set during operator initialization.
Returns: The unique identifier string.
Set the unique identifier for this IOSpec.
This method is called during operator initialization to set the unique identifier.
Parameters
The unique identifier string to set.
Input/Output type.
Connector type.
Enum class representing the policy for handling queue operations.
Input/Output size.