// Copyright (c) 2023, NVIDIA CORPORATION. All rights reserved.
//
// NVIDIA CORPORATION and its licensors retain all intellectual property
// and proprietary rights in and to this software, related documentation
// and any modifications thereto. Any use, reproduction, disclosure or
// distribution of this software and related documentation without an express
// license agreement from NVIDIA CORPORATION is strictly prohibited.
//
// --------- Warning: This is a build system generated file. ----------
//

//! @file
//!
//! @brief This file was generated by <i>omni.bind</i>.

#include <omni/core/Interface.h>
#include <omni/core/OmniAttr.h>
#include <omni/core/ResultError.h>

#include <functional>
#include <type_traits>
#include <utility>

#ifndef OMNI_BIND_INCLUDE_INTERFACE_IMPL


/**
 * @brief Functions for implementing nodes which are used in `Action Graph`.
 *
 * Nodes in `Action Graph` have special functionality which is not present in other graph types.
 */
template <>
class omni::core::Generated<omni::graph::action::IActionGraph_abi> : public omni::graph::action::IActionGraph_abi
{
public:
    OMNI_PLUGIN_INTERFACE("omni::graph::action::IActionGraph")

    /**
     * @brief Indicate that the given output attribute should be enabled, so that execution flow should continue
     * along downstream networks.
     *
     * @note This should only be called from within a node @c compute function.
     *
     * @param[in] attributeName attribute on the current node to be set
     * @param[in] instanceIdx In vectorized context, the instance index relative to the currently targeted graph
     *
     * @return Success if executed successfully
     */
    omni::core::Result setExecutionEnabled(omni::graph::core::NameToken attributeName,
                                           omni::graph::core::InstanceIndex instanceIdx) noexcept;

    /**
     * @brief  Indicate that the given output attribute should be enabled, and the current node should be pushed to the
     * execution @c stack. This means that when the downstream execution flow has completed, this node will be
     * @c popped from the execution stack and its @c compute function will be called again.
     *
     * @note This should only be called from within a node @c compute function.
     *
     * @param[in] attributeName attribute on the current node to be set
     * @param[in] instanceIdx In vectorized context, the instance index relative to the currently targeted graph
     *
     * @return Success if executed successfully
     */
    omni::core::Result setExecutionEnabledAndPushed(omni::graph::core::NameToken attributeName,
                                                    omni::graph::core::InstanceIndex instanceIdx) noexcept;

    /**
     * @brief Indicate that the current execution flow should be blocked at the given node, and the node should be
     * @c ticked every update of the Graph (@c compute function called), until it calls \ref endLatentState_abi.
     *
     * @note This should only be called from within a node @c compute function.
     *
     * @param[in] instanceIdx In vectorized context, the instance index relative to the currently targeted graph
     *
     * @return Success if executed successfully
     */
    omni::core::Result startLatentState(omni::graph::core::InstanceIndex instanceIdx) noexcept;

    /**
     * @brief Indicate that the current execution flow should be un-blocked at the given node, if it is currently in a
     * latent state. It is an error to call this function before calling \ref startLatentState_abi.
     *
     * @note This should only be called from within a node @c compute function.
     *
     * @param[in] instanceIdx In vectorized context, the instance index relative to the currently targeted graph
     *
     * @return Success if executed successfully
     */
    omni::core::Result endLatentState(omni::graph::core::InstanceIndex instanceIdx) noexcept;

    /**
     * @brief Read the current latent state of the node. This state is set using \ref startLatentState_abi and \ref
     * endLatentState_abi
     *
     * @note This should only be called from within a node @c compute function.
     *
     * @param[in] instanceIdx In vectorized context, the instance index relative to the currently targeted graph
     * @returns true if the node is currently in a latent state
     *
     * @return false if the node is not in a latent state, or the call failed
     */
    bool getLatentState(omni::graph::core::InstanceIndex instanceIdx) noexcept;

    /**
     * @brief Read the enabled state of an input execution attribute. An input attribute is considered enabled if it is
     * connected to the upstream node that was computed immediately prior to the currently computing node. Event nodes
     * and nodes in latent state may not have any enabled input.
     *
     * @note This should only be called from within a node @c compute function.
     *
     * @param[in] attributeName attribute on the current node to be set
     * @param[in] instanceIdx In vectorized context, the instance index relative to the currently targeted graph
     * @returns true if the given attribute is considered enabled.
     *
     * @return false if the attribute is considered disabled or the call failed
     */
    bool getExecutionEnabled(omni::graph::core::NameToken attributeName,
                             omni::graph::core::InstanceIndex instanceIdx) noexcept;
};

#endif

#ifndef OMNI_BIND_INCLUDE_INTERFACE_DECL

inline omni::core::Result omni::core::Generated<omni::graph::action::IActionGraph_abi>::setExecutionEnabled(
    omni::graph::core::NameToken attributeName, omni::graph::core::InstanceIndex instanceIdx) noexcept
{
    return setExecutionEnabled_abi(attributeName, instanceIdx);
}

inline omni::core::Result omni::core::Generated<omni::graph::action::IActionGraph_abi>::setExecutionEnabledAndPushed(
    omni::graph::core::NameToken attributeName, omni::graph::core::InstanceIndex instanceIdx) noexcept
{
    return setExecutionEnabledAndPushed_abi(attributeName, instanceIdx);
}

inline omni::core::Result omni::core::Generated<omni::graph::action::IActionGraph_abi>::startLatentState(
    omni::graph::core::InstanceIndex instanceIdx) noexcept
{
    return startLatentState_abi(instanceIdx);
}

inline omni::core::Result omni::core::Generated<omni::graph::action::IActionGraph_abi>::endLatentState(
    omni::graph::core::InstanceIndex instanceIdx) noexcept
{
    return endLatentState_abi(instanceIdx);
}

inline bool omni::core::Generated<omni::graph::action::IActionGraph_abi>::getLatentState(
    omni::graph::core::InstanceIndex instanceIdx) noexcept
{
    return getLatentState_abi(instanceIdx);
}

inline bool omni::core::Generated<omni::graph::action::IActionGraph_abi>::getExecutionEnabled(
    omni::graph::core::NameToken attributeName, omni::graph::core::InstanceIndex instanceIdx) noexcept
{
    return getExecutionEnabled_abi(attributeName, instanceIdx);
}

#endif

#undef OMNI_BIND_INCLUDE_INTERFACE_DECL
#undef OMNI_BIND_INCLUDE_INTERFACE_IMPL
