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


//! Describes a node @ref omni::graph::exec::unstable::IGraphBuilder can manipulate.
//!
//! Only @ref omni::graph::exec::unstable::IGraphBuilder should use @ref omni::graph::exec::unstable::IGraphBuilderNode.
//! One way to think about this interface is that it is a private interface used by
//! @ref omni::graph::exec::unstable::IGraphBuilder to connect instances of @ref omni::graph::exec::unstable::INode.
template <>
class omni::core::Generated<omni::graph::exec::unstable::IGraphBuilderNode_abi>
    : public omni::graph::exec::unstable::IGraphBuilderNode_abi
{
public:
    OMNI_PLUGIN_INTERFACE("omni::graph::exec::unstable::IGraphBuilderNode")

    //! Adds the given node as a parent (i.e. upstream) of this node.
    //!
    //! @ref omni::core::IObject::acquire() is not called on the given node.  It is up to the calling code to ensure the
    //! node persists while in use by this interface.
    //!
    //! @p parent must not be @c nullptr.
    //!
    //! It is undefined behavior to add a parent multiple times to a node.
    //!
    //! This method is not thread safe.
    //!
    //! May throw.
    void _addParent(omni::core::ObjectParam<omni::graph::exec::unstable::IGraphBuilderNode> parent);

    //! Removes the given node as a parent.
    //!
    //! If given node is not a parent, this method returns success.
    //!
    //! This method is not thread safe.
    //!
    //! May throw.
    void _removeParent(omni::core::ObjectParam<omni::graph::exec::unstable::IGraphBuilderNode> parent);

    //! Adds the given node as a child (i.e. downstream) of this node.
    //!
    //! @ref omni::core::IObject::acquire() is not called on the given node.  It is up to the calling code to ensure the
    //! node persists while in use by this interface.
    //!
    //! @p child must not be @c nullptr.
    //!
    //! It is undefined behavior to add a child multiple times to a node.
    //!
    //! This method is not thread safe.
    //!
    //! May throw.
    void _addChild(omni::core::ObjectParam<omni::graph::exec::unstable::IGraphBuilderNode> child);

    //! Removes the given node as a child.
    //!
    //! If given node is not a child, this method returns success.
    //!
    //! This method is not thread safe.
    //!
    //! May throw.
    void _removeChild(omni::core::ObjectParam<omni::graph::exec::unstable::IGraphBuilderNode> child);

    //! Remove from the container parent nodes that no longer exist in current topology, i.e are invalid.
    //!
    //! @ref omni::core::IObject::release() is not called on the invalid nodes.
    //!
    //! This method is not thread safe.
    void _removeInvalidParents() noexcept;

    //! Remove from the container child nodes that no longer exist in current topology, i.e are invalid.
    //!
    //! @ref omni::core::IObject::release() is not called on the invalid nodes.
    //!
    //! This method is not thread safe.
    void _removeInvalidChildren() noexcept;

    //! Invalidate all children and parents connections by invalidating the topology this node is sync with.
    //!
    //! This method is thread safe.
    void _invalidateConnections() noexcept;

    //! Sets the number of parents who are a part of cycle.
    //!
    //! This method is not thread safe.
    void setCycleParentCount(uint32_t count) noexcept;

    //! Sets the definition for this node.
    //!
    //! If a definition is already set, it will be replaced by the given definition.
    //!
    //! The given definition may be @c nullptr.
    //!
    //! @ref omni::core::IObject::acquire() is called on the given pointer.
    //!
    //! See also  @ref omni::graph::exec::unstable::IGraphBuilderNode::_setNodeGraphDef().
    //!
    //! This method is not thread safe.
    void _setNodeDef(omni::core::ObjectParam<omni::graph::exec::unstable::INodeDef> nodeDef) noexcept;

    //! Sets the definition for this node.
    //!
    //! If a definition is already set, it will be replaced by the given definition.
    //!
    //! The given definition may be @c nullptr.
    //!
    //! @ref omni::core::IObject::acquire() is called on the given pointer.
    //!
    //! See also  @ref omni::graph::exec::unstable::IGraphBuilderNode::_setNodeDef().
    //!
    //! This method is not thread safe.
    void _setNodeGraphDef(omni::core::ObjectParam<omni::graph::exec::unstable::INodeGraphDef> nodeGraphDef) noexcept;

    //! Unsets this node's definition.
    //!
    //! If the definition is already @c nullptr, this method does nothing.
    //!
    //! This method is not thread safe.
    void _clearDef() noexcept;

    //! Access the topology owning this node.
    //!
    //! The returned @ref omni::graph::exec::unstable::ITopology will *not* have
    //! @ref omni::core::IObject::acquire() called before being returned.
    //!
    //! This method is not thread safe.
    omni::graph::exec::unstable::ITopology* getTopology() noexcept;

    //! Make topology valid for current topology version. Drop all the connections if topology changed.
    //!
    //! This method is not thread safe.
    void validateOrResetTopology() noexcept;

    //! Access parent at the given index.
    //!
    //! If the given index is greater than the parent count, an error is returned.
    //!
    //! This method is not thread safe.
    //!
    //! May throw due to internal casting.
    //!
    //! See @ref omni::graph::exec::unstable::IGraphBuilderNode::getParentCount().
    //!
    //! Consider using @ref omni::graph::exec::unstable::IGraphBuilderNode::getParents()
    //! for a modern C++ wrapper to this method.
    //!
    //! The returned @ref omni::graph::exec::unstable::IGraphBuilderNode will *not* have
    //! @ref omni::core::IObject::acquire() called before being returned.
    omni::graph::exec::unstable::IGraphBuilderNode* getParentAt(uint64_t index);

    //! Returns the number of parents.
    //!
    //! This method is not thread safe.
    uint64_t getParentCount() noexcept;

    //! Access child at the given index.
    //!
    //! If the given index is greater than the parent count, an error is returned.
    //!
    //! This method is not thread safe.
    //!
    //! May throw due to internal casting.
    //!
    //! See @ref omni::graph::exec::unstable::IGraphBuilderNode::getChildCount().
    //!
    //! Consider using @ref omni::graph::exec::unstable::IGraphBuilderNode::getChildren()
    //! for a modern C++ wrapper to this method.
    //!
    //! The returned @ref omni::graph::exec::unstable::IGraphBuilderNode will *not* have
    //! @ref omni::core::IObject::acquire() called before being returned.
    omni::graph::exec::unstable::IGraphBuilderNode* getChildAt(uint64_t index);

    //! Returns the number of children.
    //!
    //! This method is not thread safe.
    uint64_t getChildCount() noexcept;

    //! Returns @c true if the given node is an immediate child of this node.
    //!
    //! @p node may be @c nullptr.
    //!
    //! This method is not thread safe.
    bool hasChild(omni::core::ObjectParam<omni::graph::exec::unstable::IGraphBuilderNode> node) noexcept;

    //! Returns @c true if this node is the root of the topology.
    //!
    //! This method is not thread safe.
    bool isRoot() noexcept;

    //! Returns the root node of the topology of which this node is a part.
    //!
    //! This method is not thread safe.
    //!
    //! May throw due to internal casting.
    //!
    //! The returned @ref omni::graph::exec::unstable::IGraphBuilderNode will *not* have
    //! @ref omni::core::IObject::acquire() called before being returned.
    omni::core::Result getRoot(omni::graph::exec::unstable::IGraphBuilderNode** out);
};

