Index: /trunk/psLib/test/dataIO/tst_psFits.c
===================================================================
--- /trunk/psLib/test/dataIO/tst_psFits.c	(revision 2992)
+++ /trunk/psLib/test/dataIO/tst_psFits.c	(revision 2993)
@@ -6,6 +6,6 @@
 *  @author Robert DeSonia, MHPCC
 *
-*  @version $Revision: 1.5 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2005-01-13 21:09:18 $
+*  @version $Revision: 1.6 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2005-01-14 19:21:55 $
 *
 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -25,4 +25,5 @@
 static psS32 tst_psFitsMoveExtNum( void );  // also tests psFitsGetExtNum, psFitsGetSize
 static psS32 tst_psFitsReadHeader( void );
+static psS32 tst_psFitsReadHeaderSet( void );
 
 testDescription tests[] = {
@@ -33,5 +34,6 @@
                               {tst_psFitsMoveExtNum, 803, "psFitsGetExtNum", 0, true},
                               {tst_psFitsMoveExtNum, 803, "psFitsGetSize", 0, true},
-                              {tst_psFitsReadHeader, 0, "psFitsReadHeader", 0, false},
+                              {tst_psFitsReadHeader, 804, "psFitsReadHeader", 0, false},
+                              {tst_psFitsReadHeaderSet, 0, "psFitsReadHeaderSet", 0, false},
                               {NULL}
                           };
@@ -583,2 +585,118 @@
     return 0;
 }
+
+static psS32 tst_psFitsReadHeaderSet( void )
+{
+    if (! makeMulti() ) {
+        return 1;
+    }
+
+    psFits* fits = psFitsAlloc(multiFilename);
+
+    int numHDUs = psFitsGetSize(fits);
+
+    if (numHDUs < 8) {
+        psError(PS_ERR_UNKNOWN,true,
+                "The 'multi' FITS file does not have multiple HDUs.");
+        return 2;
+    }
+
+    // move to the middle
+    psFitsMoveExtNum(fits,numHDUs/2, false);
+
+    psHash* headerSet = psFitsReadHeaderSet(NULL, fits);
+
+    if (headerSet == NULL) {
+        psError(PS_ERR_UNKNOWN, false,
+                "psFitsReadHeaderSet returned NULL unexpectedly.");
+        return 3;
+    }
+
+    if (psFitsGetExtNum(fits) != numHDUs/2) {
+        psError(PS_ERR_UNKNOWN, false,
+                "psFitsReadHeaderSet changed the CHU.");
+        return 4;
+    }
+
+    char extname[80];
+    for (int i = 0; i < numHDUs; i++) {
+        if (i == 0) {
+            snprintf(extname, 80, "PHU");
+        } else {
+            snprintf(extname, 80, "ext-%d", i);
+        }
+
+        psMetadata* header = psHashLookup(headerSet, extname);
+
+        if (header == NULL) {
+            psError(PS_ERR_UNKNOWN, false,
+                    "psFitsReadHeader returned NULL unexpectedly for HDU#%d.",
+                    i);
+            return 5;
+        }
+
+        psS32 intItem = psMetadataLookupS32(header, "MYINT",NULL);
+
+        if (intItem != i) {
+            psError(PS_ERR_UNKNOWN, false,
+                    "psFitsReadHeader for HDU#%d had a MYINT of %d, expected %d.",
+                    intItem, i);
+            return 6;
+        }
+
+    }
+
+    psHash* set2 = psHashAlloc(20);
+
+    if (psFitsReadHeaderSet(set2,NULL) != NULL) {
+        psError(PS_ERR_UNKNOWN, false,
+                "psFitsReadHeaderSet returned non-NULL given a NULL psFits.");
+        return 10;
+    }
+
+    psHash* set3 = psHashAlloc(20);
+    psFitsReadHeaderSet(set3,fits);
+
+    if (set3 == NULL) {
+        psError(PS_ERR_UNKNOWN, false,
+                "psFitsReadHeaderSet returned NULL unexpectedly.");
+        return 11;
+    }
+
+    for (int i = 0; i < numHDUs; i++) {
+        if (i == 0) {
+            snprintf(extname, 80, "PHU");
+        } else {
+            snprintf(extname, 80, "ext-%d", i);
+        }
+
+        psMetadata* header = psHashLookup(set3, extname);
+
+        if (header == NULL) {
+            psError(PS_ERR_UNKNOWN, false,
+                    "psFitsReadHeader returned NULL unexpectedly for HDU#%d.",
+                    i);
+            return 5;
+        }
+
+        psS32 intItem = psMetadataLookupS32(header, "MYINT",NULL);
+
+        if (intItem != i) {
+            psError(PS_ERR_UNKNOWN, false,
+                    "psFitsReadHeader for HDU#%d had a MYINT of %d, expected %d.",
+                    intItem, i);
+            return 6;
+        }
+
+    }
+
+
+
+    psFree(headerSet);
+    psFree(set3);
+    // set2 should have been freed by psFitsReadHeaderSet upon an error.
+
+    psFree(fits);
+
+    return 0;
+}
Index: /trunk/psLib/test/dataIO/verified/tst_psFits.stderr
===================================================================
--- /trunk/psLib/test/dataIO/verified/tst_psFits.stderr	(revision 2992)
+++ /trunk/psLib/test/dataIO/verified/tst_psFits.stderr	(revision 2993)
@@ -80,2 +80,13 @@
 ---> TESTPOINT PASSED (psImage{psFitsReadHeader} | tst_psFits.c)
 
