IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jun 17, 2008, 12:16:38 PM (18 years ago)
Author:
Paul Price
Message:

Changing use of psDB* to pmConfig* so that the database handle only has to be set up when required.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/src/camera/pmFPARead.c

    r18140 r18163  
    8282static bool cellNumReadouts(pmCell *cell,    // Cell of interest
    8383                            psFits *fits,    // FITS file
    84                             psDB *db
     84                            pmConfig *config // Configuration
    8585    )
    8686{
     
    9494        return false;
    9595    }
    96     if (!pmCellReadHeader(cell, fits, db)) {
     96    if (!pmCellReadHeader(cell, fits, config)) {
    9797        psError(PS_ERR_IO, false, "Unable to read header for cell!\n");
    9898        return false;
     
    143143                                  int numScans, // Number of scans to read at a time
    144144                                  fpaReadType type, // Type of image
    145                                   psDB *db // Database handle for concepts
     145                                  pmConfig *config // Configuration
    146146    )
    147147{
     
    153153
    154154    if (!pmConceptsReadCell(readout->parent, PM_CONCEPT_SOURCE_DEFAULTS | PM_CONCEPT_SOURCE_DATABASE,
    155                             true, db)) {
     155                            true, config)) {
    156156        psError(PS_ERR_IO, false, "Failed to read concepts for cell.");
    157157        return false;
     
    209209                        int numScans,   // Number of scans to read at a time
    210210                        fpaReadType type, // Type of image
    211                         psDB *db        // Database handle for concepts
     211                        pmConfig *config// Configuration
    212212    )
    213213{
     
    229229        return false;
    230230    }
    231     int naxis3 = cellNumReadouts(cell, fits, db); // Number of planes
     231    int naxis3 = cellNumReadouts(cell, fits, config); // Number of planes
    232232    if (z >= naxis3) {
    233233        // No more to read
     
    237237    int next;                           // Next position
    238238    int last;                           // Last position
    239     if (!readoutScanProperties(&next, &last, readout, numScans, type, db)) {
     239    if (!readoutScanProperties(&next, &last, readout, numScans, type, config)) {
    240240        psError(PS_ERR_UNKNOWN, false, "Unable to determine readout properties.");
    241241        return false;
     
    395395                             int overlap, // Number of scans (row/col) to overlap between scans
    396396                             fpaReadType type, // Type of image
    397                              psDB *db   // Database handle for concepts
     397                             pmConfig *config   // Configuration
    398398    )
    399399{
     
    416416    }
    417417
    418     int naxis3 = cellNumReadouts(cell, fits, db); // Number of image planes
     418    int naxis3 = cellNumReadouts(cell, fits, config); // Number of image planes
    419419    if (z >= naxis3) {
    420420        psError(PS_ERR_IO, false, "Desired image plane (%d) exceeds available number (%d).",
     
    425425    int next;                           // Next position
    426426    int last;                           // Last position
    427     if (!readoutScanProperties(&next, &last, readout, numScans, type, db)) {
     427    if (!readoutScanProperties(&next, &last, readout, numScans, type, config)) {
    428428        psError(PS_ERR_UNKNOWN, false, "Unable to determine readout properties.");
    429429        return false;
     
    532532static bool cellRead(pmCell *cell,      // Cell into which to read
    533533                     psFits *fits,      // FITS file from which to read
    534                      psDB *db,          // Database handle, for concepts ingest
     534                     pmConfig *config,  // Configuration
    535535                     fpaReadType type   // Type to read
    536536                    )
     
    578578
    579579    // load in the concept information for this cell
    580     if (!pmConceptsReadCell(cell, PM_CONCEPT_SOURCE_HEADER | PM_CONCEPT_SOURCE_DATABASE, true, db)) {
     580    if (!pmConceptsReadCell(cell, PM_CONCEPT_SOURCE_HEADER | PM_CONCEPT_SOURCE_DATABASE, true, config)) {
    581581        //psError(PS_ERR_UNKNOWN, false, "Failed to read concepts for cell");
    582582        //return false;
     
    653653static bool chipRead(pmChip *chip,      // Chip into which to read
    654654                     psFits *fits,      // FITS file from which to read
    655                      psDB *db,          // Database handle, for concepts ingest
     655                     pmConfig *config,  // Configuration
    656656                     fpaReadType type   // Type to read
    657657                    )
     
    664664    for (int i = 0; i < cells->n; i++) {
    665665        pmCell *cell = cells->data[i];  // The cell of interest
    666         success |= cellRead(cell, fits, db, type);
     666        success |= cellRead(cell, fits, config, type);
    667667    }
    668668    if (success) {
     
    684684static bool fpaRead(pmFPA *fpa,         // FPA into which to read
    685685                    psFits *fits,       // FITS file from which to read
    686                     psDB *db,           // Database handle, for concepts ingest
     686                    pmConfig *config,   // Configuration
    687687                    fpaReadType type    // Type to read
    688688                   )
     
    695695    for (int i = 0; i < chips->n; i++) {
    696696        pmChip *chip = chips->data[i];  // The cell of interest
    697         success |= chipRead(chip, fits, db, type);
     697        success |= chipRead(chip, fits, config, type);
    698698    }
    699699    if (success) {
     
    720720// pmReadoutReadNext is maintained here (for now) to maintain backwards compatibility.
    721721// pmReadoutReadNext has been replaced by pmReadoutRead, pmReadoutReadChunk, pmReadoutMore
    722 bool pmReadoutReadNext(bool *status, pmReadout *readout, psFits *fits, int z, int numScans, psDB *db)
     722bool pmReadoutReadNext(bool *status, pmReadout *readout, psFits *fits, int z, int numScans, pmConfig *config)
    723723{
    724724    PS_ASSERT_PTR_NON_NULL(readout, false);
     
    741741    }
    742742
    743     if (!pmCellReadHeader(cell, fits, db)) {
     743    if (!pmCellReadHeader(cell, fits, config)) {
    744744        psError(PS_ERR_IO, false, "Unable to read header for cell!\n");
    745745        return false;
     
    896896
    897897
    898 bool pmReadoutMore(pmReadout *readout, psFits *fits, int z, int numScans, psDB *db)
     898bool pmReadoutMore(pmReadout *readout, psFits *fits, int z, int numScans, pmConfig *config)
    899899{
    900900    PS_ASSERT_PTR_NON_NULL(readout, false);
    901901    PS_ASSERT_FITS_NON_NULL(fits, false);
    902902
    903     return readoutMore(readout, fits, z, numScans, FPA_READ_TYPE_IMAGE, db);
    904 }
    905 
    906 bool pmReadoutReadChunk(pmReadout *readout, psFits *fits, int z, int numScans, int overlap, psDB *db)
     903    return readoutMore(readout, fits, z, numScans, FPA_READ_TYPE_IMAGE, config);
     904}
     905
     906bool pmReadoutReadChunk(pmReadout *readout, psFits *fits, int z, int numScans, int overlap, pmConfig *config)
    907907{
    908908    PS_ASSERT_PTR_NON_NULL(readout, false);
     
    911911    PS_ASSERT_INT_NONNEGATIVE(numScans, false);
    912912
    913     return readoutReadChunk(readout, fits, z, numScans, overlap, FPA_READ_TYPE_IMAGE, db);
    914 }
    915 
    916 bool pmReadoutRead(pmReadout *readout, psFits *fits, int z, psDB *db)
     913    return readoutReadChunk(readout, fits, z, numScans, overlap, FPA_READ_TYPE_IMAGE, config);
     914}
     915
     916bool pmReadoutRead(pmReadout *readout, psFits *fits, int z, pmConfig *config)
    917917{
    918918    PS_ASSERT_PTR_NON_NULL(readout, false);
    919919    PS_ASSERT_FITS_NON_NULL(fits, false);
    920920
    921     return readoutReadChunk(readout, fits, z, 0, 0, FPA_READ_TYPE_IMAGE, db);
    922 }
    923 
    924 int pmCellNumReadouts(pmCell *cell, psFits *fits, psDB *db)
     921    return readoutReadChunk(readout, fits, z, 0, 0, FPA_READ_TYPE_IMAGE, config);
     922}
     923
     924int pmCellNumReadouts(pmCell *cell, psFits *fits, pmConfig *config)
    925925{
    926926    PS_ASSERT_PTR_NON_NULL(cell, false);
    927927    PS_ASSERT_FITS_NON_NULL(fits, false);
    928928
    929     return cellNumReadouts(cell, fits, db);
    930 }
    931 
    932 bool pmCellRead(pmCell *cell, psFits *fits, psDB *db)
     929    return cellNumReadouts(cell, fits, config);
     930}
     931
     932bool pmCellRead(pmCell *cell, psFits *fits, pmConfig *config)
    933933{
    934934    PS_ASSERT_PTR_NON_NULL(cell, false);
    935935    PS_ASSERT_FITS_NON_NULL(fits, false);
    936936
    937     return cellRead(cell, fits, db, FPA_READ_TYPE_IMAGE);
    938 }
    939 
    940 bool pmChipRead(pmChip *chip, psFits *fits, psDB *db)
     937    return cellRead(cell, fits, config, FPA_READ_TYPE_IMAGE);
     938}
     939
     940bool pmChipRead(pmChip *chip, psFits *fits, pmConfig *config)
    941941{
    942942    PS_ASSERT_PTR_NON_NULL(chip, false);
    943943    PS_ASSERT_FITS_NON_NULL(fits, false);
    944944
    945     return chipRead(chip, fits, db, FPA_READ_TYPE_IMAGE);
    946 }
    947 
    948 bool pmFPARead(pmFPA *fpa, psFits *fits, psDB *db)
     945    return chipRead(chip, fits, config, FPA_READ_TYPE_IMAGE);
     946}
     947
     948bool pmFPARead(pmFPA *fpa, psFits *fits, pmConfig *config)
    949949{
    950950    PS_ASSERT_PTR_NON_NULL(fpa, false);
    951951    PS_ASSERT_FITS_NON_NULL(fits, false);
    952952
    953     return fpaRead(fpa, fits, db, FPA_READ_TYPE_IMAGE);
     953    return fpaRead(fpa, fits, config, FPA_READ_TYPE_IMAGE);
    954954}
    955955
     
    959959//////////////////////////////////////////////////////////////////////////////////////////////////////////////
    960960
    961 bool pmReadoutMoreMask(pmReadout *readout, psFits *fits, int z, int numScans, psDB *db)
     961bool pmReadoutMoreMask(pmReadout *readout, psFits *fits, int z, int numScans, pmConfig *config)
    962962{
    963963    PS_ASSERT_PTR_NON_NULL(readout, false);
    964964    PS_ASSERT_FITS_NON_NULL(fits, false);
    965965
    966     return readoutMore(readout, fits, z, numScans, FPA_READ_TYPE_MASK, db);
    967 }
    968 
    969 bool pmReadoutReadChunkMask(pmReadout *readout, psFits *fits, int z, int numScans, int overlap, psDB *db)
     966    return readoutMore(readout, fits, z, numScans, FPA_READ_TYPE_MASK, config);
     967}
     968
     969bool pmReadoutReadChunkMask(pmReadout *readout, psFits *fits, int z, int numScans, int overlap,
     970                            pmConfig *config)
    970971{
    971972    PS_ASSERT_PTR_NON_NULL(readout, false);
     
    974975    PS_ASSERT_INT_NONNEGATIVE(numScans, false);
    975976
    976     return readoutReadChunk(readout, fits, z, numScans, overlap, FPA_READ_TYPE_MASK, db);
    977 }
    978 
    979 bool pmReadoutReadMask(pmReadout *readout, psFits *fits, int z, psDB *db)
     977    return readoutReadChunk(readout, fits, z, numScans, overlap, FPA_READ_TYPE_MASK, config);
     978}
     979
     980bool pmReadoutReadMask(pmReadout *readout, psFits *fits, int z, pmConfig *config)
    980981{
    981982    PS_ASSERT_PTR_NON_NULL(readout, false);
    982983    PS_ASSERT_FITS_NON_NULL(fits, false);
    983984
    984     return readoutReadChunk(readout, fits, z, 0, 0, FPA_READ_TYPE_MASK, db);
    985 }
    986 
    987 bool pmCellReadMask(pmCell *cell, psFits *fits, psDB *db)
     985    return readoutReadChunk(readout, fits, z, 0, 0, FPA_READ_TYPE_MASK, config);
     986}
     987
     988bool pmCellReadMask(pmCell *cell, psFits *fits, pmConfig *config)
    988989{
    989990    PS_ASSERT_PTR_NON_NULL(cell, false);
    990991    PS_ASSERT_FITS_NON_NULL(fits, false);
    991992
    992     return cellRead(cell, fits, db, FPA_READ_TYPE_MASK);
    993 }
    994 
    995 bool pmChipReadMask(pmChip *chip, psFits *fits, psDB *db)
     993    return cellRead(cell, fits, config, FPA_READ_TYPE_MASK);
     994}
     995
     996bool pmChipReadMask(pmChip *chip, psFits *fits, pmConfig *config)
    996997{
    997998    PS_ASSERT_PTR_NON_NULL(chip, false);
    998999    PS_ASSERT_FITS_NON_NULL(fits, false);
    9991000
    1000     return chipRead(chip, fits, db, FPA_READ_TYPE_MASK);
    1001 }
    1002 
    1003 bool pmFPAReadMask(pmFPA *fpa, psFits *fits, psDB *db)
     1001    return chipRead(chip, fits, config, FPA_READ_TYPE_MASK);
     1002}
     1003
     1004bool pmFPAReadMask(pmFPA *fpa, psFits *fits, pmConfig *config)
    10041005{
    10051006    PS_ASSERT_PTR_NON_NULL(fpa, false);
    10061007    PS_ASSERT_FITS_NON_NULL(fits, false);
    10071008
    1008     return fpaRead(fpa, fits, db, FPA_READ_TYPE_MASK);
     1009    return fpaRead(fpa, fits, config, FPA_READ_TYPE_MASK);
    10091010}
    10101011
     
    10131014//////////////////////////////////////////////////////////////////////////////////////////////////////////////
    10141015
    1015 bool pmReadoutMoreWeight(pmReadout *readout, psFits *fits, int z, int numScans, psDB *db)
     1016bool pmReadoutMoreWeight(pmReadout *readout, psFits *fits, int z, int numScans, pmConfig *config)
    10161017{
    10171018    PS_ASSERT_PTR_NON_NULL(readout, false);
    10181019    PS_ASSERT_FITS_NON_NULL(fits, false);
    10191020
    1020     return readoutMore(readout, fits, z, numScans, FPA_READ_TYPE_WEIGHT, db);
    1021 }
    1022 
    1023 bool pmReadoutReadChunkWeight(pmReadout *readout, psFits *fits, int z, int numScans, int overlap, psDB *db)
     1021    return readoutMore(readout, fits, z, numScans, FPA_READ_TYPE_WEIGHT, config);
     1022}
     1023
     1024bool pmReadoutReadChunkWeight(pmReadout *readout, psFits *fits, int z, int numScans, int overlap,
     1025                              pmConfig *config)
    10241026{
    10251027    PS_ASSERT_PTR_NON_NULL(readout, false);
     
    10281030    PS_ASSERT_INT_NONNEGATIVE(numScans, false);
    10291031
    1030     return readoutReadChunk(readout, fits, z, numScans, overlap, FPA_READ_TYPE_WEIGHT, db);
    1031 }
    1032 
    1033 bool pmReadoutReadWeight(pmReadout *readout, psFits *fits, int z, psDB *db)
     1032    return readoutReadChunk(readout, fits, z, numScans, overlap, FPA_READ_TYPE_WEIGHT, config);
     1033}
     1034
     1035bool pmReadoutReadWeight(pmReadout *readout, psFits *fits, int z, pmConfig *config)
    10341036{
    10351037    PS_ASSERT_PTR_NON_NULL(readout, false);
    10361038    PS_ASSERT_FITS_NON_NULL(fits, false);
    10371039
    1038     return readoutReadChunk(readout, fits, z, 0, 0, FPA_READ_TYPE_WEIGHT, db);
    1039 }
    1040 
    1041 bool pmCellReadWeight(pmCell *cell, psFits *fits, psDB *db)
     1040    return readoutReadChunk(readout, fits, z, 0, 0, FPA_READ_TYPE_WEIGHT, config);
     1041}
     1042
     1043bool pmCellReadWeight(pmCell *cell, psFits *fits, pmConfig *config)
    10421044{
    10431045    PS_ASSERT_PTR_NON_NULL(cell, false);
    10441046    PS_ASSERT_FITS_NON_NULL(fits, false);
    10451047
    1046     return cellRead(cell, fits, db, FPA_READ_TYPE_WEIGHT);
    1047 }
    1048 
    1049 bool pmChipReadWeight(pmChip *chip, psFits *fits, psDB *db)
     1048    return cellRead(cell, fits, config, FPA_READ_TYPE_WEIGHT);
     1049}
     1050
     1051bool pmChipReadWeight(pmChip *chip, psFits *fits, pmConfig *config)
    10501052{
    10511053    PS_ASSERT_PTR_NON_NULL(chip, false);
    10521054    PS_ASSERT_FITS_NON_NULL(fits, false);
    10531055
    1054     return chipRead(chip, fits, db, FPA_READ_TYPE_WEIGHT);
    1055 }
    1056 
    1057 bool pmFPAReadWeight(pmFPA *fpa, psFits *fits, psDB *db)
     1056    return chipRead(chip, fits, config, FPA_READ_TYPE_WEIGHT);
     1057}
     1058
     1059bool pmFPAReadWeight(pmFPA *fpa, psFits *fits, pmConfig *config)
    10581060{
    10591061    PS_ASSERT_PTR_NON_NULL(fpa, false);
    10601062    PS_ASSERT_FITS_NON_NULL(fits, false);
    10611063
    1062     return fpaRead(fpa, fits, db, FPA_READ_TYPE_WEIGHT);
     1064    return fpaRead(fpa, fits, config, FPA_READ_TYPE_WEIGHT);
    10631065}
    10641066
     
    10671069//////////////////////////////////////////////////////////////////////////////////////////////////////////////
    10681070
    1069 bool pmCellReadHeaderSet(pmCell *cell, psFits *fits, psDB *db)
     1071bool pmCellReadHeaderSet(pmCell *cell, psFits *fits, pmConfig *config)
    10701072{
    10711073    PS_ASSERT_PTR_NON_NULL(cell, false);
    10721074    PS_ASSERT_FITS_NON_NULL(fits, false);
    10731075
    1074     return cellRead(cell, fits, db, FPA_READ_TYPE_HEADER);
    1075 }
    1076 
    1077 bool pmChipReadHeaderSet(pmChip *chip, psFits *fits, psDB *db)
     1076    return cellRead(cell, fits, config, FPA_READ_TYPE_HEADER);
     1077}
     1078
     1079bool pmChipReadHeaderSet(pmChip *chip, psFits *fits, pmConfig *config)
    10781080{
    10791081    PS_ASSERT_PTR_NON_NULL(chip, false);
    10801082    PS_ASSERT_FITS_NON_NULL(fits, false);
    10811083
    1082     return chipRead(chip, fits, db, FPA_READ_TYPE_HEADER);
    1083 }
    1084 
    1085 bool pmFPAReadHeaderSet(pmFPA *fpa, psFits *fits, psDB *db)
     1084    return chipRead(chip, fits, config, FPA_READ_TYPE_HEADER);
     1085}
     1086
     1087bool pmFPAReadHeaderSet(pmFPA *fpa, psFits *fits, pmConfig *config)
    10861088{
    10871089    PS_ASSERT_PTR_NON_NULL(fpa, false);
    10881090    PS_ASSERT_FITS_NON_NULL(fits, false);
    10891091
    1090     return fpaRead(fpa, fits, db, FPA_READ_TYPE_HEADER);
     1092    return fpaRead(fpa, fits, config, FPA_READ_TYPE_HEADER);
    10911093}
    10921094
Note: See TracChangeset for help on using the changeset viewer.