XRTraits C++ OpenXR Utilities
|
Functions simplifying calls that return a variable-length buffer/array. More...
Functions | |
template<typename T , typename F , typename... Args> | |
std::vector< T > | xrtraits::doTwoCall (F &&wrappedCall, Args &&... a) |
template<typename T , typename F , typename... Args> | |
std::vector< T > | xrtraits::doTwoCallWithSizeHint (uint32_t sizeHint, F &&wrappedCall, Args &&... a) |
template<typename T , typename F , typename... Args> | |
XrResult | xrtraits::doTwoCallInPlace (std::vector< T > &container, F &&wrappedCall, Args &&... a) |
Functions simplifying calls that return a variable-length buffer/array.
Some of these functions may take a leading argument, such as a size hint or a container to populate. However, after that possible argument, the rest are standardized:
capacityInput
, countOutput
, and array
parameters as its only (if no more arguments are passed to the function) or last (if additional parameters are passed) parameters.capacityInput
, countOutput
, and array
parameters.
|
inline |
#include <xrtraits/TwoCall.h>
Perform the two call idiom, returning a vector.
T | The type of the buffer element you expect |
wrappedCall | A function or lambda that takes the capacityInput , countOutput , and array parameters as its only or last parameters. |
a | Any additional arguments passed to this call will be forwarded to the call before the capacityInput , countOutput , and array parameters. |
if | final call does not return XR_SUCCESS |
Requires XR_USE_EXCEPTIONS.
References xrtraits::make_zeroed_vector(), and xrtraits::exceptions::throwIfNotUnqualifiedSuccess().
|
inline |
#include <xrtraits/TwoCall.h>
Perform the two call idiom, returning XrResult, to populate an existing container, whose size may hint at expected count.
container | The container to fill. If it is not empty, the buffer size will be used as a size hint: if sufficient, only one call to the wrappedCall will be made. |
wrappedCall | A function or lambda that takes the capacityInput , countOutput , and array parameters as its only or last parameters. |
a | Any additional arguments passed to this call will be forwarded to the call before the capacityInput , countOutput , and array parameters. |
Does not require XR_USE_EXCEPTIONS.
|
inline |
#include <xrtraits/TwoCall.h>
Perform the two call idiom, returning a vector, when we already have a hint about the capacity.
T | The type of the buffer element you expect |
sizeHint | The buffer size to attempt: if sufficient, only one call to the wrappedCall will be made. |
wrappedCall | A function or lambda that takes the capacityInput , countOutput , and array parameters as its only or last parameters. |
a | Any additional arguments passed to this call will be forwarded to the call before the capacityInput , countOutput , and array parameters. |
if | final call does not return XR_SUCCESS |
Requires XR_USE_EXCEPTIONS.
References xrtraits::make_zeroed_vector(), and xrtraits::exceptions::throwIfNotUnqualifiedSuccess().