Monado OpenXR Runtime
Loading...
Searching...
No Matches
oxr_path_store Struct Reference

Path store structure for managing path storage and lookup. More...

#include <oxr/path/oxr_path_store.h>

Collaboration diagram for oxr_path_store:

Public Member Functions

XrResult oxr_path_store_init (struct oxr_path_store *store)
 Initialize the path store.
 
void oxr_path_store_fini (struct oxr_path_store *store)
 Destroy the path store and all paths.
 
bool oxr_path_store_is_valid (struct oxr_logger *log, const struct oxr_path_store *store, XrPath xr_path)
 Check if a path ID is valid.
 
XrResult oxr_path_store_get_or_create (struct oxr_path_store *store, 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.
 
void oxr_path_store_only_get (const struct oxr_path_store *store, const char *str, size_t length, XrPath *out_path)
 Only get the path for the given string if it exists.
 
XrResult oxr_path_store_get_string (const struct oxr_path_store *store, XrPath path, const char **out_str, size_t *out_length)
 Get a pointer and length of the internal string.
 

Data Fields

struct u_hashsetpath_store
 Path store, for looking up paths.
 
struct oxr_path ** path_array
 Mapping from ID to path.
 
size_t path_array_length
 Total length of path array.
 
size_t path_num
 Number of paths in the array (0 is always null).
 

Detailed Description

Path store structure for managing path storage and lookup.

Member Function Documentation

◆ oxr_path_store_fini()

void oxr_path_store_fini ( struct oxr_path_store store)

Destroy the path store and all paths.

References path_array, path_array_length, path_num, path_store, and u_hashset_clear_and_call_for_each().

◆ oxr_path_store_get_or_create()

XrResult oxr_path_store_get_or_create ( struct oxr_path_store store,
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.

References path_store.

◆ oxr_path_store_get_string()

XrResult oxr_path_store_get_string ( const struct oxr_path_store store,
XrPath  path,
const char **  out_str,
size_t out_length 
)

Get a pointer and length of the internal string.

The pointer has the same life time as the store. The length is the number of valid characters, not including the null termination character (but an extra null byte is always reserved at the end so can strings can be given to functions expecting null terminated strings).

◆ oxr_path_store_init()

XrResult oxr_path_store_init ( struct oxr_path_store store)

Initialize the path store.

References path_array, path_array_length, path_num, path_store, and U_ARRAY_REALLOC_OR_FREE.

◆ oxr_path_store_is_valid()

bool oxr_path_store_is_valid ( struct oxr_logger log,
const struct oxr_path_store store,
XrPath  xr_path 
)

Check if a path ID is valid.

◆ oxr_path_store_only_get()

void oxr_path_store_only_get ( const struct oxr_path_store store,
const char *  str,
size_t  length,
XrPath *  out_path 
)

Only get the path for the given string if it exists.

References path_store.

Field Documentation

◆ path_array

struct oxr_path** oxr_path_store::path_array

Mapping from ID to path.

Referenced by oxr_path_store_fini(), and oxr_path_store_init().

◆ path_array_length

size_t oxr_path_store::path_array_length

Total length of path array.

Referenced by oxr_path_store_fini(), and oxr_path_store_init().

◆ path_num

size_t oxr_path_store::path_num

Number of paths in the array (0 is always null).

Referenced by oxr_path_store_fini(), and oxr_path_store_init().

◆ path_store

struct u_hashset* oxr_path_store::path_store

The documentation for this struct was generated from the following file: