omni::extras::getOutArrayï
Defined in omni/extras/OutArrayUtils.h
-
template<typename T, typename GetCallable, typename FillCallable>
omni::core::Result omni::extras::getOutArray(GetCallable &&getFn, FillCallable &&fillFn, uint32_t stackCount = (4096 / sizeof(T)), uint32_t maxRetryCount = (UINT32_MAX - 1))ï Retrieves an array of unknown size using
getFn
and passes it tofillFn
.This utility is useful for transferring a raw array from the ABI to a modern C++ container.
In order to avoid heap access,
stackCount
can be used to try to transfer the array fromgetFn
tofillFn
using temporary stack storage.stackCount
is the number of Tâs that should be temporarily allocated on the stack. IfstackCount
is inadequate, this function falls back to using the heap. Care should be taken to not setstackCount
to a value that would cause a stack overflow.The source array may be dynamically growing in another thread, in which case this method will try
maxRetryCount
times to allocate an array of the proper size and retrieve the values. If this method exceeds the retry count, omni::core::kResultTryAgain is returned.- Return values
omni::core::kResultSuccess â on success, an appropriate error code otherwise.