Changeset 6342 for branches/eam_rel9_p0/psModules/src/astrom/pmFPA.c
- Timestamp:
- Feb 7, 2006, 11:18:31 AM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_rel9_p0/psModules/src/astrom/pmFPA.c
r6267 r6342 12 12 * XXX: Should we implement non-linear cell->chip transforms? 13 13 * 14 * @version $Revision: 1.1.2. 6$ $Name: not supported by cvs2svn $15 * @date $Date: 2006-0 1-31 20:09:52$14 * @version $Revision: 1.1.2.7 $ $Name: not supported by cvs2svn $ 15 * @date $Date: 2006-02-07 21:18:31 $ 16 16 * 17 17 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 33 33 *****************************************************************************/ 34 34 #define PS_FREE_HIERARCHY 1 35 #define PARENT_LINKS 0 36 35 37 static void readoutFree(pmReadout *readout) 36 38 { 37 39 if (readout != NULL) { 38 #if 039 40 psTrace(__func__, 9, "Removing readout %lx from cell %lx...\n", (size_t) readout, (size_t) readout->parent); 40 41 if (readout->parent) { … … 42 43 for (int i = 0; i < readouts->n; i++) { 43 44 if (readouts->data[i] == readout) { 44 pmReadout *tmpReadout = readouts->data[i];45 // pmReadout *tmpReadout = readouts->data[i]; 45 46 readouts->data[i] = NULL; 47 #if PARENT_LINKS 48 46 49 psFree(tmpReadout); 50 #endif 51 47 52 break; 48 53 } 49 54 } 50 55 } 56 psTrace(__func__, 9, "Freeing readout %lx\n", (size_t) readout); 57 58 #if PARENT_LINKS 59 60 psFree(readout->parent); 51 61 #endif 52 psTrace(__func__, 9, "Freeing readout %lx\n", (size_t) readout);53 54 psFree(readout->parent);55 62 56 63 psFree(readout->image); … … 64 71 { 65 72 if (cell != NULL) { 66 #if 067 73 psTrace(__func__, 9, "Removing cell %lx from chip %lx...\n", (size_t)cell, (size_t)cell->parent); 68 74 if (cell->parent) { … … 70 76 for (int i = 0; i < cells->n; i++) { 71 77 if (cells->data[i] == cell) { 72 pmCell *tmpCell = cells->data[i];78 // pmCell *tmpCell = cells->data[i]; 73 79 cells->data[i] = NULL; 80 #if PARENT_LINKS 81 74 82 psFree(tmpCell); 83 #endif 84 75 85 break; 76 86 } 77 87 } 78 88 } 89 psTrace(__func__, 9, "Freeing cell %lx\n", (size_t)cell); 90 91 pmCellFreeReadouts(cell); 92 psFree(cell->readouts); 93 #if PARENT_LINKS 94 95 psFree(cell->parent); 79 96 #endif 80 psTrace(__func__, 9, "Freeing cell %lx\n", (size_t)cell);81 82 pmCellFreeReadouts(cell);83 psFree(cell->parent);84 97 85 98 psFree(cell->toChip); … … 96 109 { 97 110 if (chip != NULL) { 98 #if 099 111 psTrace(__func__, 9, "Removing chip %lx from fpa %lx...\n", (size_t)chip, (size_t)chip->parent); 100 112 if (chip->parent) { … … 102 114 for (int i = 0; i < chips->n; i++) { 103 115 if (chips->data[i] == chip) { 104 pmChip *tmpChip = chips->data[i];116 // pmChip *tmpChip = chips->data[i]; 105 117 chips->data[i] = NULL; 118 #if PARENT_LINKS 119 106 120 psFree(tmpChip); 121 #endif 122 107 123 break; 108 124 } 109 125 } 110 126 } 127 psTrace(__func__, 9, "Freeing chip %lx\n", (size_t)chip); 128 129 pmChipFreeCells(chip); 130 psFree(chip->cells); 131 #if PARENT_LINKS 132 133 psFree(chip->parent); 111 134 #endif 112 psTrace(__func__, 9, "Freeing chip %lx\n", (size_t)chip);113 114 pmChipFreeCells(chip);115 psFree(chip->parent);116 135 117 136 psFree(chip->toFPA); … … 134 153 psFree(fpa->analysis); 135 154 psFree(fpa->camera); 136 #if 1137 155 // 138 156 // Set the parent to NULL in all fpa->chips before psFree(fpa->chips) … … 148 166 } 149 167 } 150 #endif168 psFree(fpa->chips); 151 169 psFree(fpa->hdu); 152 170 psFree(fpa->phu); … … 167 185 psTrace(__func__, 9, "Will now free readout %lx...\n", (size_t)tmpReadout); 168 186 psFree(tmpReadout); // Drop the readout 187 #if PARENT_LINKS 188 169 189 psFree(cell); // Decrement reference counter on cell, since readout->parent isn't held any more 190 #endif 191 170 192 } 171 193 cell->readouts = psArrayRealloc(cell->readouts, 0); 194 cell->readouts->n = 0; 172 195 } 173 196 … … 186 209 pmCellFreeReadouts(tmpCell);// Drop all readouts the cell holds 187 210 psFree(tmpCell); // Drop the cell 211 #if PARENT_LINKS 212 188 213 psFree(chip); // Decrement reference counter on chip, since cell->parent isn't held any more 214 #endif 215 189 216 } 190 217 chip->cells = psArrayRealloc(chip->cells, 0); 218 chip->cells->n = 0; 191 219 } 192 220 … … 219 247 tmpReadout->bias = psListAlloc(NULL); 220 248 tmpReadout->analysis = psMetadataAlloc(); 249 #if PARENT_LINKS 250 221 251 tmpReadout->parent = psMemIncrRefCounter(cell); 252 #else 253 254 tmpReadout->parent = cell; 255 #endif 256 222 257 if (cell != NULL) { 223 258 cell->readouts = psArrayAdd(cell->readouts, 1, (psPtr) tmpReadout); … … 249 284 tmpCell->analysis = psMetadataAlloc(); 250 285 tmpCell->readouts = psArrayAlloc(0); 286 #if PARENT_LINKS 287 251 288 tmpCell->parent = psMemIncrRefCounter(chip); 289 #else 290 291 tmpCell->parent = chip; 292 #endif 293 252 294 if (chip != NULL) { 253 295 chip->cells = psArrayAdd(chip->cells, 1, (psPtr) tmpCell); … … 282 324 tmpChip->analysis = psMetadataAlloc(); 283 325 tmpChip->cells = psArrayAlloc(0); 326 #if PARENT_LINKS 327 284 328 tmpChip->parent = psMemIncrRefCounter(fpa); 329 #else 330 331 tmpChip->parent = fpa; 332 #endif 333 285 334 if (fpa != NULL) { 286 335 fpa->chips = psArrayAdd(fpa->chips, 1, (psPtr) tmpChip);
Note:
See TracChangeset
for help on using the changeset viewer.
