su 1.12.10
|
00001 /* 00002 * This file is part of the Sofia-SIP package 00003 * 00004 * Copyright (C) 2005 Nokia Corporation. 00005 * 00006 * Contact: Pekka Pessi <pekka.pessi@nokia-email.address.hidden> 00007 * 00008 * This library is free software; you can redistribute it and/or 00009 * modify it under the terms of the GNU Lesser General Public License 00010 * as published by the Free Software Foundation; either version 2.1 of 00011 * the License, or (at your option) any later version. 00012 * 00013 * This library is distributed in the hope that it will be useful, but 00014 * WITHOUT ANY WARRANTY; without even the implied warranty of 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00016 * Lesser General Public License for more details. 00017 * 00018 * You should have received a copy of the GNU Lesser General Public 00019 * License along with this library; if not, write to the Free Software 00020 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 00021 * 02110-1301 USA 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 /* !defined SU_VECTOR_H */