Changeset 5786 for trunk/archive/scripts/src/phase2/pmFPAConceptsSet.c
- Timestamp:
- Dec 13, 2005, 5:47:35 PM (21 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/archive/scripts/src/phase2/pmFPAConceptsSet.c
r5633 r5786 109 109 const char *keyword = psMetadataLookupString(&mdok, translation, concept->name); 110 110 if (mdok && strlen(keyword) > 0) { 111 psTrace(__func__, 6, "It's in keyword %s\n", keyword); 111 112 psMetadataItem *headerItem = NULL; // Item to add to header 112 113 // XXX: Need to expand range of types … … 131 132 // We have a FITS header to look up --- search each level 132 133 if (cell && cell->hdu) { 133 psMetadataItem *cellItem = psMetadataLookup(cell->hdu->header, keyword); 134 if (cellItem) { 135 // XXX: Need to clean up before returning 136 psMetadataAddItem(cell->hdu->header, headerItem, PS_LIST_TAIL, PS_META_REPLACE); 137 status = true; 138 } 134 psTrace(__func__, 7, "Adding to the cell level header...\n"); 135 psMetadataAddItem(cell->hdu->header, headerItem, PS_LIST_TAIL, PS_META_REPLACE); 136 status = true; 139 137 } else if (chip && chip->hdu) { 140 psMetadataItem *chipItem = psMetadataLookup(chip->hdu->header, keyword); 141 if (chipItem) { 142 // XXX: Need to clean up before returning 143 psMetadataAddItem(chip->hdu->header, headerItem, PS_LIST_TAIL, PS_META_REPLACE); 144 status = true; 145 } 138 psTrace(__func__, 7, "Adding to the chip level header...\n"); 139 psMetadataAddItem(chip->hdu->header, headerItem, PS_LIST_TAIL, PS_META_REPLACE); 140 status = true; 146 141 } else if (fpa->hdu) { 147 psMetadataItem *fpaItem = psMetadataLookup(fpa->hdu->header, keyword); 148 if (fpaItem) { 149 // XXX: Need to clean up before returning 150 psMetadataAddItem(fpa->hdu->header, headerItem, PS_LIST_TAIL, PS_META_REPLACE); 151 status = true; 152 } 153 } else if (fpa->phu) { 154 psMetadataItem *fpaItem = psMetadataLookup(fpa->phu, keyword); 155 if (fpaItem) { 156 // XXX: Need to clean up before returning 157 psMetadataAddItem(fpa->phu, headerItem, PS_LIST_TAIL, PS_META_REPLACE); 158 status = true; 159 } 142 psTrace(__func__, 7, "Adding to the FPA level header...\n"); 143 psMetadataAddItem(fpa->hdu->header, headerItem, PS_LIST_TAIL, PS_META_REPLACE); 144 status = true; 145 } else { 146 // In desperation, add to the PHU --- it HAS to be in the header somewhere! 147 if (! fpa->phu) { 148 fpa->phu = psMetadataAlloc(); 149 } 150 psTrace(__func__, 7, "Adding to the PHU...\n"); 151 psMetadataAddItem(fpa->phu, headerItem, PS_LIST_TAIL, PS_META_REPLACE); 152 status = true; 160 153 } 161 154 psFree(headerItem); … … 182 175 183 176 psMetadataItem *defItem = psMetadataLookup(defaults, concept->name); 177 bool status = false; // Result of checking the database 184 178 if (defItem) { 185 179 if (defItem->type == PS_DATA_METADATA) { … … 209 203 " --- ignored.\n", dependsOn); 210 204 } 211 212 defItem = psMetadataLookup(dependents, depItem->data.V); // This is now what we were after 205 206 defItem = psMetadataLookup(dependents, depItem->data.V); // This is now what we were after 207 } 208 209 status = compareConcepts(defItem, concept); 210 if (! status) { 211 psError(PS_ERR_IO, true, "Concept %s is specified by default in the camera configuration, " 212 "but doesn't match the actual value.\n", concept->name); 213 213 } 214 214 } 215 215 216 216 // XXX: Need to clean up before returning 217 return compareConcepts(defItem, concept);217 return status; 218 218 } 219 219 … … 330 330 { 331 331 // Try headers, database, defaults in order 332 psTrace(__func__, 3, "Trying to set concept %s...\n", concept->name); 332 333 bool status = setConceptInCamera(cell, concept); // Status for return 333 334 if (! status) { 335 psTrace(__func__, 5, "Trying header....\n"); 334 336 status = setConceptInHeader(fpa, chip, cell, concept); 335 337 } 336 338 if (! status) { 339 psTrace(__func__, 5, "Trying database....\n"); 337 340 status = setConceptInDB(fpa, chip, cell, db, concept); 338 341 } 339 342 if (! status) { 343 psTrace(__func__, 5, "Checking defaults....\n"); 340 344 status = setConceptInDefault(fpa, chip, cell, concept); 341 345 }
Note:
See TracChangeset
for help on using the changeset viewer.
