Class Condition

Holoscan v2.2.0

Base Type

Derived Type

class Condition : public holoscan::Component

Base class for all conditions.

A condition is a predicate that can be evaluated at runtime to determine if an operator should execute. This matches the semantics of GXF’s Scheduling Term.

Subclassed by holoscan::gxf::GXFCondition

Public Functions

Condition() = default
Condition(Condition&&) = default
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 Condition(ArgT &&arg, ArgsT&&... args)

Construct a new Condition object.

~Condition() override = default
inline Condition &name(const std::string &name) &

Set the name of the condition.

Parameters

name – The name of the condition.

Returns

The reference to the condition.

inline Condition &&name(const std::string &name) &&

Set the name of the condition.

Parameters

name – The name of the condition.

Returns

The reference to the condition.

inline Condition &fragment(Fragment *fragment)

Set the fragment of the condition.

Parameters

fragment – The pointer to the fragment of the condition.

Returns

The reference to the condition.

inline Condition &spec(const std::shared_ptr<ComponentSpec> &spec)

Set the component specification to the condition.

Parameters

spec – The component specification.

Returns

The reference to the condition.

inline ComponentSpec *spec()

Get the component specification of the condition.

Returns

The pointer to the component specification.

inline std::shared_ptr<ComponentSpec> spec_shared()

Get the shared pointer to the component spec.

Returns

The shared pointer to the component spec.

void add_arg(const std::shared_ptr<Resource> &arg)

Add a resource to the condition.

Parameters

arg – The resource to add.

void add_arg(std::shared_ptr<Resource> &&arg)

Add a resource to the condition.

Parameters

arg – The resource to add.

inline std::unordered_map<std::string, std::shared_ptr<Resource>> &resources()

Get the resources of the condition.

Returns

The resources of the condition.

inline virtual void setup(ComponentSpec &spec)

Define the condition specification.

Parameters

spec – The reference to the component specification.

virtual YAML::Node to_yaml_node() const override

Get a YAML representation of the condition.

Returns

YAML node including spec of the condition in addition to the base component properties.

Protected Attributes

bool is_initialized_ = false

Whether the condition is initialized.

std::unordered_map<std::string, std::shared_ptr<Resource>> resources_

The resources used by the condition.

Friends

friend class holoscan::Operator

Previous Class ComponentSpec
Next Class Config
© Copyright 2022-2024, NVIDIA. Last updated on Jul 17, 2024.