PipeWire  0.3.33
Map Objects

A map that holds objects indexed by id. More...

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...
 

Detailed Description

A map that holds objects indexed by id.

Macro Definition Documentation

◆ pw_map_check_id

#define pw_map_check_id (   m,
  id 
)    ((id) < pw_map_get_size(m))

◆ pw_map_get_item

#define pw_map_get_item (   m,
  id 
)    pw_array_get_unchecked(&(m)->items,id,union pw_map_item)

◆ pw_map_get_size

#define pw_map_get_size (   m)    pw_array_get_len(&(m)->items, union pw_map_item)

◆ pw_map_has_item

#define pw_map_has_item (   m,
  id 
)    (pw_map_check_id(m,id) && !pw_map_id_is_free(m, id))

◆ pw_map_id_is_free

#define pw_map_id_is_free (   m,
  id 
)    (pw_map_item_is_free(pw_map_get_item(m,id)))

◆ PW_MAP_ID_TO_PTR

#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.

◆ PW_MAP_INIT

#define PW_MAP_INIT (   extend)    (struct pw_map) { PW_ARRAY_INIT(extend), SPA_ID_INVALID }

◆ pw_map_item_is_free

#define pw_map_item_is_free (   item)    ((item)->next & 0x1)

◆ pw_map_lookup_unchecked

#define pw_map_lookup_unchecked (   m,
  id 
)    pw_map_get_item(m,id)->data

◆ PW_MAP_PTR_TO_ID

#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.