Loading...
Searching...
No Matches
su_vector.h
Go to the documentation of this file.
/*
* This file is part of the Sofia-SIP package
*
* Copyright (C) 2005 Nokia Corporation.
*
* Contact: Pekka Pessi <pekka.pessi@nokia-email.address.hidden>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA
*
*/
#ifndef SU_VECTOR_H
#define SU_VECTOR_H
#ifndef SU_ALLOC_H
#include <sofia-sip/su_alloc.h>
#endif
SOFIA_BEGIN_DECLS
typedef struct su_vector_s su_vector_t;
typedef void (* su_free_func_t) (void *data);
SU_DLL su_vector_t *su_vector_create(su_home_t *home, su_free_func_t free_f)
__attribute__((__malloc__));
SU_DLL void su_vector_destroy(su_vector_t *);
SU_DLL int su_vector_insert(su_vector_t *vector, usize_t index, void *item);
SU_DLL int su_vector_remove(su_vector_t *vector, usize_t index);
SU_DLL int su_vector_append(su_vector_t *, void *item);
SU_DLL void *su_vector_item(su_vector_t const *, usize_t i);
SU_DLL usize_t su_vector_len(su_vector_t const *l);
SU_DLL int su_vector_empty(su_vector_t *vector);
SU_DLL int su_vector_is_empty(su_vector_t const *vector);
#if SU_HAVE_INLINE
su_inline
su_home_t *su_vector_home(su_vector_t *s)
{
return (su_home_t *)s;
}
#else
#define su_vector_home(s) ((su_home_t *)(s))
#endif
SU_DLL void **su_vector_get_array(su_vector_t *)
__attribute__((__malloc__));
SU_DLL void su_vector_free_array(su_vector_t *, void *array[]);
SOFIA_END_DECLS
#endif /* !defined SU_VECTOR_H */
array
Description of array.
Definition foo.c:52
su_alloc.h
Home-based memory management interface.
su_home_t
SU_HOME_T su_home_t
Memory home type.
Definition su_alloc.h:50
su_inline
#define su_inline
Define as suitable declarator static inline functions.
Definition su_configure.h:90
su_vector_get_array
void ** su_vector_get_array(su_vector_t *))
Get an array of pointers from the vector.
Definition su_vector.c:298
su_vector_append
int su_vector_append(su_vector_t *, void *item)
Append a item to vector.
Definition su_vector.c:237
su_vector_create
su_vector_t * su_vector_create(su_home_t *home, su_free_func_t free_f))
Create a vector.
Definition su_vector.c:76
su_vector_empty
int su_vector_empty(su_vector_t *vector)
Remove all items from vector.
Definition su_vector.c:209
su_vector_item
void * su_vector_item(su_vector_t const *, usize_t i)
Get a numbered item from vector.
Definition su_vector.c:264
su_vector_remove
int su_vector_remove(su_vector_t *vector, usize_t index)
Remove an item from vector.
Definition su_vector.c:184
su_vector_insert
int su_vector_insert(su_vector_t *vector, usize_t index, void *item)
Insert an item to vector.
Definition su_vector.c:162
su_vector_len
usize_t su_vector_len(su_vector_t const *l)
Get number of items in vector.
Definition su_vector.c:277
su_vector_destroy
void su_vector_destroy(su_vector_t *)
Destroy a vector.
Definition su_vector.c:95
su_vector_free_array
void su_vector_free_array(su_vector_t *, void *array[])
Free the array.

Sofia-SIP 1.12.11devel - Copyright (C) 2006 Nokia Corporation. All rights reserved. Licensed under the terms of the GNU Lesser General Public License.