]> code.delx.au - pulseaudio/blob - src/pulsecore/dynarray.h
Merge branch 'master' of git://0pointer.de/pulseaudio into dbus-work
[pulseaudio] / src / pulsecore / dynarray.h
1 #ifndef foopulsecoredynarrayhfoo
2 #define foopulsecoredynarrayhfoo
3
4 /***
5 This file is part of PulseAudio.
6
7 Copyright 2004-2008 Lennart Poettering
8
9 PulseAudio is free software; you can redistribute it and/or modify
10 it under the terms of the GNU Lesser General Public License as
11 published by the Free Software Foundation; either version 2.1 of the
12 License, or (at your option) any later version.
13
14 PulseAudio is distributed in the hope that it will be useful, but
15 WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 Lesser General Public License for more details.
18
19 You should have received a copy of the GNU Lesser General Public
20 License along with PulseAudio; if not, write to the Free Software
21 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
22 USA.
23 ***/
24
25 #include <pulsecore/idxset.h>
26
27 typedef struct pa_dynarray pa_dynarray;
28
29 /* Implementation of a simple dynamically sized array. The array
30 * expands if required, but doesn't shrink if possible. Memory
31 * management of the array's entries is the user's job. */
32
33 pa_dynarray* pa_dynarray_new(void);
34
35 /* Free the array calling the specified function for every entry in
36 * the array. The function may be NULL. */
37 void pa_dynarray_free(pa_dynarray* a, pa_free2_cb_t free_func, void *userdata);
38
39 /* Store p at position i in the array */
40 void pa_dynarray_put(pa_dynarray*a, unsigned i, void *p);
41
42 /* Store p a the first free position in the array. Returns the index
43 * of that entry. If entries are removed from the array their position
44 * are not filled any more by this function. */
45 unsigned pa_dynarray_append(pa_dynarray*a, void *p);
46
47 void *pa_dynarray_get(pa_dynarray*a, unsigned i);
48
49 unsigned pa_dynarray_size(pa_dynarray*a);
50
51 #endif