Changeset 1407 for trunk/psLib/src/sysUtils/psHash.h
- Timestamp:
- Aug 6, 2004, 2:06:06 PM (22 years ago)
- File:
-
- 1 edited
-
trunk/psLib/src/sysUtils/psHash.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/sysUtils/psHash.h
r1406 r1407 1 1 2 /** @file psHash.h 2 3 * @brief Contains support for basic hashing functions. … … 10 11 * @author George Gusciora, MHPCC 11 12 * 12 * @version $Revision: 1.1 8$ $Name: not supported by cvs2svn $13 * @date $Date: 2004-08-0 6 22:34:05$13 * @version $Revision: 1.19 $ $Name: not supported by cvs2svn $ 14 * @date $Date: 2004-08-07 00:06:06 $ 14 15 * 15 16 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii 16 17 */ 17 18 #if !defined(PS_HASH_H) 18 # define PS_HASH_H19 # define PS_HASH_H 19 20 20 21 /** \addtogroup HashTable 21 22 * \{ 22 23 */ 23 # include<stdbool.h>24 # include<stdbool.h> 24 25 25 # include "psList.h"26 # include "psList.h" 26 27 27 28 /** A bucket that holds an item of data. */ 28 29 typedef struct psHashBucket 29 30 { 30 char *key; ///< key for this item of data31 void *data; ///< the data itself32 struct psHashBucket *next; ///< list of other possible keys31 char *key; // /< key for this item of data 32 void *data; // /< the data itself 33 struct psHashBucket *next; // /< list of other possible keys 33 34 } 34 35 psHashBucket; 35 36 36 37 //typedef struct HashTable psHash; ///< Opaque type for a hash table 38 37 39 /** The hash-table itself. */ 38 40 typedef struct psHash 39 41 { 40 int nbucket; ///< Number of buckets in hash table.41 psHashBucket **buckets; ///< The bucket data.42 int nbucket; // /< Number of buckets in hash table. 43 psHashBucket **buckets; // /< The bucket data. 42 44 } 43 45 psHash; 44 46 45 47 /// Allocate hash buckets in table. 46 psHash *psHashAlloc(int nbucket ///< The number of buckets to allocate.48 psHash *psHashAlloc(int nbucket // /< The number of buckets to allocate. 47 49 ); 48 50 49 51 /// Insert entry into table. 50 bool psHashAdd(psHash * table, ///< table to insert in51 const char *key, ///< key to use52 void *data ///< data to insert52 bool psHashAdd(psHash * table, // /< table to insert in 53 const char *key, // /< key to use 54 void *data // /< data to insert 53 55 ); 54 56 55 57 /// Lookup key in table. 56 void *psHashLookup(psHash * table, ///< table to lookup key in57 const char *key ///< key to lookup58 void *psHashLookup(psHash * table, // /< table to lookup key in 59 const char *key // /< key to lookup 58 60 ); 59 61 60 62 /// Remove key from table. 61 bool psHashRemove(psHash * table, ///< table to lookup key in62 const char *key ///< key to lookup63 bool psHashRemove(psHash * table, // /< table to lookup key in 64 const char *key // /< key to lookup 63 65 ); 64 66 65 67 /// List all keys in table. 66 psList *psHashKeyList(psHash * table ///< table to list keys from.68 psList *psHashKeyList(psHash * table // /< table to list keys from. 67 69 ); 68 70 69 /* \} */ // End of DataGroup Functions71 /* \} */// End of DataGroup Functions 70 72 71 73 #endif
Note:
See TracChangeset
for help on using the changeset viewer.
