]> git.evergreen-ils.org Git - OpenSRF.git/blob - include/opensrf/osrf_hash.h
Created a new function osrfHashExtract(). It extracts an item with a
[OpenSRF.git] / include / opensrf / osrf_hash.h
1 #ifndef OSRF_HASH_H
2 #define OSRF_HASH_H
3
4 /**
5         @file osrf_hash.h
6         @brief A hybrid between a hash table and a doubly linked list.
7
8         The hash table supports random lookups by key.  The list supports iterative traversals.
9         The sequence of entries in the list reflects the sequence in which the keys were added.
10
11         osrfHashIterators are somewhat unusual in that, if an iterator is positioned on a given
12         entry, deletion of that entry does not invalidate the iterator.  The entry to which it
13         points is logically but not physically deleted.  You can still advance the iterator to the
14         next entry in the list.
15 */
16 #include <opensrf/utils.h>
17 #include <opensrf/string_array.h>
18 #include <opensrf/osrf_list.h>
19
20 #ifdef __cplusplus
21 extern "C" {
22 #endif
23
24 struct _osrfHashStruct;
25 typedef struct _osrfHashStruct osrfHash;
26
27 struct _osrfHashIteratorStruct;
28 typedef struct _osrfHashIteratorStruct osrfHashIterator;
29
30 osrfHash* osrfNewHash();
31
32 void osrfHashSetCallback( osrfHash* hash, void (*callback) (char* key, void* item) );
33
34 void* osrfHashSet( osrfHash* hash, void* item, const char* key, ... );
35
36 void* osrfHashRemove( osrfHash* hash, const char* key, ... );
37
38 void* osrfHashExtract( osrfHash* hash, const char* key, ... );
39
40 void* osrfHashGet( osrfHash* hash, const char* key );
41
42 void* osrfHashGetFmt( osrfHash* hash, const char* key, ... );
43
44 osrfStringArray* osrfHashKeys( osrfHash* hash );
45
46 void osrfHashFree( osrfHash* hash );
47
48 unsigned long osrfHashGetCount( osrfHash* hash );
49
50 osrfHashIterator* osrfNewHashIterator( osrfHash* hash );
51
52 int osrfHashIteratorHasNext( osrfHashIterator* itr );
53
54 void* osrfHashIteratorNext( osrfHashIterator* itr );
55
56 const char* osrfHashIteratorKey( const osrfHashIterator* itr );
57
58 void osrfHashIteratorFree( osrfHashIterator* itr );
59
60 void osrfHashIteratorReset( osrfHashIterator* itr );
61
62 #ifdef __cplusplus
63 }
64 #endif
65
66 #endif