NVIDIA Holoscan SDK v0.4.0
Clara Holoscan v0.4.0

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”

Returns

The type name of the GXF component.

inline gxf_context_t gxf_context() const

Get the GXF context object.

Returns

The GXF context object.

inline void gxf_eid(gxf_uid_t gxf_eid)

Set GXF entity ID.

Parameters

gxf_eid – The GXF entity ID.

inline gxf_uid_t gxf_eid() const

Get the GXF entity ID.

Returns

The GXF entity ID.

inline void gxf_cid(gxf_uid_t gxf_cid)

Set the GXF component ID.

Parameters

gxf_cid – The GXF component ID.

inline gxf_uid_t gxf_cid() const

Get the GXF component ID.

Returns

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., <a class="reference internal" href="classholoscan_1_1Operator.html#classholoscan_1_1Operator_1ae3cee7158e7958607f02632e167dd67b" target="_self">initialize()</a>). The example below shows how to register the argument setter for the custom type (Vec3):

Copy
Copied!
            

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

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

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

Copy
Copied!
            

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

You can define the YAML::convert&lt;Vec3&gt; as follows in a ‘.cpp’ file:

Copy
Copied!
            

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 <a class="reference internal" href="#classholoscan_1_1ops_1_1GXFOperator_1a2dd39cf9cd4b63cf3a810b003dbcd946" target="_self">register_converter()</a> for more details.

Template Parameters

typeT – The type of the argument to register.

© Copyright 2022, NVIDIA. Last updated on Jun 28, 2023.