+/***************************** TESTPOINT ******************************************\
+*             TestFile: tst_psFits.c                                               *
+*            TestPoint: psImage{psFitsReadHeaderSet}                               *
+*             TestType: Positive                                                   *
+\**********************************************************************************/
+
+<DATE><TIME>|<HOST>|E|psFitsReadHeaderSet (psFits.c:<LINENO>)
+    The input psFits object can not NULL.
+
+---> TESTPOINT PASSED (psImage{psFitsReadHeaderSet} | tst_psFits.c)
+
Index: /trunk/psLib/test/fileUtils/tst_psFits.c
===================================================================
--- /trunk/psLib/test/fileUtils/tst_psFits.c	(revision 2992)
+++ /trunk/psLib/test/fileUtils/tst_psFits.c	(revision 2993)
@@ -6,6 +6,6 @@
 *  @author Robert DeSonia, MHPCC
 *
-*  @version $Revision: 1.5 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2005-01-13 21:09:18 $
+*  @version $Revision: 1.6 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2005-01-14 19:21:55 $
 *
 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -25,4 +25,5 @@
 static psS32 tst_psFitsMoveExtNum( void );  // also tests psFitsGetExtNum, psFitsGetSize
 static psS32 tst_psFitsReadHeader( void );
+static psS32 tst_psFitsReadHeaderSet( void );
 
 testDescription tests[] = {
@@ -33,5 +34,6 @@
                               {tst_psFitsMoveExtNum, 803, "psFitsGetExtNum", 0, true},
                               {tst_psFitsMoveExtNum, 803, "psFitsGetSize", 0, true},
-                              {tst_psFitsReadHeader, 0, "psFitsReadHeader", 0, false},
+                              {tst_psFitsReadHeader, 804, "psFitsReadHeader", 0, false},
+                              {tst_psFitsReadHeaderSet, 0, "psFitsReadHeaderSet", 0, false},
                               {NULL}
                           };
@@ -583,2 +585,118 @@
     return 0;
 }