#endif

#ifndef OMNI_BIND_INCLUDE_INTERFACE_DECL

inline void omni::core::Generated<omni::graph::exec::unstable::IGraphBuilderNode_abi>::_addParent(
    omni::core::ObjectParam<omni::graph::exec::unstable::IGraphBuilderNode> parent)
{
    OMNI_THROW_IF_ARG_NULL(parent);
    OMNI_THROW_IF_FAILED(_addParent_abi(parent.get()));
}

inline void omni::core::Generated<omni::graph::exec::unstable::IGraphBuilderNode_abi>::_removeParent(
    omni::core::ObjectParam<omni::graph::exec::unstable::IGraphBuilderNode> parent)
{
    OMNI_THROW_IF_ARG_NULL(parent);
    OMNI_THROW_IF_FAILED(_removeParent_abi(parent.get()));
}

inline void omni::core::Generated<omni::graph::exec::unstable::IGraphBuilderNode_abi>::_addChild(
    omni::core::ObjectParam<omni::graph::exec::unstable::IGraphBuilderNode> child)
{
    OMNI_THROW_IF_ARG_NULL(child);
    OMNI_THROW_IF_FAILED(_addChild_abi(child.get()));
}

inline void omni::core::Generated<omni::graph::exec::unstable::IGraphBuilderNode_abi>::_removeChild(
    omni::core::ObjectParam<omni::graph::exec::unstable::IGraphBuilderNode> child)
{
    OMNI_THROW_IF_ARG_NULL(child);
    OMNI_THROW_IF_FAILED(_removeChild_abi(child.get()));
}

