holoscan::OperatorSpec

Beta
View as Markdown

Class to define the specification of an operator.

#include <holoscan/operator_spec.hpp>

Inherits from: holoscan::ComponentSpec (public)


Constructors

OperatorSpec

holoscan::OperatorSpec::OperatorSpec(holoscan::OperatorSpec::OperatorSpec(
Fragment *fragment = nullptr
)

Construct a new OperatorSpec object.

Parameters

fragment
Fragment *Defaults to nullptr

The pointer to the fragment that contains this operator.

Destructor

~OperatorSpec

virtual holoscan::OperatorSpec::~OperatorSpec() = defaultvirtual holoscan::OperatorSpec::~OperatorSpec() = default

Methods

inputs

std::unordered_map<std::string, std::shared_ptr<IOSpec>> & holoscan::OperatorSpec::inputs()std::unordered_map<std::string, std::shared_ptr<IOSpec>> & holoscan::OperatorSpec::inputs()

Get input specifications of this operator.

Returns: The reference to the input specifications of this operator.

input

template <typename DataT>
IOSpec & holoscan::OperatorSpec::input()IOSpec & holoscan::OperatorSpec::input()

Define an input specification for this operator.

Returns: The reference to the input specification.

Template parameters

DataT
typename

The type of the input data.

multi_port_condition

void holoscan::OperatorSpec::multi_port_condition(
ConditionType kind,
const std::vector<std::string> &port_names,
ArgList args
)

Add a Condition that depends on the status of multiple input ports.

Parameters

kind
ConditionType

The type of multi-message condition (currently only kMultiMessageAvailable)

port_names
const std::vector<std::string> &

The names of the input ports the condition will apply to

args
ArgList

ArgList of arguments to pass to the MultiMessageAvailableCondition

multi_port_conditions

std::vector<MultiMessageConditionInfo> & holoscan::OperatorSpec::multi_port_conditions()std::vector<MultiMessageConditionInfo> & holoscan::OperatorSpec::multi_port_conditions()

or_combine_port_conditions

void holoscan::OperatorSpec::or_combine_port_conditions(
const std::vector<std::string> &port_names
)

Assign the conditions on the specified input ports to be combined with an OR operation.

This is intended to allow using OR instead of AND combination of single-port conditions like MessageAvailableCondition for the specified input ports.

Parameters

port_names
const std::vector<std::string> &

The names of the input ports whose conditions will be OR combined.

or_combiner_port_names

std::vector<std::vector<std::string>> & holoscan::OperatorSpec::or_combiner_port_names()

vector of the names of ports for each OrConditionCombiner

device_input

IOSpec & holoscan::OperatorSpec::device_input(IOSpec & holoscan::OperatorSpec::device_input(
std::string name,
size_t memory_block_size
)

Define an input specification for this operator with a memory block size.

It is only applicable for GPU-resident operators.

The executor will allocate a shared device memory buffer of the specified size for this port and the connected output port. Both ports will map to the same device memory address. Integer literals (e.g. 0, 1024) and size_t values resolve to this overload.

Returns: The reference to the input specification.

Parameters

name
std::string

The name of the input specification.

memory_block_size
size_t

The device memory block size in bytes.

outputs

std::unordered_map<std::string, std::shared_ptr<IOSpec>> & holoscan::OperatorSpec::outputs()std::unordered_map<std::string, std::shared_ptr<IOSpec>> & holoscan::OperatorSpec::outputs()

Get output specifications of this operator.

Returns: The reference to the output specifications of this operator.

input_output_unique_id

const std::string & holoscan::OperatorSpec::input_output_unique_id(
const std::string &name
) const

Return the unique_id for a port name by checking inputs first, then outputs.

If a port with the same name exists in both inputs and outputs, an exception is thrown. If the port does not exist in either, an exception is thrown.

Returns: const std::string& The unique_id corresponding to the found port.

Parameters

name
const std::string &

The port name to look up.

output

template <typename DataT>
IOSpec & holoscan::OperatorSpec::output()IOSpec & holoscan::OperatorSpec::output()

Define an output specification for this operator.

Returns: The reference to the output specification.

Template parameters

DataT
typename

The type of the output data.

device_output

IOSpec & holoscan::OperatorSpec::device_output(IOSpec & holoscan::OperatorSpec::device_output(
std::string name,
size_t memory_block_size
)

Define an output specification for this operator with a memory block size.

It is only applicable for GPU-resident operators.

The executor will allocate a shared device memory buffer of the specified size for this port and the connected input port. Both ports will map to the same device memory address. Integer literals (e.g. 0, 1024) and size_t values resolve to this overload.

Returns: The reference to the output specification.

Parameters

name
std::string

The name of the output specification.

memory_block_size
size_t

The device memory block size in bytes.

param

inline
void holoscan::OperatorSpec::param(
Parameter<holoscan::IOSpec *> &parameter,
const char *key,
const char *headline,
const char *description,
ParameterFlag flag = ParameterFlag::kNone
)

Define an IOSpec* parameter for this operator.

Parameters

parameter
Parameter<holoscan::IOSpec *> &

The parameter to define.

key
const char *

The key (name) of the parameter.

headline
const char *

The headline of the parameter.

description
const char *

The description of the parameter.

flag
ParameterFlagDefaults to ParameterFlag::kNone

The flag of the parameter (default: ParameterFlag::kNone).

to_yaml_node

YAML::Node holoscan::OperatorSpec::to_yaml_node() const override

Get a YAML representation of the operator spec.

Returns: YAML node including the inputs, outputs, and parameters of this operator.

fragment

void holoscan::OperatorSpec::fragment(
Fragment *fragment
)

Set the pointer to the fragment that contains this component.

Parameters

fragment
Fragment *

The pointer to the fragment that contains this component.

params

std::unordered_map<std::string, ParameterWrapper> & holoscan::OperatorSpec::params()std::unordered_map<std::string, ParameterWrapper> & holoscan::OperatorSpec::params()

Get the parameters of this component.

Returns: The reference to the parameters of this component.

description

std::string holoscan::OperatorSpec::description() const

Get a description of the component spec.

Returns: YAML string.

See also: to_yaml_node()


Member variables

NameTypeDescription
inputs_std::unordered_map< std::string, std::shared_ptr< IOSpec > >Input specs.
outputs_std::unordered_map< std::string, std::shared_ptr< IOSpec > >Outputs specs.
multi_port_conditions_std::vector< MultiMessageConditionInfo >
or_combiner_port_names_std::vector< std::vector< std::string > >
receivers_params_std::list< Parameter< std::vector< IOSpec * > > >Container for receivers parameters.
fragment_Fragment *The pointer to the fragment that contains this component.
params_std::unordered_map< std::string, ParameterWrapper >The parameters of this component.