IDictionary.h#
Fully qualified name: carb/dictionary/IDictionary.h
File members: carb/dictionary/IDictionary.h
// SPDX-FileCopyrightText: Copyright (c) 2019-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
// SPDX-License-Identifier: LicenseRef-NvidiaProprietary
//
// NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
// property and proprietary rights in and to this material, related
// documentation and any modifications thereto. Any use, reproduction,
// disclosure or distribution of this material and related documentation
// without an express license agreement from NVIDIA CORPORATION or
// its affiliates is strictly prohibited.
#pragma once
#include "../Defines.h"
#include "../Interface.h"
#include "../Types.h"
#include "../extras/Hash.h"
#include "../cpp/StringView.h"
#include "../cpp/Optional.h"
#include "../../omni/String.h"
#include <cstdint>
#include <type_traits>
#define carb_dictionary_IDictionary_latest CARB_HEXVERSION(2, 0)
#ifndef carb_dictionary_IDictionary
# define carb_dictionary_IDictionary CARB_HEXVERSION(1, 2)
#endif
namespace carb::dictionary
{
enum class ItemType
{
eBool,
eInt,
eFloat,
eString,
eDictionary,
eCount
};
struct Item DOXYGEN_EMPTY_CLASS;
enum class UpdateAction
{
eOverwrite,
eKeep,
eReplaceSubtree,
};
enum class ItemFlag
{
eUnitSubtree,
};
typedef UpdateAction (*OnUpdateItemFn)(
const Item* dstItem, ItemType dstItemType, const Item* srcItem, ItemType srcItemType, void* userData);
inline UpdateAction overwriteOriginal(const Item*, ItemType, const Item*, ItemType, void*)
{
return UpdateAction::eOverwrite;
}
inline UpdateAction keepOriginal(const Item* dstItem, ItemType, const Item*, ItemType, void*)
{
if (!dstItem)
{
// If the destination item doesn't exist - allow to create a new one
return UpdateAction::eOverwrite;
}
return UpdateAction::eKeep;
}
constexpr OnUpdateItemFn kUpdateItemOverwriteOriginal = overwriteOriginal;
constexpr OnUpdateItemFn kUpdateItemKeepOriginal = keepOriginal;
struct SubscriptionId DOXYGEN_EMPTY_CLASS;
enum class ChangeEventType
{
eCreated,
eChanged,
eDestroyed,
};
using OnNodeChangeEventFn = void (*)(const Item* changedItem, ChangeEventType eventType, void* userData);
using OnTreeChangeEventFn = void (*)(const Item* treeItem,
const Item* changedItem,
ChangeEventType eventType,
void* userData);
} // namespace carb::dictionary
#if CARB_VERSION_ATLEAST(carb_dictionary_IDictionary, 2, 0)
# include "detail/IDictionary2.h"
#else
# include "detail/IDictionary1.h"
#endif