Index: trunk/psLib/src/fits/psFits.h
===================================================================
--- trunk/psLib/src/fits/psFits.h	(revision 5057)
+++ trunk/psLib/src/fits/psFits.h	(revision 5511)
@@ -7,6 +7,6 @@
  *  @author Robert DeSonia, MHPCC
  *
- *  @version $Revision: 1.21 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2005-09-15 21:22:21 $
+ *  @version $Revision: 1.22 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2005-11-14 22:18:30 $
  *
  *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -16,5 +16,5 @@
 #define PS_FITS_H
 
-#include<fitsio.h>
+#include <fitsio.h>
 
 #include "psType.h"
@@ -49,6 +49,4 @@
 {
     fitsfile* fd;                      ///< the CFITSIO fits files handle.
-    const char* filename;              ///< the filename of the fits file
-    bool writable;                     ///< Is the file writable?
 }
 psFits;
@@ -59,13 +57,30 @@
  *                     NULL if the open of the FITS file failed
  */
-psFits* psFitsAlloc(
-    const char* name                   ///< the FITS file name
+psFits* psFitsOpen(
+    const char* filename,              ///< the FITS file name
+    const char* mode
+    /**< File open mode. Could be one of the following:
+     *       'r' (read only),
+     *       'r+' (read & write),
+     *       'rw' (same as 'r+'), or
+     *       'w' (create new file for writing)
+     */
+);
+
+/** Closes a FITS file.
+ *
+ *  @return bool      TRUE if FITS file was successfully closed, otherwise FALSE
+ */
+bool psFitsClose(
+    psFits* fits                       ///< psFits object to close
 );
 
 /** Checks the type of a particular pointer.
  *
- *  Uses the appropriate deallocation function in psMemBlock to check the ptr datatype.
+ *  Uses the appropriate deallocation function in psMemBlock to check the ptr
+ *  datatype.
  *
- *  @return bool:       True if the pointer matches a psFits structure, false otherwise.
+ *  @return bool:       True if the pointer matches a psFits structure, false
+ *                      otherwise.
  */
 bool psMemCheckFits(
@@ -76,5 +91,6 @@
 /** Moves the FITS HDU to the specified extension name.
  *
- *  @return psFitsType    The HDU type, or PS_FITS_TYPE_NONE if move failed.
+ *  @return bool        TRUE if the extension name was found and move was
+ *                      successful, otherwise FALSE
  */
 bool psFitsMoveExtName(
@@ -85,5 +101,6 @@
 /** Moves the FITS HDU to the specified extension number
  *
- *  @return psFitsType    The HDU type, or PS_FITS_TYPE_NONE if move failed.
+ *  @return bool        TRUE if the extension number was found and move was
+ *                      successful, otherwise FALSE
  */
 bool psFitsMoveExtNum(
@@ -91,4 +108,12 @@
     int extnum,                        ///< the extension number to move to (zero is primary HDU)
     bool relative                      ///< if true, extnum is a relative number to the current position
+);
+
+/** Moves the FITS HDU to the end of the file
+ *
+ *  @return bool        TRUE if the move was successful, otherwise FALSE
+*/
+bool psFitsMoveLast(
+    const psFits* fits                 ///< the psFits object to move
 );
 
@@ -129,4 +154,23 @@
 );
 
+/** Remove the an HDU as specified by number
+ *
+ *  @return bool        TRUE if the specified HDU was removed, otherwise FALSE
+ */
+bool psFitsDeleteExtNum(
+    psFits* fits,                      ///< the psFits object
+    int extnum,                        ///< the extension number to delete (zero is primary HDU)
+    bool relative                      ///< if true, extnum is a relative number to the current position
+);
+
+/** Remove the an HDU as specified by extension name
+ *
+ *  @return bool        TRUE if the specified HDU was removed, otherwise FALSE
+ */
+bool psFitsDeleteExtName(
+    psFits* fits,                      ///< the psFits object
+    const char* extname                ///< the extension name to delete
+);
+
 /** Get the extension type of the current HDU.
  *
@@ -138,141 +182,10 @@
 );
 
-/** Reads the header of the current HDU.
+/** Delete all extensions after the current position
  *
- *  @return psMetadata*   the header data
+ *  @return bool        TRUE if the operation was successful, otherwise FALSE
  */
-psMetadata* psFitsReadHeader(
-    psMetadata* out,
-    ///< The psMetadata to add the header data.  If null, a new psMetadata is created.
-
-    const psFits* fits                 ///< the psFits object
-);
-
-/** Reads the header of all HDUs.  The current HDU is not changed.
- *
- *  @return psMetadata*      the header data set as a number of metadata entries
- */
-psMetadata* psFitsReadHeaderSet(
-    psMetadata* out,
-    ///< The psMetadata to add the header data via psMetadata items.  If null, a
-    ///< new psMetadata is created.  The keys of the psMetadata are the extension names
-    ///< of the cooresponding HDUs.
-
-    const psFits* fits                       ///< the psFits object
-);
-
-/** Writes the values of the metadata to the current HDU header.
- *
- *  @return bool        if TRUE, the write was successful, otherwise FALSE.
- */
-bool psFitsWriteHeader(
-    const psMetadata* output,          ///< the psMetadata data in which to write
+bool psFitsTruncate(
     psFits* fits                       ///< the psFits object
-);
-
-/** Reads an image, given the desired region and z-plane.
- *
- *  @return psImage*     the read image or NULL if there was an error.
- */
-psImage* psFitsReadImage(
-    psImage* out,                      ///< a psImage to recycle.
-    const psFits* fits,                ///< the psFits object
-    psRegion region,                   ///< the region in the FITS image to read
-    int z                              ///< the z-plane in the FITS image cube to read
-);
-
-/** Writes an image, given the desired region and z-plane.
- *
- *  @return bool        TRUE is the write was successful, otherwise FALSE.
- */
-bool psFitsWriteImage(
-    psFits* fits,                      ///< the psFits object
-    psMetadata* header,                ///< header items for the new HDU.  Can be NULL.
-    const psImage* input,              ///< the image to output
-    int depth                          ///< the number of z-planes of the FITS image data cube
-);
-
-/** Updates the FITS file image, given the desired region and z-plane.
- *
- *  @return bool        TRUE is the write was successful, otherwise FALSE.
- */
-bool psFitsUpdateImage(
-    psFits* fits,                      ///< the psFits object
-    const psImage* input,              ///< the image to output
-    psRegion region,                   ///< the region in the FITS image to write
-    int z                              ///< the z-planes of the FITS image data cube to write
-);
-
-/** Reads a table row.  The current HDU type must be either
- *  PS_FITS_TYPE_BINARY_TABLE or PS_FITS_TYPE_ASCII_TABLE.
- *
- *  @return psMetadata*    The table row's data.  The keys are the column names.
- */
-psMetadata* psFitsReadTableRow(
-    const psFits* fits,                ///< the psFits object
-    int row                            ///< row number to read
-);
-
-/** Reads a table column.  The current HDU type must be either
- *  PS_FITS_TYPE_BINARY_TABLE or PS_FITS_TYPE_ASCII_TABLE.
- *
- *  @return psArray*    Array of data items for the specified column or NULL
- *                      if an error occurred.
- */
-psArray* psFitsReadTableColumn(
-    const psFits* fits,                ///< the psFits object
-    const char* colname                ///< the column name
-);
-
-/** Reads a table column of numbers.  The current HDU type must be either
- *  PS_FITS_TYPE_BINARY_TABLE or PS_FITS_TYPE_ASCII_TABLE.
- *
- *  @return psVector*    Vector of data for the specified column or NULL
- *                       if an error occurred.
- */
-psVector* psFitsReadTableColumnNum(
-    const psFits* fits,                ///< the psFits object
-    const char* colname                ///< the column name
-);
-
-
-/** Reads a whole FITS table.  The current HDU type must be either
- *  PS_FITS_TYPE_BINARY_TABLE or PS_FITS_TYPE_ASCII_TABLE.
- *
- *  @return psArray*     Array of psMetadata items, which contains the output
- *                       data items of each row.
- *
- *  @see psFitsReadTableRow
- */
-psArray* psFitsReadTable(
-    psFits* fits                       ///< the psFits object
-);
-
-/** Writes a whole FITS table.  The current HDU type must be either
- *  PS_FITS_TYPE_BINARY_TABLE or PS_FITS_TYPE_ASCII_TABLE.
- *
- *  @return bool        TRUE if the write was successful, otherwise FALSE
- *
- *  @see psFitsReadTableRow
- */
-bool psFitsWriteTable(
-    psFits* fits,                      ///< the psFits object
-    const psMetadata* header,          ///< header items for the new HDU.  Can be NULL.
-    const psArray* table
-    ///< Array of psMetadata items, which contains the output data items of each row.
-);
-
-/** Updates a FITS table.  The current HDU type must be either
- *  PS_FITS_TYPE_BINARY_TABLE or PS_FITS_TYPE_ASCII_TABLE.
- *
- *  @return bool        TRUE if the write was successful, otherwise FALSE
- *
- *  @see psFitsWriteTable
- */
-bool psFitsUpdateTable(
-    psFits* fits,                ///< the psFits object
-    const psMetadata* data,
-    ///< Array of psMetadata items, which contains the output data items of each row.
-    int row                            ///< the row number to update.
 );
 
