Monado OpenXR Runtime
Macros | Functions
oxr_handle_base.c File Reference

Implementation. More...

#include "oxr_handle.h"
#include "util/u_debug.h"
#include "util/u_misc.h"
#include "oxr_objects.h"
#include "oxr_logger.h"
#include <assert.h>
#include <string.h>
#include <stdlib.h>
Include dependency graph for oxr_handle_base.c:

Macros

#define HANDLE_LIFECYCLE_LOG(log, ...)
 
#define HANDLE_LIFECYCLE_LOG_SCOPED_BEGIN(log)
 
#define HANDLE_LIFECYCLE_LOG_SCOPED_END
 
#define HANDLE_LIFECYCLE_LOG_SCOPED(log, ...)
 

Functions

const char * oxr_handle_state_to_string (enum oxr_handle_state state)
 Returns a human-readable label for a handle state. More...
 
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...
 
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...
 
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...
 

Detailed Description

Implementation.

Author
Ryan Pavlik ryan..nosp@m.pavl.nosp@m.ik@co.nosp@m.llab.nosp@m.ora.c.nosp@m.om

Macro Definition Documentation

◆ HANDLE_LIFECYCLE_LOG

#define HANDLE_LIFECYCLE_LOG (   log,
  ... 
)
Value:
if (log->inst != NULL && log->inst->lifecycle_verbose) { \
oxr_log(log, " Handle Lifecycle: " __VA_ARGS__); \
}

◆ HANDLE_LIFECYCLE_LOG_SCOPED

#define HANDLE_LIFECYCLE_LOG_SCOPED (   log,
  ... 
)
Value:
if (_log_lifecycle_verbose) { \
oxr_log(log, " Handle Lifecycle: " __VA_ARGS__); \
}

Referenced by oxr_handle_destroy().

◆ HANDLE_LIFECYCLE_LOG_SCOPED_BEGIN

#define HANDLE_LIFECYCLE_LOG_SCOPED_BEGIN (   log)
Value:
{ \
const bool _log_lifecycle_verbose = \
log->inst != NULL && log->inst->lifecycle_verbose;

Referenced by oxr_handle_destroy().

◆ HANDLE_LIFECYCLE_LOG_SCOPED_END

#define HANDLE_LIFECYCLE_LOG_SCOPED_END
Value:
} \
(void)0

Function Documentation

◆ oxr_handle_allocate_and_init()

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.

Mainly for internal use - use OXR_ALLOCATE_HANDLE instead which wraps this.

◆ oxr_handle_init()

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.