Changeset 15987 for trunk/psModules/test/camera/tap_pmFPAExtent.c
- Timestamp:
- Jan 2, 2008, 10:53:30 AM (19 years ago)
- File:
-
- 1 edited
-
trunk/psModules/test/camera/tap_pmFPAExtent.c (modified) (14 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/test/camera/tap_pmFPAExtent.c
r14882 r15987 5 5 #include "tap.h" 6 6 #include "pstap.h" 7 // XXX: Use better name for the temporary FITS file 8 // XXX: The code to generate and free the FPA hierarchy was copied from 9 // tap-pmFPA.c. EIther include it directly, or library, or something. 10 // Also, get rid of the manual free functions and use psFree() once 11 // it correctly frees child members 7 /* STATUS: 8 All functions are tested. 9 */ 10 12 11 // XXX: For the genSimpleFPA() code, add IDs to each function so that 13 12 // the values set in each chip-?cell-?hdu-?image are unique … … 81 80 cell->hdu = pmHDUAlloc("cellExtName"); 82 81 for (int i = 0 ; i < NUM_READOUTS ; i++) { 83 cell->readouts->data[i] = generateSimpleReadout(cell);84 } 85 86 bool rc = pmConfigFileRead(&cell->hdu->format, "data /camera0/format0.config", "Camera format 0");82 cell->readouts->data[i] = psMemDecrRefCounter((psPtr) generateSimpleReadout(cell)); 83 } 84 85 bool rc = pmConfigFileRead(&cell->hdu->format, "dataFiles/camera0/format0.config", "Camera format 0"); 87 86 if (!rc) { 88 diag("pmConfigFileRead() was unsuccessful (from generateSimpleCell())"); 87 rc = pmConfigFileRead(&cell->hdu->format, "../camera0/format0.config", "Camera format 0"); 88 if (!rc) { 89 diag("pmConfigFileRead() was unsuccessful (from generateSimpleCell())"); 90 } 89 91 } 90 92 … … 102 104 103 105 //XXX: Should the region be set some other way? Like through the various config files? 104 // psRegion *region = psRegionAlloc(0.0, TEST_NUM_COLS-1, 0.0, TEST_NUM_ROWS-1);105 106 psRegion *region = psRegionAlloc(0.0, 0.0, 0.0, 0.0); 106 107 // You shouldn't have to remove the key from the metadata. Find out how to simply change the key value. … … 122 123 psMetadataAddS32(chip->analysis, PS_LIST_HEAD, MISC_NAME, 0, NULL, MISC_NUM); 123 124 psMetadataAddS32(chip->concepts, PS_LIST_HEAD, MISC_NAME, 0, NULL, MISC_NUM); 124 // chip->hdu = pmHDUAlloc("chipExtName");125 //126 // bool rc = pmConfigFileRead(&chip->hdu->format, "data/camera0/format0.config", "Camera format 0");127 // if (!rc) {128 // diag("pmConfigFileRead() was unsuccessful (from generateSimpleChip())");129 // }130 //131 125 psArrayRealloc(chip->cells, NUM_CELLS); 132 126 for (int i = 0 ; i < NUM_CELLS ; i++) { 133 chip->cells->data[i] = generateSimpleCell(chip);127 chip->cells->data[i] = psMemDecrRefCounter((psPtr) generateSimpleCell(chip)); 134 128 } 135 129 … … 153 147 psMetadataAddS32((psMetadata *) fpa->camera, PS_LIST_HEAD, MISC_NAME, 0, NULL, MISC_NUM); 154 148 psMetadataAddS32(fpa->concepts, PS_LIST_HEAD, MISC_NAME, 0, NULL, MISC_NUM); 155 // fpa->hdu = pmHDUAlloc("fpaExtName");156 //157 // bool rc = pmConfigFileRead(&fpa->hdu->format, "data/camera0/format0.config", "Camera format 0");158 // if (!rc) {159 // diag("pmConfigFileRead() was unsuccessful (from generateSimpleFPA())");160 // }161 149 162 150 psArrayRealloc(fpa->chips, NUM_CHIPS); 163 151 for (int i = 0 ; i < NUM_CHIPS ; i++) { 164 fpa->chips->data[i] = generateSimpleChip(fpa); 165 } 166 167 // XXX: Eventually, when you finish the pmConcepts tests, add full concept 168 // reading code from wherever. 152 fpa->chips->data[i] = psMemDecrRefCounter((psPtr) generateSimpleChip(fpa)); 153 } 154 169 155 pmConceptsBlankFPA(fpa); 170 // bool mdok;171 // psMetadata *fileData = psMetadataLookupMetadata(&mdok, fpa->hdu->format, "FILE");172 // char *fpaNameHdr = psMetadataLookupStr(&mdok, fileData, "FPA.NAME");173 // psMetadataAddStr(fpa->concepts, PS_LIST_TAIL, "FPA.NAME", PS_META_REPLACE, NULL, fpaNameHdr);174 175 156 return(fpa); 176 157 } 177 158 178 // XXX: This should only be necessary until the psFree() functions for179 // FPA/chip/cell/readout correctly free all child chips/cells/readouts180 void myFreeCell(pmCell *cell)181 {182 for (int k = 0 ; k < cell->readouts->n ; k++) {183 psFree(cell->readouts->data[k]);184 }185 psFree(cell);186 }187 188 void myFreeChip(pmChip *chip) {189 for (int j = 0 ; j < chip->cells->n ; j++) {190 myFreeCell(chip->cells->data[j]);191 }192 psFree(chip);193 }194 195 void myFreeFPA(pmFPA *fpa)196 {197 for (int i = 0 ; i < fpa->chips->n ; i++) {198 myFreeChip(fpa->chips->data[i]);199 }200 psFree(fpa);201 }202 159 203 160 … … 250 207 ok(!errorFlag, "pmReadoutExtent() passed all tests"); 251 208 252 myFreeFPA(fpa);209 psFree(fpa); 253 210 psFree(camera); 254 211 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); … … 258 215 // ---------------------------------------------------------------------- 259 216 // pmCellExtent() tests: NULL input 260 // psRegion *pmCellExtent(const pmCell *cell)261 217 { 262 218 psMemId id = psMemGetId(); … … 312 268 ok(!errorFlag, "pmCellExtent() passed all tests"); 313 269 314 myFreeFPA(fpa);270 psFree(fpa); 315 271 psFree(camera); 316 272 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); … … 321 277 // ---------------------------------------------------------------------- 322 278 // pmChipExtent() tests: NULL input 323 // psRegion *pmChipExtent(const pmChip *chip)324 279 { 325 280 psMemId id = psMemGetId(); … … 361 316 ok(!errorFlag, "pmChipExtent() passed all tests"); 362 317 363 myFreeFPA(fpa);318 psFree(fpa); 364 319 psFree(camera); 365 320 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); … … 369 324 // ---------------------------------------------------------------------- 370 325 // pmChipPixels() tests: NULL input 371 // psRegion *pmChipPixels(const pmChip *chip)372 326 { 373 327 psMemId id = psMemGetId(); … … 416 370 ok(!errorFlag, "pmChipPixels() passed all tests"); 417 371 418 myFreeFPA(fpa);372 psFree(fpa); 419 373 psFree(camera); 420 374 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); … … 424 378 // ---------------------------------------------------------------------- 425 379 // pmFPAPixels() tests: NULL input 426 // psRegion *pmFPAPixels(const pmFPA *fpa)427 380 { 428 381 psMemId id = psMemGetId(); … … 464 417 psFree(tstExtent); 465 418 psFree(actualExtent); 466 myFreeFPA(fpa);419 psFree(fpa); 467 420 psFree(camera); 468 421 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 469 422 } 470 471 472 473 474 } 423 }
Note:
See TracChangeset
for help on using the changeset viewer.
