Monado OpenXR Runtime
Loading...
Searching...
No Matches
oxr_path_wrappers.h
Go to the documentation of this file.
1// Copyright 2019-2020, Collabora, Ltd.
2// Copyright 2025-2026, NVIDIA CORPORATION.
3// SPDX-License-Identifier: BSL-1.0
4/*!
5 * @file
6 * @brief Wrapper functions that take oxr_instance and call into path/cache functions.
7 * @author Jakob Bornecrantz <jakob@collabora.com>
8 * @ingroup oxr_main
9 */
10
11#pragma once
12
14
16#include "oxr_path_store.h"
17
18#include "../oxr_objects.h"
19
20
21#ifdef __cplusplus
22extern "C" {
23#endif
24
25/*!
26 * @public @memberof oxr_instance
27 */
28static inline bool
29oxr_path_is_valid(struct oxr_logger *log, struct oxr_instance *inst, XrPath path)
30{
31 return oxr_path_store_is_valid(log, &inst->path_store, path);
32}
33
34/*!
35 * Get the path for the given string if it exists, or create it if it does not.
36 *
37 * @public @memberof oxr_instance
38 */
39static inline XrResult
41 struct oxr_logger *log, struct oxr_instance *inst, const char *str, size_t length, XrPath *out_path)
42{
43 return oxr_path_store_get_or_create(&inst->path_store, str, length, out_path);
44}
45
46/*!
47 * Only get the path for the given string if it exists.
48 *
49 * @public @memberof oxr_instance
50 */
51static inline void
52oxr_path_only_get(struct oxr_logger *log, struct oxr_instance *inst, const char *str, size_t length, XrPath *out_path)
53{
54 oxr_path_store_only_get(&inst->path_store, str, length, out_path);
55}
56
57/*!
58 * Get a pointer and length of the internal string.
59 *
60 * The pointer has the same life time as the instance. The length is the number
61 * of valid characters, not including the null termination character (but an
62 * extra null byte is always reserved at the end so can strings can be given
63 * to functions expecting null terminated strings).
64 *
65 * @public @memberof oxr_instance
66 */
67static inline XrResult
69 struct oxr_logger *log, const struct oxr_instance *inst, XrPath path, const char **out_str, size_t *out_length)
70{
71 return oxr_path_store_get_string(&inst->path_store, path, out_str, out_length);
72}
73
74
75#ifdef __cplusplus
76}
77#endif
Forward declarations for OpenXR state tracker structs.
Path store structure and functions.
Main object that ties everything together.
Definition oxr_objects.h:1214
struct oxr_path_store path_store
Path store for managing paths.
Definition oxr_objects.h:1241
static XrResult oxr_path_get_string(struct oxr_logger *log, const struct oxr_instance *inst, XrPath path, const char **out_str, size_t *out_length)
Get a pointer and length of the internal string.
Definition oxr_path_wrappers.h:68
static void oxr_path_only_get(struct oxr_logger *log, struct oxr_instance *inst, const char *str, size_t length, XrPath *out_path)
Only get the path for the given string if it exists.
Definition oxr_path_wrappers.h:52
static XrResult oxr_path_get_or_create(struct oxr_logger *log, struct oxr_instance *inst, const char *str, size_t length, XrPath *out_path)
Get the path for the given string if it exists, or create it if it does not.
Definition oxr_path_wrappers.h:40
Logger struct that lives on the stack, one for each call client call.
Definition oxr_logger.h:44
Include all of the openxr headers in one place.