An array object.
More...
|
#define | PW_ARRAY_INIT(extend) (struct pw_array) { NULL, 0, 0, extend } |
|
#define | pw_array_get_len_s(a, s) ((a)->size / (s)) |
|
#define | pw_array_get_unchecked_s(a, idx, s, t) SPA_PTROFF((a)->data,(idx)*(s),t) |
|
#define | pw_array_check_index_s(a, idx, s) ((idx) < pw_array_get_len_s(a,s)) |
|
#define | pw_array_get_len(a, t) pw_array_get_len_s(a,sizeof(t)) |
| Get the number of items of type t in array. More...
|
|
#define | pw_array_get_unchecked(a, idx, t) pw_array_get_unchecked_s(a,idx,sizeof(t),t) |
| Get the item with index idx and type t from array. More...
|
|
#define | pw_array_check_index(a, idx, t) pw_array_check_index_s(a,idx,sizeof(t)) |
| Check if an item with index idx and type t exist in array. More...
|
|
#define | pw_array_first(a) ((a)->data) |
|
#define | pw_array_end(a) SPA_PTROFF((a)->data, (a)->size, void) |
|
#define | pw_array_check(a, p) (SPA_PTROFF(p,sizeof(*p),void) <= pw_array_end(a)) |
|
#define | pw_array_for_each(pos, array) |
|
#define | pw_array_consume(pos, array) |
|
#define | pw_array_remove(a, p) |
|
#define | pw_array_add_ptr(a, p) *((void**) pw_array_add(a, sizeof(void*))) = (p) |
| Add a pointer to array. More...
|
|
An array object.
The array is a dynamically resizable data structure that can hold items of the same size.
◆ pw_array_add_ptr
#define pw_array_add_ptr |
( |
|
a, |
|
|
|
p |
|
) |
| *((void**) pw_array_add(a, sizeof(void*))) = (p) |
◆ pw_array_check
◆ pw_array_check_index
Check if an item with index idx and type t exist in array.
◆ pw_array_check_index_s
◆ pw_array_consume
#define pw_array_consume |
( |
|
pos, |
|
|
|
array |
|
) |
| |
Value:
pw_array_check(array, pos); \
◆ pw_array_end
◆ pw_array_first
#define pw_array_first |
( |
|
a | ) |
((a)->data) |
◆ pw_array_for_each
#define pw_array_for_each |
( |
|
pos, |
|
|
|
array |
|
) |
| |
Value:
pw_array_check(array, pos); \
(pos)++)
◆ pw_array_get_len
Get the number of items of type t in array.
◆ pw_array_get_len_s
#define pw_array_get_len_s |
( |
|
a, |
|
|
|
s |
|
) |
| ((a)->size / (s)) |
◆ pw_array_get_unchecked
Get the item with index idx and type t from array.
◆ pw_array_get_unchecked_s
#define pw_array_get_unchecked_s |
( |
|
a, |
|
|
|
idx, |
|
|
|
s, |
|
|
|
t |
|
) |
| SPA_PTROFF((a)->data,(idx)*(s),t) |
◆ PW_ARRAY_INIT
#define PW_ARRAY_INIT |
( |
|
extend | ) |
(struct pw_array) { NULL, 0, 0, extend } |
◆ pw_array_remove
#define pw_array_remove |
( |
|
a, |
|
|
|
p |
|
) |
| |
Value:({ \
(a)->
size -=
sizeof(*(p)); \
})