
// Copyright (c) 2019-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.
//
#pragma once

#include <carb/Interface.h>

namespace carb
{
namespace flatcache
{

struct OGUtilsNotForGeneralUser
{
    CARB_PLUGIN_INTERFACE("carb::flatcache::OGUtilsNotForGeneralUser", 0, 2);

    //////////////////////////////////////////////////////////////////////////
    // A simple collection of utility functions for interacting with flatcache
    //////////////////////////////////////////////////////////////////////////


    /** @brief Import attributes from a usd prim, in provided cache, at a given path,
     *  read at a given time
     *
     * @cache[in/out] The cache to be populated
     * @dstPath[in] The path location in the cache to import attributes to
     * @prim[in] The prim from which to read the attributes in USD
     * @time[in] The time at which to read the attributes from
     * @filter[in] A subset of attributes to consider during this import process.
     *             Will import all attributes if left empty
     * @force[in] Whether to overwrite values, or just add missing ones
     */
    void(CARB_ABI* importPrimAttributesToCacheAtPathAtTime)(struct PathToAttributesMap& cache,
                                                            const pxr::SdfPath& dstPath,
                                                            const pxr::UsdPrim& prim,
                                                            const pxr::UsdTimeCode& time,
                                                            const std::set<TokenC>& filter,
                                                            bool force);

    /** @brief Copy a subset of data from the cache back to USD
     *
     * @cache[in/out] The cache to read the data from
     * @buckets[in] A collection of bucket subsets, from which the data needs to be copied back to USD
     */
    void (CARB_ABI* pushDataToUSD)(struct PathToAttributesMap& cache, struct BucketSubset const& bucket, bool skipMeshPoints);

    
    // Prefetch the whole USD stage to the cache
    // Typically you only call this at stage load time, because the USD notify
    // handler updates the cache if the stage changes.
    void(CARB_ABI* usdToCache)(PathToAttributesMap& cache, bool processConnections);
};

}
}
