IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Oct 3, 2007, 11:27:21 AM (19 years ago)
Author:
Paul Price
Message:

Merging branch with FITS compression development.

File:
1 edited

Legend:

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

    r12549 r15179  
    77 *  @author Robert DeSonia, MHPCC
    88 *
    9  *  @version $Revision: 1.27 $ $Name: not supported by cvs2svn $
    10  *  @date $Date: 2007-03-22 21:40:47 $
     9 *  @version $Revision: 1.28 $ $Name: not supported by cvs2svn $
     10 *  @date $Date: 2007-10-03 21:27:21 $
    1111 *
    1212 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    3838                               int row)
    3939{
     40    PS_ASSERT_FITS_NON_NULL(fits, NULL);
     41    PS_ASSERT_INT_NONNEGATIVE(row, NULL);
     42
    4043    long numRows;
    4144    int numCols;
    4245    int status = 0;
    43 
    44     if (fits == NULL) {
    45         psError(PS_ERR_BAD_PARAMETER_NULL, true,
    46                 _("The input psFits object can not NULL."));
    47         return NULL;
    48     }
    4946
    5047    // check to see if we even are positioned on a table HDU
     
    185182                               const char* colname)
    186183{
     184    PS_ASSERT_FITS_NON_NULL(fits, NULL);
     185    PS_ASSERT_STRING_NON_EMPTY(colname, NULL);
     186
    187187    int colnum = 0;
    188188    int status = 0;
    189 
    190     if (fits == NULL) {
    191         psError(PS_ERR_BAD_PARAMETER_NULL, true,
    192                 _("The input psFits object can not NULL."));
    193         return NULL;
    194     }
    195189
    196190    // check to see if we even are positioned on a table HDU
     
    266260                                   const char* colname)
    267261{
     262    PS_ASSERT_FITS_NON_NULL(fits, NULL);
     263    PS_ASSERT_STRING_NON_EMPTY(colname, NULL);
     264
    268265    int status = 0;
    269266    int colnum = 0;
    270 
    271     if (fits == NULL) {
    272         psError(PS_ERR_BAD_PARAMETER_NULL, true,
    273                 _("The input psFits object can not NULL."));
    274         return NULL;
    275     }
    276267
    277268    // check to see if we even are positioned on a table HDU
     
    348339psArray* psFitsReadTable(const psFits* fits)
    349340{
     341    PS_ASSERT_FITS_NON_NULL(fits, NULL);
     342
    350343    int status = 0;
    351 
    352     if (fits == NULL) {
    353         psError(PS_ERR_BAD_PARAMETER_NULL, true,
    354                 _("The input psFits object can not NULL."));
    355         return NULL;
    356     }
    357344
    358345    // check to see if we even are positioned on a table HDU
     
    400387                      const char *extname)
    401388{
    402     psFitsMoveLast(fits);
     389    PS_ASSERT_FITS_NON_NULL(fits, false);
     390    if (!psFitsMoveLast(fits)) {
     391        psError(PS_ERR_UNKNOWN, false, "Unable to move to last extension to write table");
     392        return false;
     393    }
    403394    return psFitsInsertTable(fits, header, table, extname, true);
    404395}
     
    460451// Column specification
    461452// Included here, because there's no need for the user to have access to it
    462 typedef struct
    463 {
     453typedef struct {
    464454    psDataType type;                    // psLib type (e.g., PS_DATA_STRING or PS_TYPE_F32)
    465455    size_t size;                        // Size (number of repeats)
    466456    psElemType vectorType;              // psLib type of vectors
    467 }
    468 colSpec;
     457} colSpec;
    469458
    470459
     
    475464                       bool after)
    476465{
     466    PS_ASSERT_FITS_NON_NULL(fits, false);
     467    PS_ASSERT_ARRAY_NON_NULL(table, false);
     468
    477469    int status = 0;
    478 
    479     PS_ASSERT_PTR_NON_NULL(fits, false);
    480     PS_ASSERT_ARRAY_NON_NULL(table, false);
    481470
    482471    long numRows = table->n;
     
    614603        char fitsErr[MAX_STRING_LENGTH];
    615604        fits_get_errstatus(status, fitsErr);
    616         psError(PS_ERR_LOCATION_INVALID, true, "Unable to create FITS table with %ld columns and %ld rows: %s",
     605        psError(PS_ERR_LOCATION_INVALID, true,
     606                "Unable to create FITS table with %ld columns and %ld rows: %s",
    617607                numColumns, table->n, fitsErr);
    618608        psFree(colSpecsIter);
     
    632622    if (extname && strlen(extname) > 0) {
    633623        if (!psFitsSetExtName(fits, extname)) {
    634             psError(PS_ERR_IO, false, "Unable to write FITS header extension name.\n");
    635             psFree(colSpecsIter);
    636             psFree(colSpecs);
    637             return false;
    638         }
     624            psError(PS_ERR_IO, false, "Unable to write FITS header extension name.\n");
     625            psFree(colSpecsIter);
     626            psFree(colSpecs);
     627            return false;
     628        }
    639629    }
    640630
     
    728718                       int row)
    729719{
     720    PS_ASSERT_FITS_NON_NULL(fits, false);
     721    PS_ASSERT_METADATA_NON_NULL(data, false);
     722    PS_ASSERT_INT_NONNEGATIVE(row, false);
     723
    730724    int status = 0;
    731 
    732     if (fits == NULL) {
    733         psError(PS_ERR_BAD_PARAMETER_NULL, true,
    734                 _("The input psFits object can not NULL."));
    735         return false;
    736     }
    737 
    738     if (data == NULL) {
    739         psError(PS_ERR_BAD_PARAMETER_NULL, true,
    740                 _("The input psImage was NULL.  Need a non-NULL psImage for operation to be performed."));
    741         return false;
    742     }
    743725
    744726    // check to see if we even are positioned on a table HDU
Note: See TracChangeset for help on using the changeset viewer.