HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
resolverContextBinder.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_CONTEXT_BINDER_H
8 #define PXR_USD_AR_RESOLVER_CONTEXT_BINDER_H
9 
10 /// \file ar/resolverContextBinder.h
11 
12 #include "pxr/pxr.h"
13 #include "pxr/usd/ar/api.h"
15 #include "pxr/base/vt/value.h"
16 
18 
19 class ArResolver;
20 
21 /// \class ArResolverContextBinder
22 ///
23 /// Helper object for managing the binding and unbinding of
24 /// ArResolverContext objects with the asset resolver.
25 ///
26 /// Context binding and unbinding are thread-specific. If you bind a context in
27 /// a thread, that binding will only be visible to that thread.
28 /// See \ref ar_resolver_contexts "Resolver Contexts" for more details.
29 ///
30 /// \see \ref ArResolver_context "Asset Resolver Context Operations"
32 {
33 public:
34  /// Bind the given \p context with the asset resolver.
35  ///
36  /// Calls ArResolver::BindContext on the configured asset resolver
37  /// and saves the bindingData populated by that function.
38  AR_API
40  const ArResolverContext& context);
41 
42  /// Bind the given \p context to the given \p assetResolver.
43  ///
44  /// Calls ArResolver::BindContext on the given \p assetResolver
45  /// and saves the bindingData populated by that function.
46  AR_API
48  ArResolver* assetResolver,
49  const ArResolverContext& context);
50 
51  /// Unbinds the context specified in the constructor of this
52  /// object from the asset resolver.
53  ///
54  /// Calls ArResolver::UnbindContext on the asset resolver that was
55  /// bound to originally, passing the saved bindingData to that function.
56  AR_API
58 
59 private:
60  ArResolver* _resolver;
61  ArResolverContext _context;
62  VtValue _bindingData;
63 };
64 
66 
67 #endif // PXR_USD_AR_RESOLVER_CONTEXT_BINDER_H
#define AR_API
Definition: api.h:23
AR_API ~ArResolverContextBinder()
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1425
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:74
AR_API ArResolverContextBinder(const ArResolverContext &context)
Definition: value.h:146