IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Oct 29, 2007, 2:59:23 PM (19 years ago)
Author:
gusciora
Message:

Adding several changes to the objects directory. Most of these changes are
mere additions of PS_ASSERTs to the beginning of psModule functions to ensure
that input parameters are correct.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branch_20071023/psModules/src/objects/pmPSF_IO.c

    r15359 r15418  
    66 *  @author EAM, IfA
    77 *
    8  *  @version $Revision: 1.27.2.1 $ $Name: not supported by cvs2svn $
    9  *  @date $Date: 2007-10-23 20:54:53 $
     8 *  @version $Revision: 1.27.2.2 $ $Name: not supported by cvs2svn $
     9 *  @date $Date: 2007-10-30 00:59:23 $
    1010 *
    1111 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    5050bool pmPSFmodelCheckDataStatusForView (const pmFPAview *view, const pmFPAfile *file)
    5151{
     52    PS_ASSERT_PTR_NON_NULL(view, false);
     53    PS_ASSERT_PTR_NON_NULL(file, false);
     54    PS_ASSERT_PTR_NON_NULL(file->fpa, false);
     55    PS_ASSERT_PTR_NON_NULL(file->fpa->chips, false);
     56
    5257    pmFPA *fpa = file->fpa;
    5358
     
    6166    }
    6267    pmChip *chip = fpa->chips->data[view->chip];
     68    PS_ASSERT_PTR_NON_NULL(chip, false);
     69    PS_ASSERT_PTR_NON_NULL(chip->cells, false);
    6370
    6471    if (view->cell == -1) {
     
    7582
    7683bool pmPSFmodelCheckDataStatusForFPA (const pmFPA *fpa) {
     84
     85    PS_ASSERT_PTR_NON_NULL(fpa, false);
     86    PS_ASSERT_PTR_NON_NULL(fpa->chips, false);
    7787
    7888    for (int i = 0; i < fpa->chips->n; i++) {
     
    8595
    8696bool pmPSFmodelCheckDataStatusForChip (const pmChip *chip) {
     97    PS_ASSERT_PTR_NON_NULL(chip, false);
    8798
    8899    bool status;
     
    93104}
    94105
    95 bool pmPSFmodelWriteForView (const pmFPAview *view, pmFPAfile *file, const pmConfig *config) {
     106bool pmPSFmodelWriteForView (const pmFPAview *view, pmFPAfile *file, const pmConfig *config)
     107{
     108    PS_ASSERT_PTR_NON_NULL(view, false);
     109    PS_ASSERT_PTR_NON_NULL(file, false);
     110    PS_ASSERT_PTR_NON_NULL(file->fpa, false);
     111    PS_ASSERT_PTR_NON_NULL(file->fpa->chips, false);
    96112
    97113    pmFPA *fpa = file->fpa;
     
    125141bool pmPSFmodelWriteFPA (pmFPA *fpa, const pmFPAview *view, pmFPAfile *file, const pmConfig *config)
    126142{
     143    PS_ASSERT_PTR_NON_NULL(view, false);
     144    PS_ASSERT_PTR_NON_NULL(fpa, false);
     145    PS_ASSERT_PTR_NON_NULL(fpa->chips, false);
    127146    pmFPAview *thisView = pmFPAviewAlloc (view->nRows);
    128147    *thisView = *view;
     
    144163bool pmPSFmodelWriteChip (pmChip *chip, const pmFPAview *view, pmFPAfile *file, const pmConfig *config)
    145164{
     165    PS_ASSERT_PTR_NON_NULL(view, false);
     166    PS_ASSERT_PTR_NON_NULL(chip, false);
     167
    146168    if (!pmPSFmodelWrite (chip->analysis, view, file, config)) {
    147169        psError(PS_ERR_IO, false, "Failed to write PSF for chip");
     
    161183bool pmPSFmodelWrite (psMetadata *analysis, const pmFPAview *view, pmFPAfile *file, const pmConfig *config)
    162184{
     185    PS_ASSERT_PTR_NON_NULL(view, false);
     186    PS_ASSERT_PTR_NON_NULL(file, false);
     187    PS_ASSERT_PTR_NON_NULL(file->fpa, false);
    163188    bool status;
    164189    pmHDU *hdu;
     
    449474
    450475// if this file needs to have a PHU written out, write one
    451 bool pmPSFmodelWritePHU (const pmFPAview *view, pmFPAfile *file, const pmConfig *config) {
    452 
     476bool pmPSFmodelWritePHU (const pmFPAview *view, pmFPAfile *file, const pmConfig *config)
     477{
     478    PS_ASSERT_PTR_NON_NULL(view, false);
     479    PS_ASSERT_PTR_NON_NULL(file, false);
     480    PS_ASSERT_PTR_NON_NULL(file->fpa, false);
    453481    // not needed if already written
    454482    if (file->wrote_phu) return true;
     
    493521bool pmPSFmodelReadForView (const pmFPAview *view, pmFPAfile *file, const pmConfig *config)
    494522{
     523    PS_ASSERT_PTR_NON_NULL(view, false);
     524    PS_ASSERT_PTR_NON_NULL(file, false);
     525    PS_ASSERT_PTR_NON_NULL(file->fpa, false);
    495526
    496527    pmFPA *fpa = file->fpa;
     
    516547bool pmPSFmodelReadFPA (pmFPA *fpa, const pmFPAview *view, pmFPAfile *file, const pmConfig *config)
    517548{
     549    PS_ASSERT_PTR_NON_NULL(view, false);
     550    PS_ASSERT_PTR_NON_NULL(file, false);
     551    PS_ASSERT_PTR_NON_NULL(file->fpa, false);
     552
    518553    bool success = true;                // Was everything successful?
    519554    for (int i = 0; i < fpa->chips->n; i++) {
     
    527562bool pmPSFmodelReadChip (pmChip *chip, const pmFPAview *view, pmFPAfile *file, const pmConfig *config)
    528563{
     564    PS_ASSERT_PTR_NON_NULL(view, false);
     565    PS_ASSERT_PTR_NON_NULL(file, false);
     566    PS_ASSERT_PTR_NON_NULL(file->fpa, false);
     567
    529568    if (!pmPSFmodelRead (chip->analysis, view, file, config)) {
    530569        psError(PS_ERR_IO, false, "Failed to write PSF for chip");
     
    538577bool pmPSFmodelRead (psMetadata *analysis, const pmFPAview *view, pmFPAfile *file, const pmConfig *config)
    539578{
     579    PS_ASSERT_PTR_NON_NULL(view, false);
     580    PS_ASSERT_PTR_NON_NULL(file, false);
     581    PS_ASSERT_PTR_NON_NULL(file->fpa, false);
     582
    540583    bool status;
    541584    char *rule = NULL;
     
    762805}
    763806
    764 // create a psMetadata representation (human-readable) of a psf model
    765807// XXX pmPSF to/from Metadata functions were defined for 1.22 and earlier, but were dropped
Note: See TracChangeset for help on using the changeset viewer.