Program Listing for omni/graph/core/bundle/IConstBundle2.h

↰ Return to documentation for omni/graph/core/bundle/IConstBundle2.h

// 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.
//
#pragma once

#include <omni/core/IObject.h>
#include <omni/graph/core/Handle.h>
#include <omni/graph/core/Type.h>
#include <omni/log/ILog.h>

OMNI_LOG_DECLARE_CHANNEL(kBundleChannel)

namespace omni
{
namespace graph
{
namespace core
{

OMNI_DECLARE_INTERFACE(IConstBundle2);

class IConstBundle2_abi : public omni::core::Inherits<omni::core::IObject, OMNI_TYPE_ID("omni.graph.core.IConstBundle2")>
{
protected:
    virtual bool isValid_abi() noexcept = 0;

    OMNI_ATTR("no_py")
    virtual GraphContextObj getContext_abi() noexcept = 0;

    OMNI_ATTR("no_py")
    virtual ConstBundleHandle getConstHandle_abi() noexcept = 0;

    OMNI_ATTR("no_py")
    virtual omni::fabric::PathC getPath_abi() noexcept = 0;

     OMNI_ATTR("no_py")
     virtual NameToken getName_abi() noexcept = 0;

    OMNI_ATTR("no_py")
    virtual ConstBundleHandle getConstParentBundle_abi() noexcept = 0;

    OMNI_ATTR("no_py")
    virtual omni::core::Result getAttributeNamesAndTypes_abi(
        NameToken* const names OMNI_ATTR("out, count=*nameAndTypeCount"),
        Type* const types OMNI_ATTR("out, count=*nameAndTypeCount"),
        size_t* const nameAndTypeCount OMNI_ATTR("in, out, not_null")) noexcept = 0;

    OMNI_ATTR("no_py")
    virtual omni::core::Result getConstAttributes_abi(
        ConstAttributeDataHandle* const attributes OMNI_ATTR("out, not_null, count=*attributeCount"),
        size_t* const attributeCount OMNI_ATTR("in, out, not_null")) noexcept = 0;

    OMNI_ATTR("no_py")
    virtual omni::core::Result getConstAttributesByName_abi(
        NameToken const* const names OMNI_ATTR("in, not_null, count=nameCount"),
        size_t nameCount,
        ConstAttributeDataHandle* const attributes OMNI_ATTR("out, not_null, count=nameCount")) noexcept = 0;

    OMNI_ATTR("no_py")
    virtual omni::core::Result getConstChildBundles_abi(
        ConstBundleHandle* const bundles OMNI_ATTR("out, not_null, count=*bundleCount"),
        size_t* const bundleCount OMNI_ATTR("in, out, not_null")) noexcept = 0;

    OMNI_ATTR("no_py, no_api")
    virtual omni::core::Result getConstChildBundle_abi(
        size_t bundleIndex, ConstBundleHandle* const bundle OMNI_ATTR("out, not_null")) noexcept = 0;

    OMNI_ATTR("no_py")
    virtual omni::core::Result getConstChildBundlesByName_abi(
        NameToken const* const names OMNI_ATTR("in, not_null, count=nameCount"),
        size_t nameCount,
        ConstBundleHandle* const foundBundles OMNI_ATTR("out, not_null, count=nameCount")) noexcept = 0;

    OMNI_ATTR("no_py")
    virtual ConstBundleHandle getConstMetadataStorage_abi() noexcept = 0;

    OMNI_ATTR("no_py")
    virtual omni::core::Result getBundleMetadataNamesAndTypes_abi(
        NameToken* const fieldNames OMNI_ATTR("out, count=*fieldCount"),
        Type* const fieldTypes OMNI_ATTR("out, count=*fieldCount"),
        size_t* const fieldCount OMNI_ATTR("in, out, not_null")) noexcept = 0;

    OMNI_ATTR("no_py")
    virtual omni::core::Result getConstBundleMetadataByName_abi(
        NameToken const* const fieldNames OMNI_ATTR("in, count=fieldCount"),
        size_t fieldCount,
        ConstAttributeDataHandle* const bundleMetadata OMNI_ATTR("out, count=fieldCount")) noexcept = 0;

    OMNI_ATTR("no_py")
    virtual omni::core::Result getAttributeMetadataNamesAndTypes_abi(
        NameToken attribute,
        NameToken* const fieldNames OMNI_ATTR("out, count=*fieldCount"),
        Type* const fieldTypes OMNI_ATTR("out, count=*fieldCount"),
        size_t* const fieldCount OMNI_ATTR("in, out, not_null")) noexcept = 0;

    OMNI_ATTR("no_py")
    virtual omni::core::Result getConstAttributeMetadataByName_abi(
        NameToken attribute,
        NameToken const* const fieldNames OMNI_ATTR("in, count=fieldCount"),
        size_t fieldCount,
        ConstAttributeDataHandle* const attributeMetadata OMNI_ATTR("out, count=fieldCount")) noexcept = 0;
};

} // namespace core
} // namespace graph
} // namespace omni

#include "IConstBundle2.gen.h"

