PipeWire
0.3.15
|
A map. More...
Public Member Functions | |
#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... | |
static void | pw_map_init (struct pw_map *map, size_t size, size_t extend) |
Initialize a map. More... | |
static void | pw_map_clear (struct pw_map *map) |
Clear a map. More... | |
static uint32_t | pw_map_insert_new (struct pw_map *map, void *data) |
Insert data in the map. More... | |
static int | pw_map_insert_at (struct pw_map *map, uint32_t id, void *data) |
Insert data in the map at an index. More... | |
static void | pw_map_remove (struct pw_map *map, uint32_t id) |
Remove an item at index. More... | |
static void * | pw_map_lookup (struct pw_map *map, uint32_t id) |
Find an item in the map. More... | |
static int | pw_map_for_each (struct pw_map *map, int(*func)(void *item_data, void *data), void *data) |
Iterate all map items. More... | |
Data Fields | |
struct pw_array | items |
an array with the map items More... | |
uint32_t | free_list |
the free items More... | |
A map.
A map that holds objects indexed by id
|
inline |
|
inline |
Iterate all map items.
map | the map to iterate |
func | the function to call for each item, the item data and data is passed to the function. When func returns a non-zero result, iteration ends and the result is returned. |
data | data to pass to func |
References pw_map_item::data, items, pw_array_for_each, pw_map_item_is_free, and res.
Referenced by pw_impl_client::pw_impl_client_destroy().
|
inline |
Initialize a map.
map | the map to initialize |
size | the initial size of the map |
extend | the amount to bytes to grow the map with when needed |
References pw_array::extend, free_list, items, pw_array::pw_array_ensure_size(), pw_array::pw_array_init(), and pw_array::size.
Referenced by pw_mempool_new().
|
inline |
Insert data in the map at an index.
map | the map to inser into |
id | the index to insert at |
data | the data to insert |
References pw_map_item::data, items, pw_array::pw_array_add(), pw_map_get_item, and pw_map_get_size.
Referenced by pw_global::pw_global_bind(), pw_impl_port_add(), pw_resource_destroy(), and pw_resource_new().
|
inline |
Insert data in the map.
map | the map to insert into |
data | the item to add |
References pw_array::data, pw_map_item::data, free_list, id, items, pw_map_item::next, and pw_array::pw_array_add().
Referenced by pw_global::pw_global_new(), pw_impl_node_get_free_port_id(), pw_impl_port_init_mix(), and pw_proxy_init().
|
inline |
Find an item in the map.
map | the map to use |
id | the index to look at |
References pw_map_item::data, pw_map_check_id, pw_map_get_item, and pw_map_item_is_free.
Referenced by pw_core_find_proxy(), pw_impl_client_find_resource(), pw_impl_node_find_port(), pw_impl_port_add(), pw_mempool_find_id(), pw_mempool_map_id(), and pw_mempool_remove_id().
|
inline |
Remove an item at index.
map | the map to remove from |
id | the index to remove |
References free_list, and pw_map_get_item.
Referenced by pw_impl_port_release_mix(), pw_memblock::pw_memblock_free(), pw_mempool_remove_id(), and pw_proxy_init().
uint32_t pw_map::free_list |
the free items
Referenced by pw_map_init(), pw_map_insert_new(), and pw_map_remove().
struct pw_array pw_map::items |
an array with the map items
Referenced by pw_map_for_each(), pw_map_init(), pw_map_insert_at(), and pw_map_insert_new().