Class MultiMessageAvailableTimeoutCondition
Defined in File multi_message_available_timeout.hpp
Base Type
public holoscan::gxf::GXFCondition
(Class GXFCondition)
-
class MultiMessageAvailableTimeoutCondition : public holoscan::gxf::GXFCondition
Condition class that allows an operator to execute only when one or more messages are available across the specified input ports or a timeout interval since the previous
compute
call has been reached.This condition applies to a specific set of input ports of the operator as determined by setting the “receivers” argument. It can operate in one of two modes:
“SumOfAll” mode: The condition checks if the sum of messages available across all input ports is greater than or equal to a given threshold. For this mode,
min_sum
should be specified.”PerReceiver” mode: The condition checks if the number of messages available at each input port is greater than or equal to a given threshold. For this mode,
min_sizes
should be specified. This mode is equivalent to assigning individiaul MessageAvailableConditions to each of the receivers.
Note: This condition is typically set via the
Operator::multi_port_condition
method usingConditionType::kMultiMessageAvailableTimeout
. The “receivers” argument must be set based on the input port names as described in the “Parameters” section below.Note: This condition can also be used on a single port as a way to have a message-available condition that also that supports a timeout interval. For this single input port use case, the condition can be added within
Operator::setup
using theIOSpec::condition
method with condition typeConditionType::kMultiMessageAvailableTimeout
. In this case, the input port is already known from theIOSpec
object, so the “receivers” argument is unnecessary.==Parameters==
sampling_mode (std::string or MultiMessageAvailableCondition::SamplingMode) : The mode of operation of this condition (see above). Options are currently “SumOfAll” or “PerReceiver”.
min_sizes (std::vector<size_t>): The condition permits execution if all given receivers have at least the given number of messages available in this list. This option is only intended for use with “PerReceiver”
sampling_mode
. The length ofmin_sizes
must match the number of receivers associated with the condition.min_sum (size_t): The condition permits execution if the sum of message counts of all receivers have at least the given number of messages available. This option is only intended for use with the “SumOfAll”
sampling_mode
.execution_frequency (std::string): The ‘execution frequency’ indicates the amount of time after which the entity will be allowed to execute again, even if the specified number of messages have not yet been received. The period is specified as a string containing of a number and an (optional) unit. If no unit is given, the value is assumed to be in nanoseconds. Supported units are: Hz, s, ms. Examples: “10ms”, “10000000”, “0.2s”, “50Hz”.
receivers (std::vector<std::string>): The receivers whose message queues will be checked. This should be specified by a vector containing the names of the Operator’s input ports the condition will apply to. The Holoscan SDK will then automatically replace the port names with the actual receiver objects at application run time.
Public Types
-
using SamplingMode = nvidia::gxf::SamplingMode
sampling mode to apply to the conditions across the input ports (receivers).
SamplingMode::kSumOfAll - min_sum specified is for the sum of all messages at all receivers SamplingMode::kPerReceiver - min_sizes specified is a minimum size per receiver connected
Public Functions
-
template<typename ArgT, typename ...ArgsT, typename = std::enable_if_t<!std::is_base_of_v<::holoscan::Condition, std::decay_t<ArgT>> && (std::is_same_v<::holoscan::Arg, std::decay_t<ArgT>> || std::is_same_v<::holoscan::ArgList, std::decay_t<ArgT>>)>>
inline explicit MultiMessageAvailableTimeoutCondition(ArgT &&arg, ArgsT&&... args)
-
MultiMessageAvailableTimeoutCondition() = default
-
inline virtual const char *gxf_typename() const override
-
inline std::vector<std::shared_ptr<Receiver>> &receivers()
-
virtual void initialize() override
Initialize the component.
This method is called only once when the component is created for the first time, and use of light-weight initialization.
-
virtual void setup(ComponentSpec &spec) override
Define the condition specification.
- Parameters
spec – The reference to the component specification.
-
nvidia::gxf::MessageAvailableFrequencyThrottler *get() const