// Copyright (c) 2022-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


//! @ref omni::kit::exec::core::unstable::IExecutionController encapsulates a @ref omni::graph::exec::unstable::IGraph
//! which orchestrates the computation for one of Kit's @c UsdContext.
//!
//! See @ref omni::kit::exec::core::unstable::IExecutionControllerFactory.
template <>
class omni::core::Generated<omni::kit::exec::core::unstable::IExecutionController_abi>
    : public omni::kit::exec::core::unstable::IExecutionController_abi
{
public:
    OMNI_PLUGIN_INTERFACE("omni::kit::exec::core::unstable::IExecutionController")

    //! Populates or updates the internal @ref omni::graph::exec::unstable::IGraph.
    void compile();

    //! Searches for the @ref omni::graph::exec::unstable::IDef and executes it.  Useful for on-demand execution.
    //!
    //! @p *outExecuted is update to @c true if execution was successful, @c false otherwise.
    //!
    //! An exception will be thrown for all internal errors (e.g. memory allocation failures).
    //!
    //! This method is not thread safe, only a single thread should call this method at any given time.
    bool executeDefinition(omni::core::ObjectParam<omni::graph::exec::unstable::IDef> execDef);

    //! Executes the internal graph at the given time.
    //!
    //! @p *outExecuted is update to @c true if execution was successful, @c false otherwise.
    //!
    //! An exception will be thrown for all internal errors (e.g. memory allocation failures).
    //!
    //! This method is not thread safe, only a single thread should call this method at any given time.
    bool execute(double currentTime,
                 float elapsedSecs,
                 double absoluteSimTime,
                 const omni::kit::StageUpdateSettings* updateSettings);

    //! Returns the context owned by this controller
    //!
    //! The returned @ref omni::kit::exec::core::unstable::IExecutionContext will *not* have @ref
    //! omni::core::IObject::acquire() called before being returned.
    omni::kit::exec::core::unstable::IExecutionContext* getContext() noexcept;

    //! Returns the graph owned by this controller
    //!
    //! The returned @ref omni::graph::exec::unstable::IGraph will *not* have @ref
    //! omni::core::IObject::acquire() called before being returned.
    omni::graph::exec::unstable::IGraph* getGraph() noexcept;
};

#endif

#ifndef OMNI_BIND_INCLUDE_INTERFACE_DECL

inline void omni::core::Generated<omni::kit::exec::core::unstable::IExecutionController_abi>::compile()
{
    OMNI_THROW_IF_FAILED(compile_abi());
}

inline bool omni::core::Generated<omni::kit::exec::core::unstable::IExecutionController_abi>::executeDefinition(
    omni::core::ObjectParam<omni::graph::exec::unstable::IDef> execDef)
{
    OMNI_THROW_IF_ARG_NULL(execDef);
    bool outExecuted;
    OMNI_THROW_IF_FAILED(executeDefinition_abi(execDef.get(), &outExecuted));
    return outExecuted;
}

inline bool omni::core::Generated<omni::kit::exec::core::unstable::IExecutionController_abi>::execute(
    double currentTime, float elapsedSecs, double absoluteSimTime, const omni::kit::StageUpdateSettings* updateSettings)
{
    bool outExecuted;
    OMNI_THROW_IF_FAILED(execute_abi(currentTime, elapsedSecs, absoluteSimTime, updateSettings, &outExecuted));
    return outExecuted;
}

inline omni::kit::exec::core::unstable::IExecutionContext* omni::core::Generated<
    omni::kit::exec::core::unstable::IExecutionController_abi>::getContext() noexcept
{
    return getContext_abi();
}

inline omni::graph::exec::unstable::IGraph* omni::core::Generated<
    omni::kit::exec::core::unstable::IExecutionController_abi>::getGraph() noexcept
{
    return getGraph_abi();
}

#endif

#undef OMNI_BIND_INCLUDE_INTERFACE_DECL
#undef OMNI_BIND_INCLUDE_INTERFACE_IMPL
