// Copyright (c) 2020-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/OmniAttr.h>
#include <omni/core/Interface.h>
#include <omni/core/ResultError.h>

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

#ifndef OMNI_BIND_INCLUDE_INTERFACE_IMPL


//! Base class for all @rstref{ABI-safe <abi-compatibility>} interfaces. Provides references counting and an ABI-safe
//! `dynamic_cast` like mechanism.
//!
//! When defining a new interface, use the @ref Inherits template.
//!
//! When implementing one or more interfaces use the @ref omni::core::Implements template.
//!
//! See @oni_overview to understand the overall design of Omniverse Native Interfaces.
//!
//! @thread_safety All methods in this interface are thread safe.
template <>
class omni::core::Generated<omni::core::IObject_abi> : public omni::core::IObject_abi
{
public:
    OMNI_PLUGIN_INTERFACE("omni::core::IObject")

    //! Returns a pointer to the interface defined by the given type id if this object implements the type id's
    //! interface.
    //!
    //! Objects can support multiple interfaces, even interfaces that are in different inheritance chains.
    //!
    //! The returned object will have @ref omni::core::IObject::acquire() called on it before it is returned, meaning it
    //! is up to the caller to call @ref omni::core::IObject::release() on the returned pointer.
    //!
    //! The returned pointer can be safely `reinterpret_cast<>` to the type id's C++ class.  For example,
    //! "omni.windowing.IWindow" can be cast to `omni::windowing::IWindow`.
    //!
    //! Do not directly use this method, rather use a wrapper function like @ref omni::core::cast() or @ref
    //! omni::core::ObjectPtr::as().
    //!
    //! @thread_safety This method is thread safe.
    void* cast(omni::core::TypeId id) noexcept;

    //! Increments the object's reference count.
    //!
    //! Objects may have multiple reference counts (e.g. one per interface implemented).  As such, it is important that
    //! you call @ref omni::core::IObject::release() on the same pointer from which you called @ref
    //! omni::core::IObject::acquire().
    //!
    //! Do not directly use this method, rather use @ref omni::core::ObjectPtr, which will manage calling @ref
    //! omni::core::IObject::acquire() and @ref omni::core::IObject::release() for you.
    //!
    //! @thread_safety This method is thread safe.
    void acquire() noexcept;

    //! Decrements the objects reference count.
    //!
    //! Most implementations will destroy the object if the reference count reaches 0 (though this is not a
    //! requirement).
    //!
    //! Objects may have multiple reference counts (e.g. one per interface implemented).  As such, it is important that
    //! you call @ref omni::core::IObject::release() on the same pointer from which you called @ref
    //! omni::core::IObject::acquire().
    //!
    //! Do not directly use this method, rather use @ref omni::core::ObjectPtr, which will manage calling @ref
    //! omni::core::IObject::acquire() and @ref omni::core::IObject::release() for you.
    //!
    //! @thread_safety This method is thread safe.
    void release() noexcept;
};

#endif

#ifndef OMNI_BIND_INCLUDE_INTERFACE_DECL

inline void* omni::core::Generated<omni::core::IObject_abi>::cast(omni::core::TypeId id) noexcept
{
    return cast_abi(id);
}

inline void omni::core::Generated<omni::core::IObject_abi>::acquire() noexcept
{
    acquire_abi();
}

inline void omni::core::Generated<omni::core::IObject_abi>::release() noexcept
{
    release_abi();
}

#endif

#undef OMNI_BIND_INCLUDE_INTERFACE_DECL
#undef OMNI_BIND_INCLUDE_INTERFACE_IMPL
