defaultResolver.h
Go to the documentation of this file.
1 //
2 // Copyright 2016 Pixar
3 //
4 // Licensed under the Apache License, Version 2.0 (the "Apache License")
5 // with the following modification; you may not use this file except in
6 // compliance with the Apache License and the following modification to it:
7 // Section 6. Trademarks. is deleted and replaced with:
8 //
9 // 6. Trademarks. This License does not grant permission to use the trade
10 // names, trademarks, service marks, or product names of the Licensor
11 // and its affiliates, except as required to comply with Section 4(c) of
12 // the License and to reproduce the content of the NOTICE file.
13 //
14 // You may obtain a copy of the Apache License at
15 //
16 // http://www.apache.org/licenses/LICENSE-2.0
17 //
18 // Unless required by applicable law or agreed to in writing, software
19 // distributed under the Apache License with the above modification is
20 // distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
21 // KIND, either express or implied. See the Apache License for the specific
22 // language governing permissions and limitations under the Apache License.
23 //
24 #ifndef PXR_USD_AR_DEFAULT_RESOLVER_H
25 #define PXR_USD_AR_DEFAULT_RESOLVER_H
26 
28 
29 #include "pxr/pxr.h"
30 #include "pxr/usd/ar/api.h"
33 #include "pxr/usd/ar/resolver.h"
34 
35 #include <memory>
36 #include <string>
37 #include <vector>
38 
39 PXR_NAMESPACE_OPEN_SCOPE
40 
65  : public ArResolver
66 {
67 public:
68  AR_API
70 
71  AR_API
72  virtual ~ArDefaultResolver();
73 
79  AR_API
80  static void SetDefaultSearchPath(
81  const std::vector<std::string>& searchPath);
82 
83 protected:
84  AR_API
85  std::string _CreateIdentifier(
86  const std::string& assetPath,
87  const ArResolvedPath& anchorAssetPath) const override;
88 
89  AR_API
90  std::string _CreateIdentifierForNewAsset(
91  const std::string& assetPath,
92  const ArResolvedPath& anchorAssetPath) const override;
93 
94  AR_API
96  const std::string& assetPath) const override;
97 
98  AR_API
100  const std::string& assetPath) const override;
101 
102  AR_API
103  ArResolverContext _CreateDefaultContext() const override;
104 
112  AR_API
114  const std::string& assetPath) const override;
115 
119  AR_API
121  const std::string& contextStr) const override;
122 
123  AR_API
125  const std::string& assetPath) const override;
126 
127  AR_API
129  const std::string& path,
130  const ArResolvedPath& resolvedPath) const override;
131 
132  AR_API
133  std::shared_ptr<ArAsset> _OpenAsset(
134  const ArResolvedPath& resolvedPath) const override;
135 
138  AR_API
139  std::shared_ptr<ArWritableAsset> _OpenAssetForWrite(
140  const ArResolvedPath& resolvedPath,
141  WriteMode writeMode) const override;
142 
143 private:
144  const ArDefaultResolverContext* _GetCurrentContextPtr() const;
145 
146  ArDefaultResolverContext _fallbackContext;
147  ArResolverContext _defaultContext;
148 };
149 
150 PXR_NAMESPACE_CLOSE_SCOPE
151 
152 #endif // PXR_USD_AR_DEFAULT_RESOLVER_H
static AR_API void SetDefaultSearchPath(const std::vector< std::string > &searchPath)
Set the default search path that will be used during asset resolution.
Represents a timestamp for an asset.
Definition: timestamp.h:42
Default asset resolution implementation used when no plugin implementation is provided.
AR_API ArResolverContext _CreateContextFromString(const std::string &contextStr) const override
Creates an ArDefaultResolverContext from contextStr.
Resolver context object that specifies a search path to use during asset resolution.
AR_API std::shared_ptr< ArAsset > _OpenAsset(const ArResolvedPath &resolvedPath) const override
Return an ArAsset object for the asset located at resolvedPath.
AR_API std::shared_ptr< ArWritableAsset > _OpenAssetForWrite(const ArResolvedPath &resolvedPath, WriteMode writeMode) const override
Creates an ArFilesystemWriteableAsset for the asset at the given resolvedPath.
AR_API ArResolvedPath _Resolve(const std::string &assetPath) const override
Return the resolved path for the given assetPath or an empty ArResolvedPath if no asset exists at tha...
AR_API ArResolverContext _CreateDefaultContextForAsset(const std::string &assetPath) const override
Creates a context that adds the directory containing assetPath as a first directory to be searched,...
Represents a resolved asset path.
Definition: resolvedPath.h:39
AR_API std::string _CreateIdentifierForNewAsset(const std::string &assetPath, const ArResolvedPath &anchorAssetPath) const override
Return an identifier for a new asset at the given assetPath.
AR_API bool _IsContextDependentPath(const std::string &assetPath) const override
Return true if the result of resolving the given assetPath may differ depending on the asset resolver...
AR_API ArResolvedPath _ResolveForNewAsset(const std::string &assetPath) const override
Return the resolved path for the given assetPath that may be used to create a new asset or an empty A...
AR_API ArTimestamp _GetModificationTimestamp(const std::string &path, const ArResolvedPath &resolvedPath) const override
Return an ArTimestamp representing the last time the asset at assetPath was modified.
An asset resolver context allows clients to provide additional data to the resolver for use during re...
AR_API ArResolverContext _CreateDefaultContext() const override
Return a default ArResolverContext that may be bound to this resolver to resolve assets when no other...
WriteMode
Enumeration of write modes for OpenAssetForWrite.
Definition: resolver.h:299
Interface for the asset resolution system.
Definition: resolver.h:59