Changeset 1581 for trunk/archive/pslib/include/psHash.h
- Timestamp:
- Aug 18, 2004, 4:10:27 PM (22 years ago)
- File:
-
- 1 edited
-
trunk/archive/pslib/include/psHash.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/archive/pslib/include/psHash.h
r359 r1581 7 7 */ 8 8 9 /** DO WE NEED TO DEFINE HashTable? */ 10 typedef struct HashTable psHash; ///< Opaque type for a hash table 9 /** A hash table */ 10 typedef struct { 11 int nbucket; ///< number of buckets 12 psHashBucket **buckets; ///< the buckets themselves 13 } psHash; 14 15 /** The hash buckets, which compose the hash */ 16 typedef struct psHashBucket { 17 char *key; ///< key for this item of data 18 void *data; ///< the data itself 19 struct psHashBucket *next; ///< list of other possible keys 20 } psHashBucket; 11 21 12 22 /** Functions **************************************************************/ … … 15 25 */ 16 26 17 / // Allocate hash buckets in table.27 /** Allocate hash buckets in table. */ 18 28 psHash *psHashAlloc(void); 19 29 20 /// Free hash buckets from table. 21 void psHashFree(psHash *table, ///< hash table to be freed 22 void (*itemFree)(void *item) ///< how to free hashed data; or NULL 30 /** Add entry to table. */ 31 bool psHashAdd(psHash *table, ///< table to insert in 32 const char *key, ///< key to use 33 void *data ///< data to insert 23 34 ); 24 35 25 /// Insert entry into table. 26 void *psHashInsert(psHash *table, ///< table to insert in 27 const char *key, ///< key to use 28 void *data, ///< data to insert 29 void (*itemFree)(void *item) ///< how to free hashed data; or NULL 30 ); 31 32 /// Lookup key in table. 36 /** Lookup key in table. */ 33 37 void *psHashLookup(psHash *table, ///< table to lookup key in 34 38 const char *key ///< key to lookup 35 39 ); 36 40 37 / // Remove key from table.38 void *psHashRemove(psHash *table, ///< table to lookup key in39 const char *key ///< key to lookup41 /** Remove key from table. */ 42 bool psHashRemove(psHash *table, ///< table to lookup key in 43 const char *key ///< key to lookup 40 44 ); 45 46 /** Get list of keys */ 47 psList *psHashKeyList(psHash *table ///< table for which to get keys 48 ); 49 41 50 42 51 /* \} */ // End of DataGroup Functions
Note:
See TracChangeset
for help on using the changeset viewer.
