Index: trunk/psLib/src/collections/psHash.c
===================================================================
--- trunk/psLib/src/collections/psHash.c	(revision 2855)
+++ trunk/psLib/src/collections/psHash.c	(revision 2859)
@@ -10,7 +10,8 @@
 *  @author Robert Lupton, Princeton University
 *  @author George Gusciora, MHPCC
+*  @author Robert DeSonia, MHPCC
 *
-*  @version $Revision: 1.10 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2004-12-04 02:43:39 $
+*  @version $Revision: 1.11 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2005-01-03 20:28:07 $
 *
 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -361,5 +362,5 @@
     }
 
-    return (doHashWork(table, key, data, 0) != NULL);
+    return (doHashWork(table, key, data, false) != NULL);
 }
 
@@ -389,5 +390,5 @@
     }
 
-    return doHashWork(table, key, NULL, 0);
+    return doHashWork(table, key, NULL, false);
 }
 
@@ -418,5 +419,5 @@
     }
 
-    data = doHashWork(table, key, NULL, 1);
+    data = doHashWork(table, key, NULL, true);
     if (data != NULL) {
         retVal = true;
@@ -427,2 +428,39 @@
     return retVal;
 }
+
+psArray* psHashToArray(psHash* table)
+{
+
+    if (table == NULL) {
+        psError(PS_ERR_BAD_PARAMETER_NULL, true,
+                PS_ERRORTEXT_psHash_TABLE_NULL);
+        return NULL;
+    }
+
+    // first, let's just count the number of data elements to know what size
+    // psArray we need to allocate.
+    int nElements = 0;
+    int nbucket = table->nbucket;
+    for (int i = 0; i < nbucket; i++) {
+        psHashBucket* tmpBucket = table->buckets[i];
+        while (tmpBucket != NULL) {
+            nElements++;
+            tmpBucket = tmpBucket->next;
+        }
+    }
+
+    psArray* result = psArrayAlloc(nElements);
+    result->n = nElements;
+
+    // now fill in the array with the hash table's data
+    psPtr* data = result->data;
+    for (int i = 0; i < nbucket; i++) {
+        psHashBucket* tmpBucket = table->buckets[i];
+        while (tmpBucket != NULL) {
+            *(data++) = psMemIncrRefCounter(tmpBucket->data);
+            tmpBucket = tmpBucket->next;
+        }
+    }
+
+    return result;
+}
Index: trunk/psLib/src/collections/psHash.h
===================================================================
--- trunk/psLib/src/collections/psHash.h	(revision 2855)
+++ trunk/psLib/src/collections/psHash.h	(revision 2859)
@@ -10,7 +10,8 @@
  *  @author Robert Lupton, Princeton University
  *  @author George Gusciora, MHPCC
- *   
- *  @version $Revision: 1.5 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-10-27 00:57:31 $
+ *  @author Robert DeSonia, MHPCC
+ *
+ *  @version $Revision: 1.6 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2005-01-03 20:28:07 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -28,7 +29,7 @@
 typedef struct psHashBucket
 {
-    char *key;                  ///< key for this item of data
-    psPtr data;                 ///< the data itself
-    struct psHashBucket* next;  ///< list of other possible keys
+    char *key;                         ///< key for this item of data
+    psPtr data;                        ///< the data itself
+    struct psHashBucket* next;         ///< list of other possible keys
 }
 psHashBucket;
@@ -39,32 +40,45 @@
 typedef struct psHash
 {
-    psS32 nbucket;                ///< Number of buckets in hash table.
-    psHashBucket* *buckets;     ///< The bucket data.
+    psS32 nbucket;                     ///< Number of buckets in hash table.
+    psHashBucket* *buckets;            ///< The bucket data.
 }
 psHash;
 
 /// Allocate hash buckets in table.
-psHash* psHashAlloc(psS32 nbucket ///< The number of buckets to allocate.
-                   );
+psHash* psHashAlloc(
+    psS32 nbucket                  ///< The number of buckets to allocate.
+);
 
 /// Insert entry into table.
-psBool psHashAdd(psHash* table,  ///< table to insert in
-                 const char *key, ///< key to use
-                 psPtr data       ///< data to insert
-                );
+psBool psHashAdd(
+    psHash* table,                 ///< table to insert in
+    const char *key,               ///< key to use
+    psPtr data                     ///< data to insert
+);
 
 /// Lookup key in table.
-psPtr psHashLookup(psHash* table,      ///< table to lookup key in
-                   const char *key      ///< key to lookup
-                  );
+psPtr psHashLookup(
+    psHash* table,                 ///< table to lookup key in
+    const char *key                ///< key to lookup
+);
 
 /// Remove key from table.
-psBool psHashRemove(psHash* table,       ///< table to lookup key in
-                    const char *key       ///< key to lookup
-                   );
+psBool psHashRemove(
+    psHash* table,                 ///< table to lookup key in
+    const char *key                ///< key to lookup
+);
 
 /// List all keys in table.
-psList* psHashKeyList(psHash* table    ///< table to list keys from.
-                     );
+psList* psHashKeyList(
+    psHash* table                  ///< table to list keys from.
+);
+
+/** Create a psArray from a psHash contents.
+ *
+ *  @return psArray*       A new psArray with duplicate contents of the input psHash
+ */
+psArray* psHashToArray(
+    psHash* table                  ///< table to convert to psArray
+);
 
 /* \} */// End of DataGroup Functions
