summaryrefslogtreecommitdiffstats
path: root/zix
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2011-09-19 16:37:22 +0000
committerDavid Robillard <d@drobilla.net>2011-09-19 16:37:22 +0000
commitf3f2fb716a132559b3adae3d8e9f2e122172f9e1 (patch)
treed3018deb4f80015202694e155549781876c8e63a /zix
parent2789cc7d0922b0e386bc28708a612433eaaa1742 (diff)
downloadzix-f3f2fb716a132559b3adae3d8e9f2e122172f9e1.tar.gz
zix-f3f2fb716a132559b3adae3d8e9f2e122172f9e1.tar.bz2
zix-f3f2fb716a132559b3adae3d8e9f2e122172f9e1.zip
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
Diffstat (limited to 'zix')
-rw-r--r--zix/sorted_array.h16
1 files changed, 16 insertions, 0 deletions
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 <http://drobilla.net>
@@ -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);