7#ifndef PXR_USD_AR_RESOLVER_H
8#define PXR_USD_AR_RESOLVER_H
13#include "pxr/usd/ar/api.h"
14#include "pxr/usd/ar/ar.h"
23PXR_NAMESPACE_OPEN_SCOPE
80 const std::string& assetPath,
88 const std::string& assetPath,
105 const std::string& assetPath)
const;
115 const std::string& assetPath)
const;
165 const std::string& assetPath)
const;
171 const std::string& contextStr)
const;
185 const std::string& uriScheme,
const std::string& contextStr)
const;
214 std::pair<std::string, std::string>>& contextStrs)
const;
250 const std::string& assetPath)
const;
265 const std::string& assetPath)
const;
272 const std::string& assetPath,
281 const std::string& assetPath,
329 std::string* whyNot =
nullptr)
const;
458 const std::string& assetPath,
472 const std::string& assetPath,
478 const std::string& assetPath)
const = 0;
484 const std::string& assetPath)
const = 0;
599 const std::string& assetPath)
const;
607 const std::string& contextStr)
const;
653 const std::string& assetPath)
const;
673 const std::string& assetPath)
const;
681 const std::string& assetPath,
699 const std::string& assetPath,
722 std::string* whyNot)
const;
734 virtual std::shared_ptr<ArWritableAsset>
790 const std::string& path)
const;
825 template <
class ContextObj>
829 return ctx ? ctx->
Get<ContextObj>() :
nullptr;
952PXR_NAMESPACE_CLOSE_SCOPE
AR_API void ArSetPreferredResolver(const std::string &resolverTypeName)
Set the preferred ArResolver subclass used by ArGetResolver.
AR_API ArResolver & ArGetUnderlyingResolver()
Returns the underlying ArResolver instance used by ArGetResolver.
AR_API const std::vector< std::string > & ArGetRegisteredURISchemes()
Returns list of all URI schemes for which a resolver has been registered.
AR_API std::unique_ptr< ArResolver > ArCreateResolver(const TfType &resolverType)
Construct an instance of the ArResolver subclass specified by resolverType.
AR_API std::vector< TfType > ArGetAvailableResolvers()
Returns list of TfTypes for available ArResolver subclasses.
AR_API ArResolver & ArGetResolver()
Returns the configured asset resolver.
Interface for accessing the contents of an asset.
Contains information about a resolved asset.
Represents a resolved asset path.
An asset resolver context allows clients to provide additional data to the resolver for use during re...
const ContextObj * Get() const
Returns pointer to the context object of the given type held in this resolver context.
Interface for the asset resolution system.
virtual AR_API void _BeginCacheScope(VtValue *cacheScopeData)
Mark the start of a resolution caching scope.
virtual AR_API std::shared_ptr< ArAsset > _OpenAsset(const ArResolvedPath &resolvedPath) const =0
Return an ArAsset object for the asset located at resolvedPath.
virtual AR_API void _UnbindContext(const ArResolverContext &context, VtValue *bindingData)
Unbind the given context from this resolver.
AR_API ArResolverContext CreateDefaultContextForAsset(const std::string &assetPath) const
Return an ArResolverContext that may be bound to this resolver to resolve the asset located at assetP...
virtual AR_API ArResolverContext _GetCurrentContext() const
Return the currently bound context.
AR_API ArResolverContext CreateDefaultContext() const
Return an ArResolverContext that may be bound to this resolver to resolve assets when no other contex...
AR_API ArResolvedPath Resolve(const std::string &assetPath) const
Returns the resolved path for the asset identified by the given assetPath if it exists.
AR_API void EndCacheScope(VtValue *cacheScopeData)
Mark the end of a resolution caching scope.
virtual ArResolvedPath _Resolve(const std::string &assetPath) const =0
Return the resolved path for the given assetPath or an empty ArResolvedPath if no asset exists at tha...
virtual AR_API ArTimestamp _GetModificationTimestamp(const std::string &assetPath, const ArResolvedPath &resolvedPath) const
Return an ArTimestamp representing the last time the asset at assetPath was modified.
AR_API void BeginCacheScope(VtValue *cacheScopeData)
Mark the start of a resolution caching scope.
virtual AR_API ArResolverContext _CreateDefaultContextForAsset(const std::string &assetPath) const
Return an ArResolverContext that may be bound to this resolver to resolve the asset located at assetP...
AR_API ArResolverContext CreateContextFromString(const std::string &contextStr) const
Return an ArResolverContext created from the primary ArResolver implementation using the given contex...
AR_API ArAssetInfo GetAssetInfo(const std::string &assetPath, const ArResolvedPath &resolvedPath) const
Returns an ArAssetInfo populated with additional metadata (if any) about the asset at the given asset...
virtual AR_API bool _IsContextDependentPath(const std::string &assetPath) const
Return true if the result of resolving the given assetPath may differ depending on the asset resolver...
WriteMode
Enumeration of write modes for OpenAssetForWrite.
@ Update
Open asset for in-place updates.
@ Replace
Open asset for replacement.
virtual ArResolvedPath _ResolveForNewAsset(const std::string &assetPath) const =0
Return the resolved path for the given assetPath that may be used to create a new asset or an empty A...
AR_API std::string CreateIdentifier(const std::string &assetPath, const ArResolvedPath &anchorAssetPath=ArResolvedPath()) const
Returns an identifier for the asset specified by assetPath.
AR_API void RefreshContext(const ArResolverContext &context)
Refresh any caches associated with the given context.
AR_API ArResolverContext CreateContextFromString(const std::string &uriScheme, const std::string &contextStr) const
Return an ArResolverContext created from the ArResolver registered for the given uriScheme using the ...
virtual AR_API std::string _GetExtension(const std::string &assetPath) const
Return the file extension for the given assetPath.
AR_API std::shared_ptr< ArWritableAsset > OpenAssetForWrite(const ArResolvedPath &resolvedPath, WriteMode writeMode) const
Returns an ArWritableAsset object for the asset located at resolvedPath using the specified writeMode...
AR_API bool CanWriteAssetToPath(const ArResolvedPath &resolvedPath, std::string *whyNot=nullptr) const
Returns true if an asset may be written to the given resolvedPath, false otherwise.
AR_API void BindContext(const ArResolverContext &context, VtValue *bindingData)
Binds the given context to this resolver.
AR_API void UnbindContext(const ArResolverContext &context, VtValue *bindingData)
Unbind the given context from this resolver.
virtual AR_API ArResolverContext _CreateDefaultContext() const
Return a default ArResolverContext that may be bound to this resolver to resolve assets when no other...
virtual std::string _CreateIdentifierForNewAsset(const std::string &assetPath, const ArResolvedPath &anchorAssetPath) const =0
Return an identifier for a new asset at the given assetPath.
AR_API bool IsRepositoryPath(const std::string &path) const
AR_API ArResolverContext CreateContextFromStrings(const std::vector< std::pair< std::string, std::string > > &contextStrs) const
Return an ArResolverContext created by combining the ArResolverContext objects created from the given...
virtual AR_API bool _IsRepositoryPath(const std::string &path) const
AR_API ArResolverContext GetCurrentContext() const
Returns the asset resolver context currently bound in this thread.
virtual AR_API bool _CanWriteAssetToPath(const ArResolvedPath &resolvedPath, std::string *whyNot) const
Return true if an asset may be written to the given resolvedPath, false otherwise.
AR_API std::string CreateIdentifierForNewAsset(const std::string &assetPath, const ArResolvedPath &anchorAssetPath=ArResolvedPath()) const
Returns an identifier for a new asset specified by assetPath.
const ContextObj * _GetCurrentContextObject() const
Returns a pointer to the context object of type ContextObj from the last ArResolverContext that was b...
virtual AR_API void _EndCacheScope(VtValue *cacheScopeData)
Mark the end of a resolution caching scope.
virtual AR_API ArResolverContext _CreateContextFromString(const std::string &contextStr) const
Return an ArResolverContext created from the given contextStr.
virtual std::string _CreateIdentifier(const std::string &assetPath, const ArResolvedPath &anchorAssetPath) const =0
Return an identifier for the asset at the given assetPath.
AR_API std::string GetExtension(const std::string &assetPath) const
Returns the file extension for the given assetPath.
virtual AR_API std::shared_ptr< ArWritableAsset > _OpenAssetForWrite(const ArResolvedPath &resolvedPath, WriteMode writeMode) const =0
Return an ArWritableAsset object for the asset at resolvedPath using the specified writeMode.
AR_API bool IsContextDependentPath(const std::string &assetPath) const
Returns true if assetPath is a context-dependent path, false otherwise.
virtual AR_API ArAssetInfo _GetAssetInfo(const std::string &assetPath, const ArResolvedPath &resolvedPath) const
Return an ArAssetInfo populated with additional metadata (if any) about the asset at the given assetP...
AR_API ArResolvedPath ResolveForNewAsset(const std::string &assetPath) const
Returns the resolved path for the given assetPath that may be used to create a new asset.
virtual AR_API void _BindContext(const ArResolverContext &context, VtValue *bindingData)
Bind the given context to this resolver.
AR_API std::shared_ptr< ArAsset > OpenAsset(const ArResolvedPath &resolvedPath) const
Returns an ArAsset object for the asset located at resolvedPath.
AR_API ArTimestamp GetModificationTimestamp(const std::string &assetPath, const ArResolvedPath &resolvedPath) const
Returns an ArTimestamp representing the last time the asset at assetPath was modified.
virtual AR_API void _RefreshContext(const ArResolverContext &context)
Refresh any caches associated with the given context.
Represents a timestamp for an asset.
Interface for writing data to an asset.
TfType represents a dynamic runtime type.
Provides a container which may hold any type, and provides introspection and iteration over array typ...