inline void omni::core::Generated<omni::graph::exec::unstable::IGraphBuilderNode_abi>::_removeInvalidParents() noexcept
{
    _removeInvalidParents_abi();
}

inline void omni::core::Generated<omni::graph::exec::unstable::IGraphBuilderNode_abi>::_removeInvalidChildren() noexcept
{
    _removeInvalidChildren_abi();
}

inline void omni::core::Generated<omni::graph::exec::unstable::IGraphBuilderNode_abi>::_invalidateConnections() noexcept
{
    _invalidateConnections_abi();
}

inline void omni::core::Generated<omni::graph::exec::unstable::IGraphBuilderNode_abi>::setCycleParentCount(uint32_t count) noexcept
{
    setCycleParentCount_abi(count);
}

inline void omni::core::Generated<omni::graph::exec::unstable::IGraphBuilderNode_abi>::_setNodeDef(
    omni::core::ObjectParam<omni::graph::exec::unstable::INodeDef> nodeDef) noexcept
{
    _setNodeDef_abi(nodeDef.get());
}

inline void omni::core::Generated<omni::graph::exec::unstable::IGraphBuilderNode_abi>::_setNodeGraphDef(
    omni::core::ObjectParam<omni::graph::exec::unstable::INodeGraphDef> nodeGraphDef) noexcept
{
    _setNodeGraphDef_abi(nodeGraphDef.get());
}

inline void omni::core::Generated<omni::graph::exec::unstable::IGraphBuilderNode_abi>::_clearDef() noexcept
{
    _clearDef_abi();
}

inline omni::graph::exec::unstable::ITopology* omni::core::Generated<
    omni::graph::exec::unstable::IGraphBuilderNode_abi>::getTopology() noexcept
{
    return getTopology_abi();
}

inline void omni::core::Generated<omni::graph::exec::unstable::IGraphBuilderNode_abi>::validateOrResetTopology() noexcept
{
    validateOrResetTopology_abi();
}

inline omni::graph::exec::unstable::IGraphBuilderNode* omni::core::Generated<
    omni::graph::exec::unstable::IGraphBuilderNode_abi>::getParentAt(uint64_t index)
{
    omni::graph::exec::unstable::IGraphBuilderNode* out;
    OMNI_THROW_IF_FAILED(getParentAt_abi(index, &out));
    return out;
}

inline uint64_t omni::core::Generated<omni::graph::exec::unstable::IGraphBuilderNode_abi>::getParentCount() noexcept
{
    return getParentCount_abi();
}

inline omni::graph::exec::unstable::IGraphBuilderNode* omni::core::Generated<
    omni::graph::exec::unstable::IGraphBuilderNode_abi>::getChildAt(uint64_t index)
{
    omni::graph::exec::unstable::IGraphBuilderNode* out;
    OMNI_THROW_IF_FAILED(getChildAt_abi(index, &out));
    return out;
}

inline uint64_t omni::core::Generated<omni::graph::exec::unstable::IGraphBuilderNode_abi>::getChildCount() noexcept
{
    return getChildCount_abi();
}

inline bool omni::core::Generated<omni::graph::exec::unstable::IGraphBuilderNode_abi>::hasChild(
    omni::core::ObjectParam<omni::graph::exec::unstable::IGraphBuilderNode> node) noexcept
{
    return hasChild_abi(node.get());
}

inline bool omni::core::Generated<omni::graph::exec::unstable::IGraphBuilderNode_abi>::isRoot() noexcept
{
    return isRoot_abi();
}

inline omni::core::Result omni::core::Generated<omni::graph::exec::unstable::IGraphBuilderNode_abi>::getRoot(
    omni::graph::exec::unstable::IGraphBuilderNode** out)
{
    OMNI_THROW_IF_ARG_NULL(out);
    auto return_ = getRoot_abi(out);
    return return_;
}

#endif

#undef OMNI_BIND_INCLUDE_INTERFACE_DECL
#undef OMNI_BIND_INCLUDE_INTERFACE_IMPL
