IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Oct 8, 2007, 4:56:23 PM (19 years ago)
Author:
Paul Price
Message:

Adding function to return the number of rows in a FITS table. Also asserting that FITS files are writable when they need to be.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/fits/psFitsTable.c

    r15179 r15248  
    77 *  @author Robert DeSonia, MHPCC
    88 *
    9  *  @version $Revision: 1.28 $ $Name: not supported by cvs2svn $
    10  *  @date $Date: 2007-10-03 21:27:21 $
     9 *  @version $Revision: 1.29 $ $Name: not supported by cvs2svn $
     10 *  @date $Date: 2007-10-09 02:56:23 $
    1111 *
    1212 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    3434#define MAX_STRING_LENGTH 256  // maximum length string for FITS routines
    3535
     36long psFitsTableSize(const psFits *fits)
     37{
     38    PS_ASSERT_FITS_NON_NULL(fits, 0);
     39
     40    int status = 0;                     // CFITSIO status
     41    long numRows;                       // Number of rows
     42    if (fits_get_num_rows(fits->fd, &numRows, &status)) {
     43        psFitsError(status, true, "Unable to determine number of rows in table.");
     44        return 0;
     45    }
     46
     47    return numRows;
     48}
    3649
    3750psMetadata* psFitsReadTableRow(const psFits* fits,
     
    388401{
    389402    PS_ASSERT_FITS_NON_NULL(fits, false);
     403    PS_ASSERT_FITS_WRITABLE(fits, false);
    390404    if (!psFitsMoveLast(fits)) {
    391405        psError(PS_ERR_UNKNOWN, false, "Unable to move to last extension to write table");
     
    465479{
    466480    PS_ASSERT_FITS_NON_NULL(fits, false);
     481    PS_ASSERT_FITS_WRITABLE(fits, false);
    467482    PS_ASSERT_ARRAY_NON_NULL(table, false);
    468483
     
    719734{
    720735    PS_ASSERT_FITS_NON_NULL(fits, false);
     736    PS_ASSERT_FITS_WRITABLE(fits, false);
    721737    PS_ASSERT_METADATA_NON_NULL(data, false);
    722738    PS_ASSERT_INT_NONNEGATIVE(row, false);
Note: See TracChangeset for help on using the changeset viewer.