Changeset 12873 for trunk/ppSim/src/ppSimCreate.c
- Timestamp:
- Apr 17, 2007, 6:29:18 PM (19 years ago)
- File:
-
- 1 edited
-
trunk/ppSim/src/ppSimCreate.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ppSim/src/ppSimCreate.c
r12834 r12873 13 13 PS_ASSERT_PTR_NON_NULL(config, NULL); 14 14 15 psString formatName = psMetadataLookupStr(NULL, config->arguments, "FORMAT"); // Input format name16 config->formatName = psMemIncrRefCounter(formatName);17 18 psMetadata *formats = psMetadataLookupMetadata(NULL, config->camera, "FORMATS"); // The camera formats19 if (!formats) {20 psError(PS_ERR_UNEXPECTED_NULL, true, "Unable to find FORMATS in camera configuration.");21 return NULL;22 }23 psMetadata *format = psMetadataLookupMetadata(NULL, formats, formatName); // Format of interest24 if (!format) {25 psError(PS_ERR_UNEXPECTED_NULL, true, "Unable to find format %s in camera FORMATS.", formatName);26 return NULL;27 }28 pmFPALevel phuLevel = pmFPAPHULevel(format); // Level at which PHU goes29 30 15 pmFPA *fpa = pmFPAConstruct(config->camera); // FPA to contain the observation 31 16 if (!fpa) { … … 34 19 } 35 20 21 pmFPAfile *file = pmFPAfileDefineOutput(config, fpa, OUTPUT_FILE); 22 psFree(fpa); 23 if (!file) { 24 psError(PS_ERR_UNEXPECTED_NULL, false, "Unable to create output file from %s. " 25 "Did you forget to specify the format?", OUTPUT_FILE); 26 return NULL; 27 } 28 if (file->type != PM_FPA_FILE_IMAGE) { 29 psError(PS_ERR_BAD_PARAMETER_TYPE, true, "%s type is not IMAGE", OUTPUT_FILE); 30 psFree(file); 31 return NULL; 32 } 33 34 pmFPALevel phuLevel = pmFPAPHULevel(file->format); // Level at which PHU goes 35 36 36 pmFPAview *view = pmFPAviewAlloc(0);// View for current level 37 37 38 38 if (phuLevel == PM_FPA_LEVEL_FPA) { 39 if (!pmFPAAddSourceFromView(fpa, "Simulation", view, f ormat)) {39 if (!pmFPAAddSourceFromView(fpa, "Simulation", view, file->format)) { 40 40 psError(PS_ERR_UNKNOWN, false, "Unable to add PHU to FPA."); 41 41 psFree(fpa); … … 48 48 while ((chip = pmFPAviewNextChip(view, fpa, 1))) { 49 49 if (phuLevel == PM_FPA_LEVEL_CHIP) { 50 if (!pmFPAAddSourceFromView(fpa, "Simulation", view, f ormat)) {50 if (!pmFPAAddSourceFromView(fpa, "Simulation", view, file->format)) { 51 51 psError(PS_ERR_UNKNOWN, false, "Unable to add PHU to FPA."); 52 52 psFree(fpa); … … 59 59 while ((cell = pmFPAviewNextCell(view, fpa, 1))) { 60 60 if (phuLevel == PM_FPA_LEVEL_CELL) { 61 if (!pmFPAAddSourceFromView(fpa, "Simulation", view, f ormat)) {61 if (!pmFPAAddSourceFromView(fpa, "Simulation", view, file->format)) { 62 62 psError(PS_ERR_UNKNOWN, false, "Unable to add PHU to FPA."); 63 63 psFree(fpa); … … 70 70 psFree(view); 71 71 72 pmFPAfile *file = pmFPAfileDefineOutput(config, fpa, OUTPUT_FILE);73 psFree(fpa);74 if (!file) {75 psError(PS_ERR_UNEXPECTED_NULL, false, "Unable to create output file from %s", OUTPUT_FILE);76 return NULL;77 }78 if (file->type != PM_FPA_FILE_IMAGE) {79 psError(PS_ERR_BAD_PARAMETER_TYPE, true, "%s type is not IMAGE", OUTPUT_FILE);80 psFree(file);81 return NULL;82 }83 84 72 return file; 85 73 }
Note:
See TracChangeset
for help on using the changeset viewer.
