From f3f2fb716a132559b3adae3d8e9f2e122172f9e1 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Mon, 19 Sep 2011 16:37:22 +0000 Subject: Export API functions. Use unchecked inline index function in search. git-svn-id: http://svn.drobilla.net/zix/trunk@26 df6676b4-ccc9-40e5-b5d6-7c4628a128e3 --- zix/sorted_array.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'zix') diff --git a/zix/sorted_array.h b/zix/sorted_array.h index da3a1d4..1d508f2 100644 --- a/zix/sorted_array.h +++ b/zix/sorted_array.h @@ -1,3 +1,4 @@ + /* Copyright 2011 David Robillard @@ -45,6 +46,7 @@ typedef void* ZixSortedArrayIter; /** Create a new (empty) sorted array. */ +ZIX_API ZixSortedArray* zix_sorted_array_new(bool allow_duplicates, ZixComparator cmp, void* cmp_data, size_t elem_size); @@ -52,18 +54,21 @@ zix_sorted_array_new(bool allow_duplicates, ZixComparator cmp, void* cmp_data, /** Free @a a. */ +ZIX_API void zix_sorted_array_free(ZixSortedArray* a); /** Return the number of elements in @a a. */ +ZIX_API size_t zix_sorted_array_size(ZixSortedArray* a); /** Insert the element @a e into @a a and point @a ai at the new element. */ +ZIX_API ZixStatus zix_sorted_array_insert(ZixSortedArray* a, const void* e, @@ -72,6 +77,7 @@ zix_sorted_array_insert(ZixSortedArray* a, /** Remove the item pointed at by @a ai from @a a. */ +ZIX_API ZixStatus zix_sorted_array_remove(ZixSortedArray* a, ZixSortedArrayIter ai); @@ -79,41 +85,51 @@ zix_sorted_array_remove(ZixSortedArray* a, ZixSortedArrayIter ai); Set @a ai to be the largest element <= @a e in @a a. If no such item exists, @a ai is set to NULL. */ +ZIX_API ZixStatus zix_sorted_array_find(const ZixSortedArray* a, const void* e, ZixSortedArrayIter* ai); +/** + Return the element at index @a index. +*/ +ZIX_API void* zix_sorted_array_index(const ZixSortedArray* a, size_t index); /** Return the data associated with the given array item. */ +ZIX_API void* zix_sorted_array_get_data(ZixSortedArrayIter ai); /** Return an iterator to the first (smallest) element in @a a. */ +ZIX_API ZixSortedArrayIter zix_sorted_array_begin(ZixSortedArray* a); /** Return an iterator the the element one past the last element in @a a. */ +ZIX_API ZixSortedArrayIter zix_sorted_array_end(ZixSortedArray* a); /** Return true iff @a a is an iterator to the end of its tree. */ +ZIX_API bool zix_sorted_array_iter_is_end(ZixSortedArray* a, ZixSortedArrayIter i); /** Return an iterator that points to the element one past @a a. */ +ZIX_API ZixSortedArrayIter zix_sorted_array_iter_next(ZixSortedArray* a, ZixSortedArrayIter i); -- cgit v1.2.1