holoscan::Message

Beta
View as Markdown

Class to define a message.

A message is a data structure that is used to pass data between operators. It wraps a std::any object and provides a type-safe interface to access the data.

This class is used by the holoscan::gxf::GXFWrapper to support the Holoscan native operator. The holoscan::gxf::GXFWrapper will hold the object of this class and delegate the message to the Holoscan native operator.

#include <holoscan/message.hpp>

Constructors

Message

holoscan::Message::Message() = defaultholoscan::Message::Message() = default

Construct a new Message object.


Methods

set_value

template <typename ValueT>
void holoscan::Message::set_value(
ValueT &&value
)

Set the value object.

Template parameters

ValueT
typename

The type of the value.

Parameters

value
ValueT &&

The value to be wrapped by the message.

value

std::any holoscan::Message::value() const

Get the value object.

Returns: The value wrapped by the message.

as

template <typename ValueT>
std::shared_ptr<ValueT> holoscan::Message::as() const

Get the value object as a shared_ptr to a specific type.

This method can only be used when the std::any value is a shared pointer to the specified type.

Returns: The value wrapped by the message.

Template parameters

ValueT
typename

The type of the value to be returned in the shared pointer.


Member variables

NameTypeDescription
value_std::anyThe value wrapped by the message.