OMNI_DEFINE_INTERFACE_API(omni::graph::core::IConstBundle2)
{
public:
    size_t getAttributeCount() noexcept
    {
        size_t attributeCount = 0;
        auto result = getConstAttributes_abi(nullptr, &attributeCount);
        return OMNI_SUCCEEDED(result) ? attributeCount : 0;
    }

    size_t getChildBundleCount() noexcept
    {
        size_t bundleCount = 0;
        auto result = getConstChildBundles_abi(nullptr, &bundleCount);
        return OMNI_SUCCEEDED(result) ? bundleCount : 0;
    }

    omni::core::Result getAttributeNames(omni::graph::core::NameToken* const names, size_t nameCount) noexcept
    {
        return getAttributeNamesAndTypes_abi(names, nullptr, &nameCount);
    }

    omni::core::Result getAttributeTypes(omni::graph::core::Type* const types, size_t typeCount) noexcept
    {
        return getAttributeNamesAndTypes_abi(nullptr, types, &typeCount);
    }

    omni::core::Result getConstAttributes(
        omni::graph::core::ConstAttributeDataHandle* const attributes, size_t attributeCount) noexcept
    {
        return getConstAttributes_abi(attributes, &attributeCount);
    }

    omni::graph::core::ConstAttributeDataHandle getConstAttributeByName(omni::graph::core::NameToken name) noexcept
    {
        using namespace omni::graph::core;
        ConstAttributeDataHandle out{ ConstAttributeDataHandle::invalidValue() };
        auto result = getConstAttributesByName_abi(&name, 1, &out);
        return OMNI_SUCCEEDED(result) ? out : ConstAttributeDataHandle{ ConstAttributeDataHandle::invalidValue() };
    }

    omni::core::Result getConstChildBundles(omni::graph::core::ConstBundleHandle* const bundles, size_t bundleCount) noexcept
    {
        return getConstChildBundles_abi(bundles, &bundleCount);
    }

    omni::graph::core::ConstBundleHandle getConstChildBundle(size_t bundleIndex) noexcept
    {
        using namespace omni::graph::core;
        ConstBundleHandle out{ ConstBundleHandle::invalidValue() };
        auto result = getConstChildBundle_abi(bundleIndex, &out);
        return OMNI_SUCCEEDED(result) ? out : ConstBundleHandle{ ConstBundleHandle::invalidValue() };
    }

    omni::graph::core::ConstBundleHandle getConstChildBundleByName(omni::graph::core::NameToken name) noexcept
    {
        using namespace omni::graph::core;
        ConstBundleHandle out{ ConstBundleHandle::invalidValue() };
        auto result = getConstChildBundlesByName_abi(&name, 1, &out);
        return OMNI_SUCCEEDED(result) ? out : ConstBundleHandle{ ConstBundleHandle::invalidValue() };
    }

    size_t getBundleMetadataCount() noexcept
    {
        size_t bundleMetadataCount = 0;
        auto result = getBundleMetadataNamesAndTypes_abi(nullptr, nullptr, &bundleMetadataCount);
        return OMNI_SUCCEEDED(result) ? bundleMetadataCount : 0;
    }

    omni::core::Result getBundleMetadataNamesAndTypes(omni::graph::core::NameToken* const fieldNames,
                                                      omni::graph::core::Type* const fieldTypes, size_t fieldCount) noexcept
    {
        return getBundleMetadataNamesAndTypes_abi(fieldNames, fieldTypes, &fieldCount);
    }

    using omni::core::Generated<IConstBundle2_abi>::getConstBundleMetadataByName;

    omni::graph::core::ConstAttributeDataHandle getConstBundleMetadataByName(omni::graph::core::NameToken fieldName) noexcept
    {
        using namespace omni::graph::core;
        ConstAttributeDataHandle out{ ConstAttributeDataHandle::invalidValue() };
        Result result = getConstBundleMetadataByName_abi(&fieldName, 1, &out);
        return OMNI_SUCCEEDED(result) ? out : ConstAttributeDataHandle{ ConstAttributeDataHandle::invalidValue() };
    }

    size_t getAttributeMetadataCount(omni::graph::core::NameToken attribute) noexcept
    {
        size_t attributeMetadataCount = 0;
        auto result = getAttributeMetadataNamesAndTypes_abi(attribute, nullptr, nullptr, &attributeMetadataCount);
        return OMNI_SUCCEEDED(result) ? attributeMetadataCount : 0;
    }

    omni::core::Result getAttributeMetadataNamesAndTypes(
        omni::graph::core::NameToken attribute, omni::graph::core::NameToken* const fieldNames,
        omni::graph::core::Type* const fieldTypes, size_t fieldCount) noexcept
    {
        return getAttributeMetadataNamesAndTypes_abi(attribute, fieldNames, fieldTypes, &fieldCount);
    }

    using omni::core::Generated<IConstBundle2_abi>::getConstAttributeMetadataByName;

    omni::graph::core::ConstAttributeDataHandle getConstAttributeMetadataByName(
        omni::graph::core::NameToken attribute, omni::graph::core::NameToken fieldName) noexcept
    {
        using namespace omni::graph::core;
        ConstAttributeDataHandle out{ ConstAttributeDataHandle::invalidValue() };
        auto result = getConstAttributeMetadataByName_abi(attribute, &fieldName, 1, &out);
        return OMNI_SUCCEEDED(result) ? out : ConstAttributeDataHandle{ ConstAttributeDataHandle::invalidValue() };
    }

    CARB_DEPRECATED("Accessing child bundles by index is deprecated, look up children by name")
    omni::core::Result getConstChildBundle(
        size_t bundleIndex, omni::graph::core::ConstBundleHandle* const bundle) noexcept
    {
        return getConstChildBundle_abi(bundleIndex, bundle);
    }

}; // IConstBundle2