IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jan 3, 2005, 10:28:07 AM (22 years ago)
Author:
desonia
Message:

added psHashToArray function and cooresponding test.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/collections/psHash.h

    r2204 r2859  
    1010 *  @author Robert Lupton, Princeton University
    1111 *  @author George Gusciora, MHPCC
    12  *   
    13  *  @version $Revision: 1.5 $ $Name: not supported by cvs2svn $
    14  *  @date $Date: 2004-10-27 00:57:31 $
     12 *  @author Robert DeSonia, MHPCC
     13 *
     14 *  @version $Revision: 1.6 $ $Name: not supported by cvs2svn $
     15 *  @date $Date: 2005-01-03 20:28:07 $
    1516 *
    1617 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    2829typedef struct psHashBucket
    2930{
    30     char *key;                  ///< key for this item of data
    31     psPtr data;                 ///< the data itself
    32     struct psHashBucket* next;  ///< list of other possible keys
     31    char *key;                         ///< key for this item of data
     32    psPtr data;                        ///< the data itself
     33    struct psHashBucket* next;         ///< list of other possible keys
    3334}
    3435psHashBucket;
     
    3940typedef struct psHash
    4041{
    41     psS32 nbucket;                ///< Number of buckets in hash table.
    42     psHashBucket* *buckets;     ///< The bucket data.
     42    psS32 nbucket;                     ///< Number of buckets in hash table.
     43    psHashBucket* *buckets;            ///< The bucket data.
    4344}
    4445psHash;
    4546
    4647/// Allocate hash buckets in table.
    47 psHash* psHashAlloc(psS32 nbucket ///< The number of buckets to allocate.
    48                    );
     48psHash* psHashAlloc(
     49    psS32 nbucket                  ///< The number of buckets to allocate.
     50);
    4951
    5052/// Insert entry into table.
    51 psBool psHashAdd(psHash* table,  ///< table to insert in
    52                  const char *key, ///< key to use
    53                  psPtr data       ///< data to insert
    54                 );
     53psBool psHashAdd(
     54    psHash* table,                 ///< table to insert in
     55    const char *key,               ///< key to use
     56    psPtr data                     ///< data to insert
     57);
    5558
    5659/// Lookup key in table.
    57 psPtr psHashLookup(psHash* table,      ///< table to lookup key in
    58                    const char *key      ///< key to lookup
    59                   );
     60psPtr psHashLookup(
     61    psHash* table,                 ///< table to lookup key in
     62    const char *key                ///< key to lookup
     63);
    6064
    6165/// Remove key from table.
    62 psBool psHashRemove(psHash* table,       ///< table to lookup key in
    63                     const char *key       ///< key to lookup
    64                    );
     66psBool psHashRemove(
     67    psHash* table,                 ///< table to lookup key in
     68    const char *key                ///< key to lookup
     69);
    6570
    6671/// List all keys in table.
    67 psList* psHashKeyList(psHash* table    ///< table to list keys from.
    68                      );
     72psList* psHashKeyList(
     73    psHash* table                  ///< table to list keys from.
     74);
     75
     76/** Create a psArray from a psHash contents.
     77 *
     78 *  @return psArray*       A new psArray with duplicate contents of the input psHash
     79 */
     80psArray* psHashToArray(
     81    psHash* table                  ///< table to convert to psArray
     82);
    6983
    7084/* \} */// End of DataGroup Functions
Note: See TracChangeset for help on using the changeset viewer.