holoscan::OutputContext
holoscan::OutputContext
Class to hold the output context.
This class provides the interface to send data to the output ports of the operator.
Constructors
OutputContext
Construct a new OutputContext object
Construct a new OutputContext object (with outputs)
Construct a new OutputContext object.
outputs for the OutputContext will be set to op->spec()->outputs()
Parameters
The pointer to the execution context.
The pointer to the operator that this context is associated with.
Destructor
~OutputContext
Methods
execution_context
Get pointer to the execution context.
Returns: The pointer to the execution context.
op
Return the operator that this context is associated with.
Returns: The pointer to the operator.
outputs
Return the reference to the map of the output specs.
Returns: The reference to the map of the output specs.
emit
Single item (1)
Single item (2)
Single item (3)
Single item (4)
Send message data (GXF Entity) to the output port with the given name.
This method is for interoperability with the GXF Codelet.
The object to be sent must be an object with holoscan::gxf::Entity type and the output port with the given name must exist.
If the operator has a single output port, the output port name can be omitted.
Example:
Template parameters
The type of the data to send. It should be holoscan::gxf::Entity.
Parameters
The entity object to send (holoscan::gxf::Entity).
The name of the output port.
The time when the message is acquired. For instance, this would generally be the timestamp of the camera when it captures an image.
Example
set_cuda_stream
Set a CUDA stream to be emitted on a given output port.
When using receive_cuda_stream, output ports are automatically configured to emit the operator’s internal stream, so this method is typically not needed. Use this method when:
- Using
allocate_cuda_streamto allocate a stream for a root operator - Using
receive_cuda_streamsfor manual stream handling
This method must be called before the corresponding emit() call for the port.
Parameters
The CUDA stream to emit. Must be a Holoscan-managed stream (one returned by receive_cuda_stream, receive_cuda_streams, or allocate_cuda_stream).
The name of the output port. Can be omitted if the operator has only a single output port.
cuda_object_handler
Overload 1
Overload 2
Get the CUDA stream/event handler used by this input context.
This CudaObjectHandler class is designed primarily for internal use and is not guaranteed to have a stable API. Application authors should instead rely on the public set_cuda_stream method.
stream_to_emit
Get the CUDA stream to be emitted on the specified output port.
This method retrieves the CUDA stream that has been configured for emission on the given output port via set_cuda_stream. The base implementation returns std::nullopt. Derived classes should override this method to provide actual stream information.
Returns: Optional CUDA stream. std::nullopt if no stream is configured.
Parameters
The name of the output port.
emit_impl
The implementation of the emit method.
Depending on the type of the data, this method wraps the data with a message and sends it to the output port with the given name.
Parameters
The data to send.
The name of the output port.
The type of the message data.
The timestamp to publish in the output message. The default value of -1 does not publish a timestamp.
If true, data will not be logged via the DataLogger interface.
If true, skip propagating CUDA stream to entity memory buffers. Used when the caller has already set the stream on tensors.
If true, the entity was just created (not forwarded), allowing optimizations like skipping checks for existing components.
log_tensor
log_tensormap
Types
OutputType
The output data type.