PipeWire
0.2.0
|
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 bool | 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 void | pw_map_for_each (struct pw_map *map, void(*func)(void *, void *), 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 |
Clear a map.
map | the map to clear |
Referenced by pw_core::pw_core_destroy(), and pw_remote_disconnect().
|
inline |
Iterate all map items.
map | the map to iterate |
func | the function to call for each item |
data | data to pass to func |
References pw_map_item::data, items, pw_array_for_each, and pw_map_item_is_free.
Referenced by pw_client::pw_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_core::pw_core_new(), and pw_remote_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_port_add(), pw_proxy::pw_proxy_destroy(), 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, items, pw_map_item::next, and pw_array::pw_array_add().
Referenced by pw_global::pw_global_register(), pw_node::pw_node_get_free_port(), pw_node_get_free_port_id(), pw_proxy::pw_proxy_new(), and pw_resource_new().
|
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_client_find_resource(), pw_core_find_global(), pw_node_find_port(), and pw_remote_find_proxy().
|
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_global::pw_global_destroy().
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().