Changeset 4352
- Timestamp:
- Jun 22, 2005, 1:48:39 PM (21 years ago)
- Location:
- trunk/psLib/src
- Files:
-
- 4 edited
-
collections/psHash.c (modified) (7 diffs)
-
collections/psHash.h (modified) (5 diffs)
-
types/psHash.c (modified) (7 diffs)
-
types/psHash.h (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/collections/psHash.c
r4343 r4352 12 12 * @author GLG, MHPCC 13 13 * 14 * @version $Revision: 1. 19$ $Name: not supported by cvs2svn $15 * @date $Date: 2005-06-22 03:00:27$14 * @version $Revision: 1.20 $ $Name: not supported by cvs2svn $ 15 * @date $Date: 2005-06-22 23:48:39 $ 16 16 * 17 17 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 343 343 boolean value defining success or failure 344 344 *****************************************************************************/ 345 bool psHashAdd(psHash* table,345 bool psHashAdd(psHash* hash, 346 346 const char *key, 347 347 psPtr data) 348 348 { 349 PS_ASSERT_PTR_NON_NULL( table, false);349 PS_ASSERT_PTR_NON_NULL(hash, false); 350 350 PS_ASSERT_PTR_NON_NULL(key, false); 351 351 PS_ASSERT_PTR_NON_NULL(data, false); 352 352 353 return (doHashWork( table, key, data, false) != NULL);353 return (doHashWork(hash, key, data, false) != NULL); 354 354 } 355 355 … … 365 365 The data associated with that key. 366 366 *****************************************************************************/ 367 psPtr psHashLookup(const psHash* table, // tableto lookup key in367 psPtr psHashLookup(const psHash* hash, // hash to lookup key in 368 368 const char *key) // key to lookup 369 369 { 370 PS_ASSERT_PTR_NON_NULL( table, NULL);370 PS_ASSERT_PTR_NON_NULL(hash, NULL); 371 371 PS_ASSERT_PTR_NON_NULL(key, NULL); 372 372 373 return doHashWork((psPtr) table, key, NULL, false);373 return doHashWork((psPtr)hash, key, NULL, false); 374 374 } 375 375 … … 383 383 boolean value defining success or failure 384 384 *****************************************************************************/ 385 bool psHashRemove(psHash* table,385 bool psHashRemove(psHash* hash, 386 386 const char *key) 387 387 { … … 389 389 psBool retVal = false; 390 390 391 PS_ASSERT_PTR_NON_NULL( table, false);391 PS_ASSERT_PTR_NON_NULL(hash, false); 392 392 PS_ASSERT_PTR_NON_NULL(key, false); 393 393 394 data = doHashWork( table, key, NULL, true);394 data = doHashWork(hash, key, NULL, true); 395 395 if (data != NULL) { 396 396 retVal = true; … … 402 402 } 403 403 404 psArray* psHashToArray(const psHash* table)405 { 406 PS_ASSERT_PTR_NON_NULL( table, NULL);404 psArray* psHashToArray(const psHash* hash) 405 { 406 PS_ASSERT_PTR_NON_NULL(hash, NULL); 407 407 408 408 // first, let's just count the number of data elements to know what size 409 409 // psArray we need to allocate. 410 410 int nElements = 0; 411 int nbucket = table->nbucket;411 int nbucket = hash->nbucket; 412 412 for (int i = 0; i < nbucket; i++) { 413 psHashBucket* tmpBucket = table->buckets[i];413 psHashBucket* tmpBucket = hash->buckets[i]; 414 414 while (tmpBucket != NULL) { 415 415 nElements++; … … 421 421 result->n = nElements; 422 422 423 // now fill in the array with the hash table's data423 // now fill in the array with the hash hash's data 424 424 psPtr* data = result->data; 425 425 for (int i = 0; i < nbucket; i++) { 426 psHashBucket* tmpBucket = table->buckets[i];426 psHashBucket* tmpBucket = hash->buckets[i]; 427 427 while (tmpBucket != NULL) { 428 428 *(data++) = psMemIncrRefCounter(tmpBucket->data); -
trunk/psLib/src/collections/psHash.h
r4343 r4352 11 11 * @author GLG, MHPCC 12 12 * 13 * @version $Revision: 1.1 1$ $Name: not supported by cvs2svn $14 * @date $Date: 2005-06-22 03:00:27$13 * @version $Revision: 1.12 $ $Name: not supported by cvs2svn $ 14 * @date $Date: 2005-06-22 23:48:39 $ 15 15 * 16 16 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 52 52 /// Insert entry into table. 53 53 bool psHashAdd( 54 psHash* table,///< The table to insert in.54 psHash* hash, ///< The table to insert in. 55 55 const char *key, ///< The key to use. 56 56 psPtr data ///< The data to insert. … … 59 59 /// Lookup key in table. 60 60 psPtr psHashLookup( 61 const psHash* table,///< The table to lookup key in.61 const psHash* hash, ///< The table to lookup key in. 62 62 const char *key ///< The key to lookup. 63 63 ); … … 65 65 /// Remove key from table. 66 66 bool psHashRemove( 67 psHash* table,///< The table to lookup key in.67 psHash* hash, ///< The table to lookup key in. 68 68 const char *key ///< The key to lookup. 69 69 ); … … 79 79 */ 80 80 psArray* psHashToArray( 81 const psHash* table///< The table to convert to psArray.81 const psHash* hash ///< The table to convert to psArray. 82 82 ); 83 83 -
trunk/psLib/src/types/psHash.c
r4343 r4352 12 12 * @author GLG, MHPCC 13 13 * 14 * @version $Revision: 1. 19$ $Name: not supported by cvs2svn $15 * @date $Date: 2005-06-22 03:00:27$14 * @version $Revision: 1.20 $ $Name: not supported by cvs2svn $ 15 * @date $Date: 2005-06-22 23:48:39 $ 16 16 * 17 17 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 343 343 boolean value defining success or failure 344 344 *****************************************************************************/ 345 bool psHashAdd(psHash* table,345 bool psHashAdd(psHash* hash, 346 346 const char *key, 347 347 psPtr data) 348 348 { 349 PS_ASSERT_PTR_NON_NULL( table, false);349 PS_ASSERT_PTR_NON_NULL(hash, false); 350 350 PS_ASSERT_PTR_NON_NULL(key, false); 351 351 PS_ASSERT_PTR_NON_NULL(data, false); 352 352 353 return (doHashWork( table, key, data, false) != NULL);353 return (doHashWork(hash, key, data, false) != NULL); 354 354 } 355 355 … … 365 365 The data associated with that key. 366 366 *****************************************************************************/ 367 psPtr psHashLookup(const psHash* table, // tableto lookup key in367 psPtr psHashLookup(const psHash* hash, // hash to lookup key in 368 368 const char *key) // key to lookup 369 369 { 370 PS_ASSERT_PTR_NON_NULL( table, NULL);370 PS_ASSERT_PTR_NON_NULL(hash, NULL); 371 371 PS_ASSERT_PTR_NON_NULL(key, NULL); 372 372 373 return doHashWork((psPtr) table, key, NULL, false);373 return doHashWork((psPtr)hash, key, NULL, false); 374 374 } 375 375 … … 383 383 boolean value defining success or failure 384 384 *****************************************************************************/ 385 bool psHashRemove(psHash* table,385 bool psHashRemove(psHash* hash, 386 386 const char *key) 387 387 { … … 389 389 psBool retVal = false; 390 390 391 PS_ASSERT_PTR_NON_NULL( table, false);391 PS_ASSERT_PTR_NON_NULL(hash, false); 392 392 PS_ASSERT_PTR_NON_NULL(key, false); 393 393 394 data = doHashWork( table, key, NULL, true);394 data = doHashWork(hash, key, NULL, true); 395 395 if (data != NULL) { 396 396 retVal = true; … … 402 402 } 403 403 404 psArray* psHashToArray(const psHash* table)405 { 406 PS_ASSERT_PTR_NON_NULL( table, NULL);404 psArray* psHashToArray(const psHash* hash) 405 { 406 PS_ASSERT_PTR_NON_NULL(hash, NULL); 407 407 408 408 // first, let's just count the number of data elements to know what size 409 409 // psArray we need to allocate. 410 410 int nElements = 0; 411 int nbucket = table->nbucket;411 int nbucket = hash->nbucket; 412 412 for (int i = 0; i < nbucket; i++) { 413 psHashBucket* tmpBucket = table->buckets[i];413 psHashBucket* tmpBucket = hash->buckets[i]; 414 414 while (tmpBucket != NULL) { 415 415 nElements++; … … 421 421 result->n = nElements; 422 422 423 // now fill in the array with the hash table's data423 // now fill in the array with the hash hash's data 424 424 psPtr* data = result->data; 425 425 for (int i = 0; i < nbucket; i++) { 426 psHashBucket* tmpBucket = table->buckets[i];426 psHashBucket* tmpBucket = hash->buckets[i]; 427 427 while (tmpBucket != NULL) { 428 428 *(data++) = psMemIncrRefCounter(tmpBucket->data); -
trunk/psLib/src/types/psHash.h
r4343 r4352 11 11 * @author GLG, MHPCC 12 12 * 13 * @version $Revision: 1.1 1$ $Name: not supported by cvs2svn $14 * @date $Date: 2005-06-22 03:00:27$13 * @version $Revision: 1.12 $ $Name: not supported by cvs2svn $ 14 * @date $Date: 2005-06-22 23:48:39 $ 15 15 * 16 16 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 52 52 /// Insert entry into table. 53 53 bool psHashAdd( 54 psHash* table,///< The table to insert in.54 psHash* hash, ///< The table to insert in. 55 55 const char *key, ///< The key to use. 56 56 psPtr data ///< The data to insert. … … 59 59 /// Lookup key in table. 60 60 psPtr psHashLookup( 61 const psHash* table,///< The table to lookup key in.61 const psHash* hash, ///< The table to lookup key in. 62 62 const char *key ///< The key to lookup. 63 63 ); … … 65 65 /// Remove key from table. 66 66 bool psHashRemove( 67 psHash* table,///< The table to lookup key in.67 psHash* hash, ///< The table to lookup key in. 68 68 const char *key ///< The key to lookup. 69 69 ); … … 79 79 */ 80 80 psArray* psHashToArray( 81 const psHash* table///< The table to convert to psArray.81 const psHash* hash ///< The table to convert to psArray. 82 82 ); 83 83
Note:
See TracChangeset
for help on using the changeset viewer.
