// 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.
//

//! @file IGlobalPass.h
//!
//! @brief Defines @ref omni::graph::exec::unstable::IGlobalPass.
#pragma once

#include <omni/graph/exec/unstable/IPass.h>

namespace omni
{
namespace graph
{
namespace exec
{
namespace unstable
{

// forward declarations needed by interface declaration
class IGraphBuilder;
class IGlobalPass;
class IGlobalPass_abi;

//! Base class for global passes.
//!
//! The purpose of a global pass is to perform global transformations on the graph.
//!
//! This transformation category should be considered as a last resort given its global impact on the topology which
//! prevents threading at the pass pipeline level.
//!
//! See @ref  groupOmniGraphExecPasses for more pass related functionality.
class IGlobalPass_abi : public omni::core::Inherits<IPass, OMNI_TYPE_ID("omni.graph.exec.unstable.IGlobalPass")>
{
protected:
    //! Call from pass pipeline to apply global graph transformations.
    virtual OMNI_ATTR("throw_result") omni::core::Result run_abi(IGraphBuilder* builder) noexcept = 0;
};

//! Smart pointer managing an instance of @ref IGlobalPass.
using GlobalPassPtr = omni::core::ObjectPtr<IGlobalPass>;

} // namespace unstable
} // namespace exec
} // namespace graph
} // namespace omni

// generated API declaration
#define OMNI_BIND_INCLUDE_INTERFACE_DECL
#include <omni/graph/exec/unstable/IGlobalPass.gen.h>

//! @copydoc omni::graph::exec::unstable::IGlobalPass_abi
//!
//! @ingroup  groupOmniGraphExecPasses groupOmniGraphExecInterfaces
class omni::graph::exec::unstable::IGlobalPass
    : public omni::core::Generated<omni::graph::exec::unstable::IGlobalPass_abi>
{
};

// additional headers needed for API implementation
#include <omni/graph/exec/unstable/IGraphBuilder.h>

// generated API implementation
#define OMNI_BIND_INCLUDE_INTERFACE_IMPL
#include <omni/graph/exec/unstable/IGlobalPass.gen.h>
