HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
rendererPluginHandle.h
Go to the documentation of this file.
1 //
2 // Copyright 2020 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_IMAGING_HD_RENDERER_PLUGIN_HANDLE_H
8 #define PXR_IMAGING_HD_RENDERER_PLUGIN_HANDLE_H
9 
10 #include "pxr/pxr.h"
11 #include "pxr/imaging/hd/api.h"
13 
14 #include "pxr/base/tf/token.h"
15 
16 #include <cstddef>
17 
19 
20 class HdRendererPlugin;
22 
23 ///
24 /// A handle for HdRendererPlugin also storing the plugin id.
25 ///
26 /// Alleviates the need to ever call, e.g., ReleasePlugin since it
27 /// automatically decreases and increases the plugin's reference
28 /// counts with the plugin registry.
29 ///
31 {
32 public:
33  HdRendererPluginHandle() : _plugin(nullptr) { }
34  HdRendererPluginHandle(const std::nullptr_t &) : _plugin(nullptr) { }
35 
36  HD_API
38 
39  HD_API
41 
42  HD_API
44 
45  HD_API
46  HdRendererPluginHandle &operator=(const std::nullptr_t &);
47 
48  /// Get the wrapped HdRendererPlugin
49  HdRendererPlugin *Get() const { return _plugin; }
50 
51  HdRendererPlugin *operator->() const { return _plugin; }
52  HdRendererPlugin &operator*() const { return *_plugin; }
53 
54  /// Is the wrapped HdRendererPlugin valid?
55  explicit operator bool() const { return _plugin; }
56 
57 private:
59  friend class HdRendererPlugin;
60 
62  : _plugin(plugin) { }
63 
64  HdRendererPlugin *_plugin;
65 };
66 
68 
69 #endif
#define HD_API
Definition: api.h:23
HdRendererPluginHandle(const std::nullptr_t &)
OutGridT const XformOp bool bool
HdRendererPlugin * operator->() const
HD_API ~HdRendererPluginHandle()
HD_API HdRendererPluginHandle & operator=(const HdRendererPluginHandle &)
HdRendererPlugin * Get() const
Get the wrapped HdRendererPlugin.
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1425
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:74
HdRendererPlugin & operator*() const