Monado OpenXR Runtime
Macros
oxr_two_call.h File Reference

Two call helper functions. More...

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define OXR_TWO_CALL_HELPER(log, cnt_input, cnt_output, output, count, data, sval)
 
#define OXR_TWO_CALL_FILL_IN_HELPER(log, cnt_input, cnt_output, output_structs, count, fill_fn, source_structs, sval)
 Calls fill_fn(&output_struct[i], &source_struct[i]) to fill output_structs. More...
 

Detailed Description

Two call helper functions.

Author
Ryan Pavlik ryan..nosp@m.pavl.nosp@m.ik@co.nosp@m.llab.nosp@m.ora.c.nosp@m.om
Jakob Bornecrantz jakob.nosp@m.@col.nosp@m.labor.nosp@m.a.co.nosp@m.m

Macro Definition Documentation

◆ OXR_TWO_CALL_FILL_IN_HELPER

#define OXR_TWO_CALL_FILL_IN_HELPER (   log,
  cnt_input,
  cnt_output,
  output_structs,
  count,
  fill_fn,
  source_structs,
  sval 
)
Value:
do { \
if (cnt_output == NULL) { \
return oxr_error(log, XR_ERROR_VALIDATION_FAILURE, \
#cnt_output); \
} \
*cnt_output = count; \
\
if (cnt_input == 0) { \
return sval; \
} \
if (cnt_input < count) { \
return oxr_error(log, XR_ERROR_SIZE_INSUFFICIENT, \
#cnt_input); \
} \
for (uint32_t i = 0; i < count; i++) { \
fill_fn(&output_structs[i], &source_structs[i]); \
} \
return sval; \
} while (false)
XrResult oxr_error(struct oxr_logger *logger, XrResult result, const char *fmt,...)
Definition: oxr_logger.c:79

Calls fill_fn(&output_struct[i], &source_struct[i]) to fill output_structs.

◆ OXR_TWO_CALL_HELPER

#define OXR_TWO_CALL_HELPER (   log,
  cnt_input,
  cnt_output,
  output,
  count,
  data,
  sval 
)
Value:
do { \
if (cnt_output == NULL) { \
return oxr_error(log, XR_ERROR_VALIDATION_FAILURE, \
#cnt_output); \
} \
*cnt_output = count; \
\
if (cnt_input == 0) { \
return sval; \
} \
if (cnt_input < count) { \
return oxr_error(log, XR_ERROR_SIZE_INSUFFICIENT, \
#cnt_input); \
} \
for (uint32_t i = 0; i < count; i++) { \
(output)[i] = (data)[i]; \
} \
return sval; \
} while (false)
XrResult oxr_error(struct oxr_logger *logger, XrResult result, const char *fmt,...)
Definition: oxr_logger.c:79