+
+static psS32 tst_psFitsReadHeaderSet( void )
+{
+    if (! makeMulti() ) {
+        return 1;
+    }
+
+    psFits* fits = psFitsAlloc(multiFilename);
+
+    int numHDUs = psFitsGetSize(fits);
+
+    if (numHDUs < 8) {
+        psError(PS_ERR_UNKNOWN,true,
+                "The 'multi' FITS file does not have multiple HDUs.");
+        return 2;
+    }
+
+    // move to the middle
+    psFitsMoveExtNum(fits,numHDUs/2, false);
+
+    psHash* headerSet = psFitsReadHeaderSet(NULL, fits);
+
+    if (headerSet == NULL) {
+        psError(PS_ERR_UNKNOWN, false,
+                "psFitsReadHeaderSet returned NULL unexpectedly.");
+        return 3;
+    }
+
+    if (psFitsGetExtNum(fits) != numHDUs/2) {
+        psError(PS_ERR_UNKNOWN, false,
+                "psFitsReadHeaderSet changed the CHU.");
+        return 4;
+    }
+
+    char extname[80];
+    for (int i = 0; i < numHDUs; i++) {
+        if (i == 0) {
+            snprintf(extname, 80, "PHU");
+        } else {
+            snprintf(extname, 80, "ext-%d", i);
+        }
+
+        psMetadata* header = psHashLookup(headerSet, extname);
+
+        if (header == NULL) {
+            psError(PS_ERR_UNKNOWN, false,
+                    "psFitsReadHeader returned NULL unexpectedly for HDU#%d.",
+                    i);
+            return 5;
+        }
+
+        psS32 intItem = psMetadataLookupS32(header, "MYINT",NULL);
+
+        if (intItem != i) {
+            psError(PS_ERR_UNKNOWN, false,
+                    "psFitsReadHeader for HDU#%d had a MYINT of %d, expected %d.",
+                    intItem, i);
+            return 6;
+        }
+
+    }
+
+    psHash* set2 = psHashAlloc(20);
+
+    if (psFitsReadHeaderSet(set2,NULL) != NULL) {
+        psError(PS_ERR_UNKNOWN, false,
+                "psFitsReadHeaderSet returned non-NULL given a NULL psFits.");
+        return 10;
+    }
+
+    psHash* set3 = psHashAlloc(20);
+    psFitsReadHeaderSet(set3,fits);
+
+    if (set3 == NULL) {
+        psError(PS_ERR_UNKNOWN, false,
+                "psFitsReadHeaderSet returned NULL unexpectedly.");
+        return 11;
+    }
+
+    for (int i = 0; i < numHDUs; i++) {
+        if (i == 0) {
+            snprintf(extname, 80, "PHU");
+        } else {
+            snprintf(extname, 80, "ext-%d", i);
+        }
+
+        psMetadata* header = psHashLookup(set3, extname);
+
+        if (header == NULL) {
+            psError(PS_ERR_UNKNOWN, false,
+                    "psFitsReadHeader returned NULL unexpectedly for HDU#%d.",
+                    i);
+            return 5;
+        }
+
+        psS32 intItem = psMetadataLookupS32(header, "MYINT",NULL);
+
+        if (intItem != i) {
+            psError(PS_ERR_UNKNOWN, false,
+                    "psFitsReadHeader for HDU#%d had a MYINT of %d, expected %d.",
+                    intItem, i);
+            return 6;
+        }
+
+    }
+
+
+
+    psFree(headerSet);
+    psFree(set3);
+    // set2 should have been freed by psFitsReadHeaderSet upon an error.
+
+    psFree(fits);
+
+    return 0;
+}
Index: /trunk/psLib/test/fileUtils/verified/tst_psFits.stderr
===================================================================
--- /trunk/psLib/test/fileUtils/verified/tst_psFits.stderr	(revision 2992)
+++ /trunk/psLib/test/fileUtils/verified/tst_psFits.stderr	(revision 2993)
@@ -80,2 +80,13 @@
 ---> TESTPOINT PASSED (psImage{psFitsReadHeader} | tst_psFits.c)
 
+/***************************** TESTPOINT ******************************************\
+*             TestFile: tst_psFits.c                                               *
+*            TestPoint: psImage{psFitsReadHeaderSet}                               *
+*             TestType: Positive                                                   *
+\**********************************************************************************/
+
+<DATE><TIME>|<HOST>|E|psFitsReadHeaderSet (psFits.c:<LINENO>)
+    The input psFits object can not NULL.
+
+---> TESTPOINT PASSED (psImage{psFitsReadHeaderSet} | tst_psFits.c)
+
