libref_array
0.1.3
Main Page
Modules
Files
File List
All
Functions
Typedefs
Enumerations
Groups
Pages
ref_array.h
1
/*
2
REF ARRAY
3
4
Header file for of the dynamic array with reference count.
5
6
Copyright (C) Dmitri Pal <dpal@redhat.com> 2009
7
8
This program is free software; you can redistribute it and/or modify
9
it under the terms of the GNU Lesser General Public License as published by
10
the Free Software Foundation; either version 3 of the License, or
11
(at your option) any later version.
12
This program is distributed in the hope that it will be useful,
13
but WITHOUT ANY WARRANTY; without even the implied warranty of
14
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
GNU General Public License for more details.
16
You should have received a copy of the GNU Lesser General Public License
17
along with this program. If not, see <http://www.gnu.org/licenses/>.
18
*/
19
20
#ifndef REF_ARRAY_H
21
#define REF_ARRAY_H
22
23
#include <stdint.h>
24
#include <stdlib.h>
25
26
struct
ref_array;
27
28
#ifndef EOK
29
#define EOK 0
30
#endif
31
74
typedef
enum
75
{
76
REF_ARRAY_DESTROY,
77
REF_ARRAY_DELETE,
78
}
ref_array_del_enum
;
79
80
87
typedef
void (*
ref_array_fn
)(
void
*elem,
88
ref_array_del_enum
type,
89
void
*data);
90
91
108
int
ref_array_create
(
struct
ref_array **ra,
109
size_t
elem,
110
uint32_t grow_by,
111
ref_array_fn
cb,
112
void
*data);
113
122
struct
ref_array *
ref_array_getref
(
struct
ref_array *ra);
123
131
void
ref_array_destroy
(
struct
ref_array *ra);
132
149
int
ref_array_append
(
struct
ref_array *ra,
void
*element);
150
175
void
*
ref_array_get
(
struct
ref_array *ra, uint32_t idx,
void
*acptr);
176
189
int
ref_array_getlen
(
struct
ref_array *ra, uint32_t *len);
190
200
uint32_t
ref_array_len
(
struct
ref_array *ra);
201
228
int
ref_array_insert
(
struct
ref_array *ra,
229
uint32_t idx,
230
void
*element);
253
int
ref_array_replace
(
struct
ref_array *ra,
254
uint32_t idx,
255
void
*element);
256
257
274
int
ref_array_remove
(
struct
ref_array *ra,
275
uint32_t idx);
276
277
294
int
ref_array_swap
(
struct
ref_array *ra,
295
uint32_t idx1,
296
uint32_t idx2);
297
298
314
void
ref_array_reset
(
struct
ref_array *ra);
315
321
#endif
Generated by
1.8.1