PipeWire: pw_array Class Reference

PipeWire 0.3.6

Public Member Functions | Data Fields
pw_array Class Reference

An array object. More...

## Public Member Functions
#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...
static void | pw_array_init (struct pw_array *arr, size_t extend)
| Initialize the array with given extend. More...
static int | pw_array_ensure_size (struct pw_array *arr, size_t size)
| Make sure size bytes can be added to the array. More...
static void * | pw_array_add (struct pw_array *arr, size_t size)
| Add ref size bytes to arr. More...
static void * | pw_array_add_fixed (struct pw_array *arr, size_t size)
| Add ref size bytes to arr. More...
#define | pw_array_add_ptr(a, p) *((void**) pw_array_add(a, sizeof(void*))) = (p)
| Add a pointer to array. More...

## Data Fields
void * | data
| pointer to array data More...
size_t | size
| length of array in bytes More...
size_t | alloc
| number of allocated memory in data More...
size_t | extend
| number of bytes to extend with More...

## Detailed Description

An array object.

The array is a dynamically resizable data structure that can hold items of the same size.

## Member Function Documentation

## ◆ pw_array_add()

static void * pw_array_add | ( | struct pw_array * | arr,
|  | size_t | size
| ) |  |
| inline

Add ref size bytes to arr.

A pointer to memory that can hold at least size bytes is returned

References data, pw_array_ensure_size(), and size.

Referenced by pw_impl_client::pw_context_create_client(), pw_map::pw_map_insert_at(), and pw_map::pw_map_insert_new().

## ◆ pw_array_add_fixed()

static void * pw_array_add_fixed | ( | struct pw_array * | arr,
|  | size_t | size
| ) |  |
| inline

Add ref size bytes to arr.

When there is not enough memory to hold size bytes, NULL is returned

References alloc, data, and size.

## ◆ pw_array_ensure_size()

static int pw_array_ensure_size | ( | struct pw_array * | arr,
|  | size_t | size
| ) |  |
| inline

Make sure size bytes can be added to the array.

References alloc, data, extend, and size.

Referenced by pw_array_add(), and pw_map::pw_map_init().

## ◆ pw_array_init()

static void pw_array_init | ( | struct pw_array * | arr,
|  | size_t | extend
| ) |  |
| inline

Initialize the array with given extend.

References alloc, data, extend, and size.

Referenced by pw_impl_client::pw_context_create_client(), pw_map::pw_map_init(), and pw_utils::pw_split_strv().

## Field Documentation

## ◆ alloc

size_t pw_array::alloc

number of allocated memory in data

Referenced by pw_array_add_fixed(), pw_array_ensure_size(), and pw_array_init().

## ◆ data

void* pw_array::data

pointer to array data

Referenced by pw_array_add(), pw_array_add_fixed(), pw_array_ensure_size(), pw_array_init(), pw_map::pw_map_insert_new(), and pw_utils::pw_split_strv().

## ◆ extend

size_t pw_array::extend

number of bytes to extend with

Referenced by pw_array_ensure_size(), pw_array_init(), and pw_map::pw_map_init().

## ◆ size

size_t pw_array::size

length of array in bytes

Referenced by pw_array_add(), pw_array_add_fixed(), pw_array_ensure_size(), pw_array_init(), and pw_map::pw_map_init().

The documentation for this class was generated from the following file:

- array.h