Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef SU_VECTOR_H
00026
00027 #define SU_VECTOR_H
00028
00037 #ifndef SU_ALLOC_H
00038 #include <sofia-sip/su_alloc.h>
00039 #endif
00040
00041 SOFIA_BEGIN_DECLS
00042
00043 typedef struct su_vector_s su_vector_t;
00044 typedef void (* su_free_func_t) (void *data);
00045
00047 SU_DLL su_vector_t *su_vector_create(su_home_t *home, su_free_func_t free_f)
00048 __attribute__((__malloc__));
00049
00051 SU_DLL void su_vector_destroy(su_vector_t *);
00052
00054 SU_DLL int su_vector_insert(su_vector_t *vector, usize_t index, void *item);
00055
00056 SU_DLL int su_vector_remove(su_vector_t *vector, usize_t index);
00057
00059 SU_DLL int su_vector_append(su_vector_t *, void *item);
00060
00062 SU_DLL void *su_vector_item(su_vector_t const *, usize_t i);
00063
00065 SU_DLL usize_t su_vector_len(su_vector_t const *l);
00066
00067 SU_DLL int su_vector_empty(su_vector_t *vector);
00068 SU_DLL int su_vector_is_empty(su_vector_t const *vector);
00069
00070 #if SU_HAVE_INLINE
00071 su_inline
00072 su_home_t *su_vector_home(su_vector_t *s)
00073 {
00074 return (su_home_t *)s;
00075 }
00076 #else
00077 #define su_vector_home(s) ((su_home_t *)(s))
00078 #endif
00079
00081 SU_DLL void **su_vector_get_array(su_vector_t *)
00082 __attribute__((__malloc__));
00083
00085 SU_DLL void su_vector_free_array(su_vector_t *, void *array[]);
00086
00087 SOFIA_END_DECLS
00088
00089 #endif