Class Condition
- Defined in File condition.hpp 
Base Type
- public holoscan::Component(Class Component)
Derived Type
- public holoscan::gxf::GXFCondition(Class GXFCondition)
- 
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 Types - 
enum class ConditionComponentType
- Resource type used for the initialization of the resource. - Values: - 
enumerator kNative
- Native condition. 
 - 
enumerator kGXF
- GXF condition (scheduling term). 
 
- 
enumerator kNative
 - 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 virtual void check(int64_t timestamp, SchedulingStatusType *status_type, int64_t *target_timestamp) const
- Check the condition status before allowing execution. - If the condition is waiting for a time event ‘target_timestamp’ will contain the target timestamp. - Parameters
- timestamp – The current timestamp 
- status_type – The status of the condition 
- target_timestamp – The target timestamp (used if the term is waiting for a time event). 
 
 
 - 
inline virtual void on_execute(int64_t timestamp)
- Called each time after the entity of this term was executed. - Parameters
- timestamp – The current timestamp 
 
 - 
inline virtual void update_state(int64_t timestamp)
- Checks if the state of the condition can be updated and updates it. - Parameters
- timestamp – The current timestamp 
 
 - 
inline ConditionComponentType condition_type() const
- Get the condition type. - Returns
- The condition type. 
 
 - 
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. 
 
 - 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. 
 
 - Get the shared pointer to the component spec. - Returns
- The shared pointer to the component spec. 
 
 - Add a resource to the condition. - Parameters
- arg – The resource to add. 
 
 - 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 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 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. 
 
 - 
std::optional<std::shared_ptr<Receiver>> receiver(const std::string &port_name)
- Return the Receiver corresponding to a specific input port of the Operator associated with this condition. - Parameters
- port_name – The name of the input port. 
- Returns
- The Receiver corresponding to the input port, if it exists. Otherwise, return nullopt. 
 
 - 
std::optional<std::shared_ptr<Transmitter>> transmitter(const std::string &port_name)
- Return the Transmitter corresponding to a specific output port of the Operator associated with this condition. - Parameters
- port_name – The name of the output port. 
- Returns
- The Transmitter corresponding to the output port, if it exists. Otherwise, return nullopt. 
 
 - 
int64_t wrapper_cid() const
- Get the component ID of a native Condition in the underlying backend. - This may not be used by all backends. - In the case of GXF, this is the gxf_uid_t (alias for int64_t) of the GXFSchedulingTermWrapper component that is used to wrap the native condition as a GXF SchedulingTerm. - This method is only relevant for native conditions. For conditions inheriting from GXFCondition, please just use GXFCondition::gxf_cid() instead. - Returns
- The unique GXF component id for this condition. 
 
 - 
virtual void set_parameters() override
- Set the parameters based on defaults (sets GXF parameters for GXF components) 
 - Protected Functions - 
inline void set_operator(Operator *op)
- Set the Operator this condition is associated with. - Parameters
- op – The pointer to the Operator object. 
 
 - 
void wrapper_cid(int64_t cid)
- Store the component ID for this condition in the underlying backend implementation. - This method may not be needed for all backends. - Parameters
- cid – component id corresponding to the underlying framework 
 
 - 
void update_params_from_args()
- Update parameters based on the specified arguments. 
 - 
void update_params_from_args(std::unordered_map<std::string, ParameterWrapper> ¶ms)
- Update parameters based on the specified arguments. 
 - 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. 
 - 
ConditionComponentType condition_type_ = ConditionComponentType::kNative
- The type of the component. 
 - 
Operator *op_ = nullptr
- The operator this condition is associated with. 
 - 
int64_t wrapper_cid_ = 0
- Component ID of underlying GXFSchedulingTermWrapper. 
 - Friends - friend class holoscan::Operator
 
- 
enum class ConditionComponentType