getOutArray#
Fully qualified name: 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
getFnand 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,
stackCountcan be used to try to transfer the array fromgetFntofillFnusing temporary stack storage.stackCountis the number of T’s that should be temporarily allocated on the stack. IfstackCountis inadequate, this function falls back to using the heap. Care should be taken to not setstackCountto 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
maxRetryCounttimes 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.