NVIDIA Holoscan SDK v2.8.0
Holoscan v2.8.0

Class ExpiringMessageAvailableCondition

Base Type

class ExpiringMessageAvailableCondition : public holoscan::gxf::GXFCondition

Condition class to allow an operator to execute when a specified number of messages have arrived, or a specified time interval has elapsed since the first message was created.

This condition applies to a specific input port of the operator as determined by setting the “receiver” argument.

This condition can also be set via the Operator::setup method using IOSpec::condition with ConditionType::kExpiringMessageAvailable. In that case, the receiver is already known from the port corresponding to the IOSpec object, so the “receiver” argument is unnecessary.

Note: The max_delay_ns used by this condition type is relative to the timestamp of the oldest message in the receiver queue. Use of this condition requires that the upstream operator emitted a timestamp for at least one message in the queue. Holoscan Operators do not emit a timestamp by default, but only when it is explicitly requested in the Operator::emit call. The built-in operators of the SDK do not currently emit a timestamp, so this condition cannot be easily used with the provided operators. As a potential alternative, please see MultiMessageAvailableTimeoutCondition which can be configured to use a single port and a timeout interval without needing a timestamp. A timestamp is not needed in the case of MultiMessageAvailableTimeoutCondition because the interval measured is the time since the same operator previously ticked.

==Parameters==

  • max_batch_size (int64_t): The maximum number of messages that can arrive before the operator will be considered READY. The operator can still be considered READY with fewer messages once max_delay_ns has elapsed.

  • max_delay_ns (int64_t): The maximum delay to wait from the time of the first message before the operator is considered READY. The units are in nanoseconds. A constructor is also provided which allows setting this via a std::chrono::duration instead.

  • clock (std::shared_ptr<holoscan::Clock>): The clock used by the scheduler to define the flow of time. If not provided, a default-constructed holoscan::RealtimeClock will be used.

  • receiver (std::string): The receiver whose message queue will be checked. This should be specified by the name of the Operator’s input port the condition will apply to. The Holoscan SDK will then automatically replace the port name with the actual receiver object at application run time.

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 ExpiringMessageAvailableCondition(ArgT &&arg, ArgsT&&... args)
ExpiringMessageAvailableCondition() = default
inline explicit ExpiringMessageAvailableCondition(int64_t max_batch_size)
inline ExpiringMessageAvailableCondition(int64_t max_batch_size, int64_t max_delay_ns)
template<typename Rep, typename Period>
inline explicit ExpiringMessageAvailableCondition(int64_t max_batch_size, std::chrono::duration<Rep, Period> max_delay)
inline virtual const char *gxf_typename() const override
inline void receiver(std::shared_ptr<gxf::GXFResource> receiver)
inline std::shared_ptr<gxf::GXFResource> receiver()
virtual void setup(ComponentSpec &spec) override

Define the condition specification.

Parameters

spec – The reference to the component specification.

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.

void max_batch_size(int64_t max_batch_size)
inline int64_t max_batch_size()
void max_delay(int64_t max_delay_ns)

Set max delay.

Note that calling this method doesn’t affect the behavior of the condition once the condition is initialized.

Parameters

max_delay_ns – The integer representing max delay in nanoseconds.

template<typename Rep, typename Period>
inline void max_delay(std::chrono::duration<Rep, Period> max_delay_duration)

Set max delay.

Note that calling this method doesn’t affect the behavior of the condition once the condition is initialized.

Parameters

max_delay_duration – The max delay of type std::chrono::duration.

int64_t max_delay_ns()

Get max delay in nano seconds.

Returns

The minimum time which needs to elapse between two executions (in nano seconds)

nvidia::gxf::ExpiringMessageAvailableSchedulingTerm *get() const

Previous Class Executor
Next Class ExtensionManager
© Copyright 2022-2024, NVIDIA. Last updated on Jan 2, 2025.