Class Condition

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<Condition, std::decay_t<ArgT>> && (std::is_same_v<Arg, std::decay_t<ArgT>> || std::is_same_v<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.

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.

inline const std::string &name() const

Get the name of the component.

Returns

The name of the component.

inline Fragment *fragment()

Get a pointer to Fragment object.

Returns

The Pointer to Fragment object.

inline void add_arg(const Arg &arg)

Add an argument to the component.

Parameters

arg – The argument to add.

inline void add_arg(Arg &&arg)

Add an argument to the component.

Parameters

arg – The argument to add.

inline void add_arg(const ArgList &arg)

Add a list of arguments to the component.

Parameters

arg – The list of arguments to add.

inline void add_arg(ArgList &&arg)

Add a list of arguments to the component.

Parameters

arg – The list of arguments to add.

Protected Attributes

std::shared_ptr<ComponentSpec> spec_

The component specification.

bool is_initialized_ = false

Whether the condition is initialized.

© Copyright 2022-2023, NVIDIA. Last updated on Sep 13, 2023.