HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
resolverScopedCache.h
Go to the documentation of this file.
1 //
2 // Copyright 2016 Pixar
3 //
4 // Licensed under the terms set forth in the LICENSE.txt file available at
5 // https://openusd.org/license.
6 //
7 #ifndef PXR_USD_AR_RESOLVER_SCOPED_CACHE_H
8 #define PXR_USD_AR_RESOLVER_SCOPED_CACHE_H
9 
10 /// \file ar/resolverScopedCache.h
11 
12 #include "pxr/pxr.h"
13 #include "pxr/usd/ar/api.h"
14 #include "pxr/base/vt/value.h"
15 
17 
18 /// \class ArResolverScopedCache
19 ///
20 /// Helper object for managing asset resolver cache scopes.
21 ///
22 /// A scoped resolution cache indicates to the resolver that results of
23 /// calls to Resolve should be cached for a certain scope. This is
24 /// important for performance and also for consistency -- it ensures
25 /// that repeated calls to Resolve with the same parameters will
26 /// return the same result.
27 ///
28 /// \see \ref ArResolver_scopedCache "Scoped Resolution Cache"
30 {
31 public:
32 
33  // Disallow copies
36 
37  /// Begin an asset resolver cache scope.
38  ///
39  /// Calls ArResolver::BeginCacheScope on the configured asset resolver
40  /// and saves the cacheScopeData populated by that function.
41  AR_API
43 
44  /// Begin an asset resolver cache scope that shares data
45  /// with the given \p parent scope.
46  ///
47  /// Calls ArResolver::BeginCacheScope on the configured asset resolver,
48  /// saves the cacheScopeData stored in \p parent and passes that to that
49  /// function.
50  AR_API
51  explicit ArResolverScopedCache(const ArResolverScopedCache* parent);
52 
53  /// End an asset resolver cache scope.
54  ///
55  /// Calls ArResolver::EndCacheScope on the configured asset resolver,
56  /// passing the saved cacheScopeData to that function.
57  AR_API
59 
60 private:
61  VtValue _cacheScopeData;
62 };
63 
65 
66 #endif // PXR_USD_AR_RESOLVER_SCOPED_CACHE_H
ArResolverScopedCache & operator=(const ArResolverScopedCache &)=delete
#define AR_API
Definition: api.h:23
AR_API ArResolverScopedCache()
AR_API ~ArResolverScopedCache()
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1425
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:74
Definition: value.h:146