Holoscan SDK v4.0.0

Class GXFOutputContext

Base Type

class GXFOutputContext : public holoscan::OutputContext

Class to hold the output context for a GXF Operator.

This class provides the interface to send data to the output ports of the operator using GXF.

Public Functions

GXFOutputContext(ExecutionContext *execution_context, Operator *op)

Construct a new GXFOutputContext object.

Parameters
  • execution_context – The pointer to the execution context.

  • op – The pointer to the GXFOperator object.

GXFOutputContext(ExecutionContext *execution_context, Operator *op, std::unordered_map<std::string, std::shared_ptr<IOSpec>> &outputs)

Construct a new GXFOutputContext object.

Parameters
  • execution_context – The pointer to the execution context.

  • op – The pointer to the GXFOperator object.

  • outputs – outputs The references to the map of the output specs.

gxf_context_t gxf_context() const

Get pointer to the GXF execution runtime.

Returns

The pointer to the GXF context.

virtual void set_cuda_stream(const cudaStream_t stream, const char *output_port_name = nullptr) override

Set a stream to be emitted on a given output port.

The actual creation of the stream component in the output message will occur on any subsequent emit calls on this output port, so the call to this function should occur prior to the emit call(s) for a given port.

Parameters
  • stream – The CUDA stream

  • output_port_name – The name of the output port.

virtual std::optional<cudaStream_t> stream_to_emit(const char *output_port_name = nullptr) override

Get the CUDA stream to be emitted on the specified output port.

Parameters

output_port_name – The name of the output port.

Returns

Optional CUDA stream configured for this output port.

Protected Functions

virtual void emit_impl(std::any data, const char *name = nullptr, OutputType out_type = OutputType::kAny, const int64_t acq_timestamp = -1, bool omit_data_logging = false, bool skip_stream_propagation = false, bool is_new_entity = false) override

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
  • data – The data to send.

  • name – The name of the output port.

  • out_type – The type of the message data.

  • acq_timestamp – The timestamp to publish in the output message. The default value of -1 does not publish a timestamp.

  • omit_data_logging – If true, data will not be logged via the DataLogger interface.

  • skip_stream_propagation – If true, skip propagating CUDA stream to entity memory buffers. Used when the caller has already set the stream on tensors.

  • is_new_entity – If true, the entity was just created (not forwarded), allowing optimizations like skipping checks for existing components.

inline std::shared_ptr<gxf::CudaObjectHandler> gxf_cuda_object_handler()

Previous Class GXFNetworkContext
Next Class GXFParameterAdaptor
© Copyright 2022-2026, NVIDIA. Last updated on Mar 9, 2026