PipeWire  0.3.33
map.h File Reference

Go to the source code of this file.

Data Structures

union  pw_map_item
 An entry in the map. More...
 
struct  pw_map
 A map. More...
 

Macros

#define PW_MAP_INIT(extend)   (struct pw_map) { PW_ARRAY_INIT(extend), SPA_ID_INVALID }
 
#define pw_map_get_size(m)   pw_array_get_len(&(m)->items, union pw_map_item)
 
#define pw_map_get_item(m, id)   pw_array_get_unchecked(&(m)->items,id,union pw_map_item)
 
#define pw_map_item_is_free(item)   ((item)->next & 0x1)
 
#define pw_map_id_is_free(m, id)   (pw_map_item_is_free(pw_map_get_item(m,id)))
 
#define pw_map_check_id(m, id)   ((id) < pw_map_get_size(m))
 
#define pw_map_has_item(m, id)   (pw_map_check_id(m,id) && !pw_map_id_is_free(m, id))
 
#define pw_map_lookup_unchecked(m, id)   pw_map_get_item(m,id)->data
 
#define PW_MAP_ID_TO_PTR(id)   (SPA_UINT32_TO_PTR((id)<<1))
 Convert an id to a pointer that can be inserted into the map. More...
 
#define PW_MAP_PTR_TO_ID(p)   (SPA_PTR_TO_UINT32(p)>>1)
 Convert a pointer to an id that can be retrieved from the map. More...