rpm 5.2.1

rpmio/rpmhash.h

Go to the documentation of this file.
00001 #ifndef H_RPMHASH
00002 #define H_RPMHASH
00003 
00009 #include <rpmiotypes.h>
00010 
00013 typedef /*@abstract@*/ /*@refcounted@*/ struct hashTable_s * hashTable;
00014 
00015 #ifdef __cplusplus
00016 extern "C" {
00017 #endif
00018 
00025 typedef int (*hashEqualityType) (const void * key1, const void * key2)
00026         /*@*/;
00027 
00034 int hashEqualityString(const void * key1, const void * key2)
00035         /*@*/;
00036 
00044 typedef rpmuint32_t (*hashFunctionType) (rpmuint32_t h, const void * data,
00045                 size_t size)
00046         /*@*/;
00047 
00055 rpmuint32_t hashFunctionString(rpmuint32_t h, const void * data, size_t size)
00056         /*@*/;
00057 
00064 void htAddEntry(hashTable ht, /*@owned@*/ const void * key,
00065                 /*@owned@*/ const void * data)
00066         /*@modifies ht */;
00067 
00077 int htGetEntry(hashTable ht, const void * key,
00078                 /*@null@*/ /*@out@*/ const void * data,
00079                 /*@null@*/ /*@out@*/ int * dataCount,
00080                 /*@null@*/ /*@out@*/ const void * tableKey)
00081         /*@modifies *data, *dataCount, *tableKey @*/;
00082 
00088 const void ** htGetKeys(hashTable ht)
00089         /*@*/;
00090 
00097 /*@unused@*/
00098 int htHasEntry(hashTable ht, const void * key)
00099         /*@*/;
00100 
00106 /*@unused@*/ /*@null@*/
00107 hashTable htUnlink (/*@killref@*/ /*@null@*/ hashTable ht)
00108         /*@modifies ht @*/;
00109 #define htUnlink(_ht)   \
00110     ((hashTable)rpmioUnlinkPoolItem((rpmioItem)(_ht), __FUNCTION__, __FILE__, __LINE__))
00111 
00117 /*@unused@*/ /*@newref@*/ /*@null@*/
00118 hashTable htLink (/*@null@*/ hashTable ht)
00119         /*@modifies ht @*/;
00120 #define htLink(_ht)     \
00121     ((hashTable)rpmioLinkPoolItem((rpmioItem)(_ht), __FUNCTION__, __FILE__, __LINE__))
00122 
00128 /*@null@*/
00129 hashTable htFree( /*@only@*/ hashTable ht)
00130         /*@modifies ht @*/;
00131 #define htFree(_ht)     \
00132     ((hashTable)rpmioFreePoolItem((rpmioItem)(_ht), __FUNCTION__, __FILE__, __LINE__))
00133 
00145 /*@newref@*/ /*@null@*/
00146 hashTable htCreate(int numBuckets, size_t keySize, int freeData,
00147                 /*@null@*/ hashFunctionType fn, /*@null@*/ hashEqualityType eq)
00148         /*@globals fileSystem @*/
00149         /*@modifies fileSystem @*/;
00150 
00151 #ifdef __cplusplus
00152 }
00153 #endif
00154 
00155 #endif