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


//! Registry (database) of known @ref omni::graph::exec::unstable::IPass objects.
//!
//! When registering passes, prefer using @ref groupOmniGraphExecPassRegistration helpers rather than directly accessing
//! methods on this interface.
//!
//! See @ref  groupOmniGraphExecPasses for more pass related functionality.
template <>
class omni::core::Generated<omni::graph::exec::unstable::IPassRegistry_abi>
    : public omni::graph::exec::unstable::IPassRegistry_abi
{
public:
    OMNI_PLUGIN_INTERFACE("omni::graph::exec::unstable::IPassRegistry")

    //! Registers a new pass.
    //!
    //! @p type is th type of pass being registered (e.g. populate, partition, etc).
    //!
    //! @p name is the name of the pass. This name is used to deregister the pass (see @ref
    //! omni::graph::exec::unstable::IPassRegistry::deregisterPass) so the name should be unique within this registry.
    //! Must not be `nullptr`.
    //!
    //! @p factory is the interface that will instantiate the pass. Must not be `nullptr`.
    //!
    //! Some pass types (e.g. populate passes) desire to affect only a subset of the nodes and/or definitions in a
    //! graph. @p nameToMatch is used to specify the name of the node/definitions the pass wishes to affect. The meaning
    //! of this field is pass type dependent. Many pass types ignore @p nameToMatch. Must not be `nullptr`. This method
    //! copies the name.
    //!
    //! Some pass types (e.g. partition passes) are designed such that only a single pass should affect an entity. When
    //! multiple passes wish to affect an entity, @p priority can be used to resolve the conflict. The meaning of the
    //! priority value is pass type specific. Many pass types ignore @p priority.
    //!
    //! When registering passes, prefer using @ref groupOmniGraphExecPassRegistration helpers rather than directly
    //! accessing this method.
    bool registerPass(omni::graph::exec::unstable::PassType passType,
                      const char* name,
                      omni::core::ObjectParam<omni::graph::exec::unstable::IPassFactory> factory,
                      const omni::graph::exec::unstable::ConstName& nameToMatch,
                      omni::graph::exec::unstable::PassPriority priority);

    //! Deregisters a pass.
    //!
    //! Returns @c true if the pass was found and removed. Returns @c false if the pass could not be found.
    //!
    //! If multiple passes were registered with the same name, this method will only remove one of them.
    //!
    //! When deregistering passes, prefer using @ref groupOmniGraphExecPassRegistration helpers rather than directly
    //! accessing this method.
    bool deregisterPass(omni::graph::exec::unstable::PassType passType, const char* name);

    //! Returns a sub-registry containing pass of the specified type.
    //!
    //! The returned @ref omni::graph::exec::unstable::IPassTypeRegistry will *not* have
    //! @ref omni::core::IObject::acquire() called before being returned.
    omni::graph::exec::unstable::IPassTypeRegistry* getPassTypeRegistry(omni::graph::exec::unstable::PassType type) noexcept;

    //! Returns version stamp for the registry.
    //!
    //! Version is incremented each time the content of registry changes, i.e. pass is added or removed.
    omni::graph::exec::unstable::Stamp getStamp() noexcept;
};

#endif

#ifndef OMNI_BIND_INCLUDE_INTERFACE_DECL

inline bool omni::core::Generated<omni::graph::exec::unstable::IPassRegistry_abi>::registerPass(
    omni::graph::exec::unstable::PassType passType,
    const char* name,
    omni::core::ObjectParam<omni::graph::exec::unstable::IPassFactory> factory,
    const omni::graph::exec::unstable::ConstName& nameToMatch,
    omni::graph::exec::unstable::PassPriority priority)
{
    OMNI_THROW_IF_ARG_NULL(name);
    OMNI_THROW_IF_ARG_NULL(factory);
    auto return_ = registerPass_abi(passType, name, factory.get(), &nameToMatch, priority);
    return return_;
}

inline bool omni::core::Generated<omni::graph::exec::unstable::IPassRegistry_abi>::deregisterPass(
    omni::graph::exec::unstable::PassType passType, const char* name)
{
    OMNI_THROW_IF_ARG_NULL(name);
    auto return_ = deregisterPass_abi(passType, name);
    return return_;
}

inline omni::graph::exec::unstable::IPassTypeRegistry* omni::core::Generated<
    omni::graph::exec::unstable::IPassRegistry_abi>::getPassTypeRegistry(omni::graph::exec::unstable::PassType type) noexcept
{
    return getPassTypeRegistry_abi(type);
}

inline omni::graph::exec::unstable::Stamp omni::core::Generated<omni::graph::exec::unstable::IPassRegistry_abi>::getStamp() noexcept
{
    return getStamp_abi();
}

#endif

#undef OMNI_BIND_INCLUDE_INTERFACE_DECL
#undef OMNI_BIND_INCLUDE_INTERFACE_IMPL
