Monado OpenXR Runtime
Pretty printing functions and helpers

This is common functionality used directly and shared by additional pretty printing functions implemented in multiple modules, such as OpenXR entrypoints. More...

Collaboration diagram for Pretty printing functions and helpers:

Files

file  u_pretty_print.c
 Pretty printing various Monado things.
 
file  u_pretty_print.h
 Pretty printing various Monado things.
 

Data Structures

struct  u_pp_delegate
 Helper struct to hold a function pointer and data pointer. More...
 
struct  u_pp_sink_stack_only
 Stack only pretty printer sink, no need to free, must be inited before use. More...
 

Typedefs

typedef void(* u_pp_delegate_func_t) (void *ptr, const char *str, size_t length)
 Function prototype for receiving pretty printed strings. More...
 
typedef struct u_pp_delegate u_pp_delegate_t
 Helper typedef for delegate struct, less typing. More...
 

Functions

void u_pp (struct u_pp_delegate dg, const char *fmt,...) XRT_PRINTF_FORMAT(2
 Formats a string and sends to the delegate. More...
 
void void u_pp_xrt_input_name (struct u_pp_delegate dg, enum xrt_input_name name)
 Pretty prints the xrt_input_name. More...
 
void u_pp_xrt_result (struct u_pp_delegate dg, xrt_result_t xret)
 Pretty prints the xrt_result_t. More...
 
void u_pp_xrt_reference_space_type (struct u_pp_delegate dg, enum xrt_reference_space_type type)
 Pretty prints the xrt_reference_space_type. More...
 
void u_pp_small_vec3 (u_pp_delegate_t dg, const struct xrt_vec3 *vec)
 Printers for math structs. More...
 
void u_pp_small_pose (u_pp_delegate_t dg, const struct xrt_pose *pose)
 
void u_pp_small_matrix_3x3 (u_pp_delegate_t dg, const struct xrt_matrix_3x3 *m)
 
void u_pp_small_matrix_4x4 (u_pp_delegate_t dg, const struct xrt_matrix_4x4 *m)
 
void u_pp_small_matrix_4x4_f64 (u_pp_delegate_t dg, const struct xrt_matrix_4x4_f64 *m)
 
void u_pp_small_array_f64 (struct u_pp_delegate dg, const double *arr, size_t n)
 
void u_pp_small_array2d_f64 (struct u_pp_delegate dg, const double *arr, size_t n, size_t m)
 
void u_pp_vec3 (u_pp_delegate_t dg, const struct xrt_vec3 *vec, const char *name, const char *indent)
 
void u_pp_pose (u_pp_delegate_t dg, const struct xrt_pose *pose, const char *name, const char *indent)
 
void u_pp_matrix_3x3 (u_pp_delegate_t dg, const struct xrt_matrix_3x3 *m, const char *name, const char *indent)
 
void u_pp_matrix_4x4 (u_pp_delegate_t dg, const struct xrt_matrix_4x4 *m, const char *name, const char *indent)
 
void u_pp_matrix_4x4_f64 (u_pp_delegate_t dg, const struct xrt_matrix_4x4_f64 *m, const char *name, const char *indent)
 
void u_pp_array_f64 (u_pp_delegate_t dg, const double *arr, size_t n, const char *name, const char *indent)
 Pretty prints double arr[n] More...
 
void u_pp_array2d_f64 (u_pp_delegate_t dg, const double *arr, size_t n, size_t m, const char *name, const char *indent)
 Pretty prints double arr[n][m] More...
 

Detailed Description

This is common functionality used directly and shared by additional pretty printing functions implemented in multiple modules, such as OpenXR entrypoints.

Some functions have a _indented suffix added to them, this means that what they print starts indented, but also they start with a newline. This is so they can easily be chained together to form a debug message printing out various information. Most of the final logging functions in Monado inserts a newline at the end of the message and we don't want two to be inserted.

Typedef Documentation

◆ u_pp_delegate_func_t

typedef void(* u_pp_delegate_func_t) (void *ptr, const char *str, size_t length)

#include <auxiliary/util/u_pretty_print.h>

Function prototype for receiving pretty printed strings.

Note
Do not keep a reference to the pointer as it's often allocated on the stack for speed.

◆ u_pp_delegate_t

#include <auxiliary/util/u_pretty_print.h>

Helper typedef for delegate struct, less typing.

Function Documentation

◆ u_pp()

void u_pp ( struct u_pp_delegate  dg,
const char *  fmt,
  ... 
)

◆ u_pp_array2d_f64()

void u_pp_array2d_f64 ( u_pp_delegate_t  dg,
const double *  arr,
size_t  n,
size_t  m,
const char *  name,
const char *  indent 
)

#include <auxiliary/util/u_pretty_print.h>

Pretty prints double arr[n][m]

References u_pp().

◆ u_pp_array_f64()

void u_pp_array_f64 ( u_pp_delegate_t  dg,
const double *  arr,
size_t  n,
const char *  name,
const char *  indent 
)

#include <auxiliary/util/u_pretty_print.h>

Pretty prints double arr[n]

References u_pp().

◆ u_pp_small_vec3()

void u_pp_small_vec3 ( u_pp_delegate_t  dg,
const struct xrt_vec3 vec 
)

#include <auxiliary/util/u_pretty_print.h>

Printers for math structs.

None of these functions inserts trailing newlines because it's hard to remove a trailing newline but easy to add one if one should be needed. The small functions do not insert a starting newline while the other functions does. This is so that you can easily chain print functions to print a struct.

Note
xrt_matrix_* parameters assumed to be column major.

References u_pp().

◆ u_pp_xrt_input_name()

void void u_pp_xrt_input_name ( struct u_pp_delegate  dg,
enum xrt_input_name  name 
)

#include <auxiliary/util/u_pretty_print.h>

Pretty prints the xrt_input_name.

◆ u_pp_xrt_reference_space_type()

void u_pp_xrt_reference_space_type ( struct u_pp_delegate  dg,
enum xrt_reference_space_type  type 
)

◆ u_pp_xrt_result()

void u_pp_xrt_result ( struct u_pp_delegate  dg,
xrt_result_t  xret 
)

#include <auxiliary/util/u_pretty_print.h>

Pretty prints the xrt_result_t.

References XRT_SUCCESS.