IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jun 1, 2006, 2:55:23 PM (20 years ago)
Author:
Paul Price
Message:

Addition of a vast quantity of assertions in public functions. Adopted a policy of using assert() within file-static functions (since they are only called internally, any errors there are problems with the program) and using the PS_ASSERT_WHATEVER() macros within public functions. Cleaned a few things up in the process.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/src/concepts/pmConcepts.c

    r7017 r7278  
    4444                      )
    4545{
    46     assert(blank);
     46    PS_ASSERT_PTR_NON_NULL(blank, false);
     47
    4748    if (!conceptsInitialised) {
    4849        pmConceptsInit();
     
    8081                         )
    8182{
     83    assert(specs);
     84    assert(target);
     85
    8286    if (!conceptsInitialised) {
    8387        pmConceptsInit();
     
    119123                        )
    120124{
     125    assert(specs);
     126    assert(read);
     127    assert(target);
     128
    121129    if (!conceptsInitialised) {
    122130        pmConceptsInit();
     
    156164                         )
    157165{
     166    assert(specs);
     167    assert(concepts);
     168
    158169    if (!conceptsInitialised) {
    159170        pmConceptsInit();
     
    180191                       )
    181192{
     193    PS_ASSERT_PTR_NON_NULL(fpa, false);
    182194    psTrace("psModule.concepts", 5, "Blanking FPA concepts: %x %x\n", conceptsFPA, fpa->concepts);
    183195    return conceptsBlank(&conceptsFPA, fpa->concepts);
     
    191203                      )
    192204{
     205    PS_ASSERT_PTR_NON_NULL(fpa, false);
    193206    psTrace("psModule.concepts", 5, "Reading FPA concepts: %x %x\n", conceptsFPA, fpa->concepts);
    194207    return conceptsRead(&conceptsFPA, fpa, NULL, NULL, &fpa->conceptsRead, source, db, fpa->concepts);
     
    201214                       )
    202215{
     216    PS_ASSERT_PTR_NON_NULL(fpa, false);
    203217    psTrace("psModule.concepts", 5, "Writing FPA concepts: %x %x\n", conceptsFPA, fpa->concepts);
    204218    return conceptsWrite(&conceptsFPA, fpa, NULL, NULL, source, db, fpa->concepts);
     
    209223                        )
    210224{
     225    PS_ASSERT_PTR_NON_NULL(chip, false);
    211226    psTrace("psModule.concepts", 5, "Blanking chip concepts: %x %x\n", conceptsChip, chip->concepts);
    212227    return conceptsBlank(&conceptsChip, chip->concepts);
     
    220235                       )
    221236{
     237    PS_ASSERT_PTR_NON_NULL(chip, false);
    222238    psTrace("psModule.concepts", 5, "Reading chip concepts: %x %x\n", conceptsChip, chip->concepts);
    223239    pmFPA *fpa = chip->parent;          // FPA to which the chip belongs
     
    235251                        )
    236252{
     253    PS_ASSERT_PTR_NON_NULL(chip, false);
    237254    psTrace("psModule.concepts", 5, "Writing chip concepts: %x %x\n", conceptsChip, chip->concepts);
    238255    pmFPA *fpa = chip->parent;          // FPA to which the chip belongs
     
    246263                        )
    247264{
     265    PS_ASSERT_PTR_NON_NULL(cell, false);
    248266    psTrace("psModule.concepts", 5, "Blanking cell concepts: %x %x\n", conceptsCell, cell->concepts);
    249267    return conceptsBlank(&conceptsCell, cell->concepts);
     
    257275                       )
    258276{
     277    PS_ASSERT_PTR_NON_NULL(cell, false);
    259278    psTrace("psModule.concepts", 5, "Reading cell concepts: %x %x\n", conceptsCell, cell->concepts);
    260279    pmChip *chip = cell->parent;        // Chip to which the cell belongs
     
    274293                        )
    275294{
     295    PS_ASSERT_PTR_NON_NULL(cell, false);
    276296    psTrace("psModule.concepts", 5, "Writing cell concepts: %x %x\n", conceptsCell, cell->concepts);
    277297    pmChip *chip = cell->parent;        // Chip to which the cell belongs
     
    336356        {
    337357            psMetadataItem *fpaRa = psMetadataItemAllocF64("FPA.RA", "Right Ascension of boresight", NAN);
    338             pmConceptRegister(fpaRa, (pmConceptParseFunc)pmConceptParse_FPA_Coords,
    339                               (pmConceptFormatFunc)pmConceptFormat_FPA_Coords, PM_FPA_LEVEL_FPA);
     358            pmConceptRegister(fpaRa, (pmConceptParseFunc)p_pmConceptParse_FPA_Coords,
     359                              (pmConceptFormatFunc)p_pmConceptFormat_FPA_Coords, PM_FPA_LEVEL_FPA);
    340360            psFree(fpaRa);
    341361        }
     
    344364        {
    345365            psMetadataItem *fpaDec = psMetadataItemAllocF64("FPA.DEC", "Declination of boresight", NAN);
    346             pmConceptRegister(fpaDec, (pmConceptParseFunc)pmConceptParse_FPA_Coords,
    347                               (pmConceptFormatFunc)pmConceptFormat_FPA_Coords, PM_FPA_LEVEL_FPA);
     366            pmConceptRegister(fpaDec, (pmConceptParseFunc)p_pmConceptParse_FPA_Coords,
     367                              (pmConceptFormatFunc)p_pmConceptFormat_FPA_Coords, PM_FPA_LEVEL_FPA);
    348368            psFree(fpaDec);
    349369        }
     
    446466                                          "Trim section", trimsec);
    447467            psFree(trimsec);
    448             pmConceptRegister(cellTrimsec, (pmConceptParseFunc)pmConceptParse_CELL_TRIMSEC,
    449                               (pmConceptFormatFunc)pmConceptFormat_CELL_TRIMSEC, PM_FPA_LEVEL_CELL);
     468            pmConceptRegister(cellTrimsec, (pmConceptParseFunc)p_pmConceptParse_CELL_TRIMSEC,
     469                              (pmConceptFormatFunc)p_pmConceptFormat_CELL_TRIMSEC, PM_FPA_LEVEL_CELL);
    450470            psFree(cellTrimsec);
    451471        }
     
    457477                                          "Bias sections", biassecs);
    458478            psFree(biassecs);
    459             pmConceptRegister(cellBiassec, (pmConceptParseFunc)pmConceptParse_CELL_BIASSEC,
    460                               (pmConceptFormatFunc)pmConceptFormat_CELL_BIASSEC, PM_FPA_LEVEL_CELL);
     479            pmConceptRegister(cellBiassec, (pmConceptParseFunc)p_pmConceptParse_CELL_BIASSEC,
     480                              (pmConceptFormatFunc)p_pmConceptFormat_CELL_BIASSEC, PM_FPA_LEVEL_CELL);
    461481            psFree(cellBiassec);
    462482        }
     
    465485        {
    466486            psMetadataItem *cellXbin = psMetadataItemAllocS32("CELL.XBIN", "Binning in x", 0);
    467             pmConceptRegister(cellXbin, (pmConceptParseFunc)pmConceptParse_CELL_Binning,
    468                               (pmConceptFormatFunc)pmConceptFormat_CELL_XBIN, PM_FPA_LEVEL_CELL);
     487            pmConceptRegister(cellXbin, (pmConceptParseFunc)p_pmConceptParse_CELL_Binning,
     488                              (pmConceptFormatFunc)p_pmConceptFormat_CELL_XBIN, PM_FPA_LEVEL_CELL);
    469489            psFree(cellXbin);
    470490        }
     
    473493        {
    474494            psMetadataItem *cellYbin = psMetadataItemAllocS32("CELL.YBIN", "Binning in y", 0);
    475             pmConceptRegister(cellYbin, (pmConceptParseFunc)pmConceptParse_CELL_Binning,
    476                               (pmConceptFormatFunc)pmConceptFormat_CELL_YBIN, PM_FPA_LEVEL_CELL);
     495            pmConceptRegister(cellYbin, (pmConceptParseFunc)p_pmConceptParse_CELL_Binning,
     496                              (pmConceptFormatFunc)p_pmConceptFormat_CELL_YBIN, PM_FPA_LEVEL_CELL);
    477497            psFree(cellYbin);
    478498        }
     
    481501        {
    482502            psMetadataItem *cellTimesys = psMetadataItemAllocS32("CELL.TIMESYS", "Time system", -1);
    483             pmConceptRegister(cellTimesys, (pmConceptParseFunc)pmConceptParse_CELL_TIMESYS,
    484                               (pmConceptFormatFunc)pmConceptFormat_CELL_TIMESYS, PM_FPA_LEVEL_CELL);
     503            pmConceptRegister(cellTimesys, (pmConceptParseFunc)p_pmConceptParse_CELL_TIMESYS,
     504                              (pmConceptFormatFunc)p_pmConceptFormat_CELL_TIMESYS, PM_FPA_LEVEL_CELL);
    485505            psFree(cellTimesys);
    486506        }
     
    495515                                       "Time of exposure", time);
    496516            psFree(time);
    497             pmConceptRegister(cellTime, (pmConceptParseFunc)pmConceptParse_CELL_TIME,
    498                               (pmConceptFormatFunc)pmConceptFormat_CELL_TIME, PM_FPA_LEVEL_CELL);
     517            pmConceptRegister(cellTime, (pmConceptParseFunc)p_pmConceptParse_CELL_TIME,
     518                              (pmConceptFormatFunc)p_pmConceptFormat_CELL_TIME, PM_FPA_LEVEL_CELL);
    499519            psFree(cellTime);
    500520        }
     
    503523        {
    504524            psMetadataItem *cellX0 = psMetadataItemAllocS32("CELL.X0", "Position of (0,0) on the chip", 0);
    505             pmConceptRegister(cellX0, (pmConceptParseFunc)pmConceptParse_CELL_Positions,
    506                               (pmConceptFormatFunc)pmConceptFormat_CELL_Positions, PM_FPA_LEVEL_CELL);
     525            pmConceptRegister(cellX0, (pmConceptParseFunc)p_pmConceptParse_CELL_Positions,
     526                              (pmConceptFormatFunc)p_pmConceptFormat_CELL_Positions, PM_FPA_LEVEL_CELL);
    507527            psFree(cellX0);
    508528        }
     
    511531        {
    512532            psMetadataItem *cellY0 = psMetadataItemAllocS32("CELL.Y0", "Position of (0,0) on the chip", 0);
    513             pmConceptRegister(cellY0, (pmConceptParseFunc)pmConceptParse_CELL_Positions,
    514                               (pmConceptFormatFunc)pmConceptFormat_CELL_Positions, PM_FPA_LEVEL_CELL);
     533            pmConceptRegister(cellY0, (pmConceptParseFunc)p_pmConceptParse_CELL_Positions,
     534                              (pmConceptFormatFunc)p_pmConceptFormat_CELL_Positions, PM_FPA_LEVEL_CELL);
    515535            psFree(cellY0);
    516536        }
     
    534554                      )
    535555{
     556    PS_ASSERT_PTR_NON_NULL(target, false);
     557    PS_ASSERT_PTR_NON_NULL(source, false);
     558
    536559    // Copy FPA concepts
    537560    target->concepts = psMetadataCopy(target->concepts, source->concepts);
Note: See TracChangeset for help on using the changeset viewer.