15 #include <openxr/openxr.h> 19 #include <type_traits> 23 #ifdef XRTRAITS_DOXYGEN 24 namespace handle_destroyers {
28 class OpenXRHandleDestroyer;
47 std::unique_ptr<std::remove_pointer_t<XrInstance>,
48 handle_destroyers::OpenXRHandleDestroyer>;
51 using UniqueSession = std::unique_ptr<std::remove_pointer_t<XrSession>,
52 handle_destroyers::OpenXRHandleDestroyer>;
56 std::unique_ptr<std::remove_pointer_t<XrSwapchain>,
57 handle_destroyers::OpenXRHandleDestroyer>;
60 using UniqueAction = std::unique_ptr<std::remove_pointer_t<XrAction>,
61 handle_destroyers::OpenXRHandleDestroyer>;
65 std::unique_ptr<std::remove_pointer_t<XrActionSet>,
66 handle_destroyers::OpenXRHandleDestroyer>;
69 using UniqueSpace = std::unique_ptr<std::remove_pointer_t<XrSpace>,
70 handle_destroyers::OpenXRHandleDestroyer>;
74 #define XRTRAITS_CREATE_UNIQUE_HANDLE_TYPE(HandleName) \ 75 namespace handle_destroyers { \ 76 class Destroy##HandleName \ 79 Destroy##HandleName() = default; \ 80 void operator()(Xr##HandleName handle) const \ 82 if (handle != XR_NULL_HANDLE) { \ 83 xrDestroy##HandleName(handle); \ 88 using Unique##HandleName = \ 89 std::unique_ptr<std::remove_pointer_t<Xr##HandleName>, \ 90 handle_destroyers::Destroy##HandleName> 92 XRTRAITS_CREATE_UNIQUE_HANDLE_TYPE(Instance);
93 XRTRAITS_CREATE_UNIQUE_HANDLE_TYPE(Session);
94 XRTRAITS_CREATE_UNIQUE_HANDLE_TYPE(Swapchain);
95 XRTRAITS_CREATE_UNIQUE_HANDLE_TYPE(Action);
96 XRTRAITS_CREATE_UNIQUE_HANDLE_TYPE(ActionSet);
97 XRTRAITS_CREATE_UNIQUE_HANDLE_TYPE(Space);
99 #undef XRTRAITS_CREATE_UNIQUE_HANDLE_TYPE 101 #endif // XRTRAITS_DOXYGEN Main namespace for these C++ OpenXR utilities.
Definition: GetChained.h:26
std::unique_ptr< std::remove_pointer_t< XrAction >, handle_destroyers::OpenXRHandleDestroyer > UniqueAction
Scoped RAII pointer type wrapping XrAction.
Definition: UniqueHandles.h:61
std::unique_ptr< std::remove_pointer_t< XrSession >, handle_destroyers::OpenXRHandleDestroyer > UniqueSession
Scoped RAII pointer type wrapping XrSession.
Definition: UniqueHandles.h:52
std::unique_ptr< std::remove_pointer_t< XrSwapchain >, handle_destroyers::OpenXRHandleDestroyer > UniqueSwapchain
Scoped RAII pointer type wrapping XrSwapchain.
Definition: UniqueHandles.h:57
std::unique_ptr< std::remove_pointer_t< XrActionSet >, handle_destroyers::OpenXRHandleDestroyer > UniqueActionSet
Scoped RAII pointer type wrapping XrActionSet.
Definition: UniqueHandles.h:66
std::unique_ptr< std::remove_pointer_t< XrInstance >, handle_destroyers::OpenXRHandleDestroyer > UniqueInstance
Scoped RAII pointer type wrapping XrInstance.
Definition: UniqueHandles.h:48
std::unique_ptr< std::remove_pointer_t< XrSpace >, handle_destroyers::OpenXRHandleDestroyer > UniqueSpace
Scoped RAII pointer type wrapping XrSpace.
Definition: UniqueHandles.h:70