Monado OpenXR Runtime
Loading...
Searching...
No Matches
oxr_interaction_profile_array.h
Go to the documentation of this file.
1// Copyright 2026, NVIDIA CORPORATION.
2// SPDX-License-Identifier: BSL-1.0
3/*!
4 * @file
5 * @brief Holds interaction profile array related functions.
6 * @author Jakob Bornecrantz <tbornecrantz@nvidia.com>
7 * @ingroup oxr_main
8 */
9
10#pragma once
11
12#include "xrt/xrt_compiler.h"
13#include "xrt/xrt_device.h"
14
15#include "oxr_extension_support.h"
17
18
19#ifdef __cplusplus
20extern "C" {
21#endif
22
23
24/*!
25 * Manages an array of interaction profiles, does not have a init function
26 * but must be zero initialized where it is declared.
27 */
29{
30 struct oxr_interaction_profile **profiles;
31 size_t count;
32};
33
34/*!
35 * Frees all profiles on the interaction profile array.
36 *
37 * Frees all interaction profiles in the array and then frees the internal array
38 * does not free the struct passed in. After this call, the array structure is
39 * reset to an empty state.
40 *
41 * @param array Interaction profile array to destroy, must not be NULL
42 * @public @memberof oxr_interaction_profile_array
43 */
44void
45oxr_interaction_profile_array_clear(struct oxr_interaction_profile_array *array) XRT_NONNULL_ALL;
46
47/*!
48 * Add an interaction profile to the array.
49 *
50 * The profile is added to the end of the array. The array takes ownership of
51 * the profile pointer.
52 *
53 * @param array Interaction profile array to add to, must not be NULL
54 * @param profile Interaction profile to add, must not be NULL
55 * @public @memberof oxr_interaction_profile_array
56 */
57void
58oxr_interaction_profile_array_add(struct oxr_interaction_profile_array *array,
59 struct oxr_interaction_profile *profile) XRT_NONNULL_ALL;
60
61/*!
62 * Clone an interaction profile array.
63 *
64 * Creates a deep copy of the source array, including cloning all interaction
65 * profiles it contains. The destination array is first cleared (destroying any
66 * existing profiles) before cloning.
67 *
68 * @param src Source interaction profile array to clone, must not be NULL
69 * @param dst Destination interaction profile array, must not be NULL
70 * @public @memberof oxr_interaction_profile_array
71 */
72void
73oxr_interaction_profile_array_clone(const struct oxr_interaction_profile_array *src,
74 struct oxr_interaction_profile_array *dst) XRT_NONNULL_ALL;
75
76/*!
77 * Find an interaction profile in the array by its path.
78 *
79 * Searches the array for an interaction profile with the matching XrPath.
80 *
81 * @param array Interaction profile array to search, must not be NULL
82 * @param path XrPath to search for
83 * @param[out] out_p Pointer to store the found interaction profile, must not be NULL. Set to NULL if not found.
84 * @return true if a matching profile was found, false otherwise
85 * @public @memberof oxr_interaction_profile_array
86 */
87bool
88oxr_interaction_profile_array_find_by_path(const struct oxr_interaction_profile_array *array,
89 XrPath path,
90 struct oxr_interaction_profile **out_p) XRT_NONNULL_ALL;
91
92/*!
93 * Find an interaction profile in the array by device name.
94 *
95 * Maps a @ref xrt_device_name to an interaction profile by searching through
96 * profile templates and then finding the matching profile in the array. There
97 * might be multiple OpenXR interaction profiles that map to a single device
98 * name, so the function continues searching until it finds a profile that
99 * exists in the array.
100 *
101 * @param array Interaction profile array to search, must not be NULL
102 * @param name Device name to search for, can be XRT_DEVICE_INVALID.
103 * @param[out] out_p Pointer to store the found interaction profile, must not be NULL. Set to NULL if not found.
104 * @return true if a matching profile was found, false otherwise
105 * @public @memberof oxr_interaction_profile_array
106 */
107bool
108oxr_interaction_profile_array_find_by_device_name(const struct oxr_interaction_profile_array *array,
109 const struct oxr_instance_path_cache *cache,
110 enum xrt_device_name name,
111 struct oxr_interaction_profile **out_p) XRT_NONNULL_ALL;
112
113/*!
114 * Find an interaction profile in the array by device. This function uses
115 * @ref oxr_interaction_profile_array_find_by_device_name but also loops through
116 * the bindings xrt_device::binding_profiles mappings.
117 *
118 * @param array Interaction profile array to search, must not be NULL.
119 * @param[out] out_p Pointer to store the found interaction profile, must not be NULL. Set to NULL if not found.
120 * @return true if a matching profile was found, false otherwise.
121 * @public @memberof oxr_interaction_profile_array
122 */
123bool
124oxr_interaction_profile_array_find_by_device(const struct oxr_interaction_profile_array *array,
125 const struct oxr_instance_path_cache *cache,
126 struct xrt_device *xdev,
127 struct oxr_interaction_profile **out_p) XRT_NONNULL_FIRST;
128
129
130#ifdef __cplusplus
131}
132#endif
Forward declarations for OpenXR state tracker structs.
This holds cached paths for subaction paths.
Definition oxr_instance_path_cache.h:27
Manages an array of interaction profiles, does not have a init function but must be zero initialized ...
Definition oxr_interaction_profile_array.h:29
A single interaction profile.
Definition oxr_objects.h:1553
A single HMD or input device.
Definition xrt_device.h:310
Header holding common defines.
xrt_device_name
A enum that is used to name devices so that the state trackers can reason about the devices easier.
Definition xrt_defines.h:724
Header defining an xrt display or controller device.