Class GXFOperator

Base Type

Derived Types

class GXFOperator : public holoscan::Operator

Subclassed by holoscan::ops::AJASourceOp, holoscan::ops::BayerDemosaicOp, holoscan::ops::EmergentSourceOp, holoscan::ops::FormatConverterOp, holoscan::ops::HolovizOp, holoscan::ops::LSTMTensorRTInferenceOp, holoscan::ops::MultiAIInferenceOp, holoscan::ops::MultiAIPostprocessorOp, holoscan::ops::SegmentationPostprocessorOp, holoscan::ops::TensorRTInferenceOp, holoscan::ops::ToolTrackingPostprocessorOp, holoscan::ops::ToolTrackingVizOp, holoscan::ops::VideoStreamRecorderOp, holoscan::ops::VideoStreamReplayerOp, holoscan::ops::VisualizerICardioOp

Public Functions

template<typename ArgT, typename ...ArgsT, typename = std::enable_if_t<!std::is_base_of_v<Operator, std::decay_t<ArgT>> && (std::is_same_v<Arg, std::decay_t<ArgT>> || std::is_same_v<ArgList, std::decay_t<ArgT>> || std::is_base_of_v<holoscan::Condition, typename holoscan::type_info<ArgT>::derived_type> || std::is_base_of_v<holoscan::Resource, typename holoscan::type_info<ArgT>::derived_type>)>>
inline GXFOperator(ArgT &&arg, ArgsT&&... args)

GXFOperator() = default

virtual const char *gxf_typename() const = 0

Get the type name of the GXF component.

The returned string is the type name of the GXF component and is used to create the GXF component.

Example: “nvidia::holoscan::AJASource”


The type name of the GXF component.

inline gxf_context_t gxf_context() const

Get the GXF context object.


The GXF context object.

inline void gxf_eid(gxf_uid_t gxf_eid)

Set GXF entity ID.


gxf_eid – The GXF entity ID.

inline gxf_uid_t gxf_eid() const

Get the GXF entity ID.


The GXF entity ID.

inline void gxf_cid(gxf_uid_t gxf_cid)

Set the GXF component ID.


gxf_cid – The GXF component ID.

inline gxf_uid_t gxf_cid() const

Get the GXF component ID.


The GXF component ID.

Public Static Functions

template<typename typeT>
static inline void register_converter()

Register the argument setter and the GXF parameter adaptor for the given type.

If the GXF operator has an argument with a custom type, both the argument setter and GXF parameter adaptor must be registered using this method.

The argument setter is used to set the value of the argument from the YAML configuration, and the GXF parameter adaptor is used to set the value of the GXF parameter from the argument value in YAML::Node object.

This method can be called in the initialization phase of the operator (e.g., initialize()). The example below shows how to register the argument setter for the custom type (Vec3):


void MyGXFOp::initialize() { register_converter<Vec3>(); holoscan::ops::GXFOperator::initialize(); }

It is assumed that YAML::convert<T>::encode and YAML::convert<T>::decode are implemented for the given type. You need to specialize the YAML::convert<> template class.

For example, suppose that you had a Vec3 class with the following members:


struct Vec3 { // make sure you have overloaded operator==() for the comparison double x, y, z; };

You can define the YAML::convert<Vec3> as follows in a ‘.cpp’ file:


namespace YAML { template<> struct convert<Vec3> { static Node encode(const Vec3& rhs) { Node node; node.push_back(rhs.x); node.push_back(rhs.y); node.push_back(rhs.z); return node; } static bool decode(const Node& node, Vec3& rhs) { if(!node.IsSequence() || node.size() != 3) { return false; } rhs.x = node[0].as<double>(); rhs.y = node[1].as<double>(); rhs.z = node[2].as<double>(); return true; } }; }

Please refer to the yaml-cpp documentation for more details.

Template Parameters

typeT – The type of the argument to register.

Protected Attributes

gxf_context_t gxf_context_ = nullptr

The GXF context.

gxf_uid_t gxf_eid_ = 0

GXF entity ID.

gxf_uid_t gxf_cid_ = 0

The GXF component ID.

Protected Static Functions

template<typename typeT>
static inline void register_parameter_adaptor()

Register the GXF parameter adaptor for the given type.

Please refer to the documentation of register_converter() for more details.

Template Parameters

typeT – The type of the argument to register.

© Copyright 2022, NVIDIA. Last updated on Mar 20, 2023.