Monado OpenXR Runtime
|
Used to hold diverse child handles and ensure orderly destruction. More...
#include <oxr/oxr_objects.h>
Public Member Functions | |
XrResult | oxr_handle_destroy (struct oxr_logger *log, struct oxr_handle_base *hb) |
Destroy the handle's object, as well as all child handles recursively. More... | |
Data Fields | |
uint64_t | debug |
Magic (per-handle-type) value for debugging. More... | |
struct oxr_handle_base * | parent |
Pointer to this object's parent handle holder, if any. More... | |
struct oxr_handle_base * | children [256] |
Array of children, if any. More... | |
enum oxr_handle_state | state |
Current handle state. More... | |
oxr_handle_destroyer | destroy |
Destroy the object this handle refers to. More... | |
Protected Member Functions | |
XrResult | oxr_handle_init (struct oxr_logger *log, struct oxr_handle_base *hb, uint64_t debug, oxr_handle_destroyer destroy, struct oxr_handle_base *parent) |
Initialize a handle holder, and if a parent is specified, update its child list to include this handle. More... | |
Related Functions | |
(Note that these are not member functions.) | |
typedef XrResult(* | oxr_handle_destroyer) (struct oxr_logger *log, struct oxr_handle_base *hb) |
Function pointer type for a handle destruction function. More... | |
XrResult | oxr_handle_allocate_and_init (struct oxr_logger *log, size_t size, uint64_t debug, oxr_handle_destroyer destroy, struct oxr_handle_base *parent, void **out) |
Allocate some memory for use as a handle, and initialize it as a handle. More... | |
#define | OXR_ALLOCATE_HANDLE(LOG, OUT, DEBUG, DESTROY, PARENT) oxr_handle_allocate_and_init(LOG, sizeof(*OUT), DEBUG, DESTROY, PARENT, (void **)&OUT) |
Allocates memory for a handle and evaluates to an XrResult. More... | |
#define | OXR_ALLOCATE_HANDLE_OR_RETURN(LOG, OUT, DEBUG, DESTROY, PARENT) |
Allocate memory for a handle, returning in case of failure. More... | |
const char * | oxr_handle_state_to_string (enum oxr_handle_state state) |
Returns a human-readable label for a handle state. More... | |
Used to hold diverse child handles and ensure orderly destruction.
Each object referenced by an OpenXR handle should have one of these as its first element, thus "extending" this class.
|
protected |
Initialize a handle holder, and if a parent is specified, update its child list to include this handle.
|
related |
Allocates memory for a handle and evaluates to an XrResult.
LOG | pointer to struct oxr_logger |
OUT | the pointer to handle struct type you already created. |
DEBUG | Magic per-type debugging constant |
DESTROY | Handle destructor function |
PARENT | a parent handle, if any |
Use when you want to do something other than immediately returning in case of failure. If returning immediately is OK, see OXR_ALLOCATE_HANDLE_OR_RETURN().
|
related |
Allocate memory for a handle, returning in case of failure.
LOG | pointer to struct oxr_logger |
OUT | the pointer to handle struct type you already created. |
DEBUG | Magic per-type debugging constant |
DESTROY | Handle destructor function |
PARENT | a parent handle, if any |
Will return an XrResult from the current function if something fails. If that's not OK, see OXR_ALLOCATE_HANDLE().
Referenced by oxr_instance::oxr_instance_create(), and oxr_space_xdev_pose_create().
|
related |
Allocate some memory for use as a handle, and initialize it as a handle.
Mainly for internal use - use OXR_ALLOCATE_HANDLE instead which wraps this.
struct oxr_handle_base* oxr_handle_base::children[256] |
Array of children, if any.
uint64_t oxr_handle_base::debug |
Magic (per-handle-type) value for debugging.
oxr_handle_destroyer oxr_handle_base::destroy |
Destroy the object this handle refers to.
struct oxr_handle_base* oxr_handle_base::parent |
Pointer to this object's parent handle holder, if any.
enum oxr_handle_state oxr_handle_base::state |
Current handle state.