Changeset 11132 for trunk/psModules
- Timestamp:
- Jan 17, 2007, 5:14:09 PM (20 years ago)
- Location:
- trunk/psModules/src/concepts
- Files:
-
- 2 edited
-
pmConceptsStandard.c (modified) (1 diff)
-
pmConceptsStandard.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/concepts/pmConceptsStandard.c
r11091 r11132 42 42 psAbort(__func__, "Should never ever get here.\n"); 43 43 return NAN; 44 } 45 46 // FPA.FILTER 47 psMetadataItem *p_pmConceptParse_FPA_FILTER(const psMetadataItem *concept, 48 const psMetadataItem *pattern, 49 const psMetadata *cameraFormat, 50 const pmFPA *fpa, 51 const pmChip *chip, 52 const pmCell *cell) 53 { 54 assert(concept); 55 assert(pattern); 56 assert(fpa); 57 assert(fpa->camera); 58 59 if (concept->type != PS_DATA_STRING) { 60 psError(PS_ERR_BAD_PARAMETER_TYPE, true, "Type for %s (%x) is not STR\n", 61 pattern->name, concept->type); 62 return NULL; 63 } 64 65 bool mdok; // Status of MD lookup 66 psMetadata *filters = psMetadataLookupMetadata(&mdok, fpa->camera, "FILTER.ID"); 67 if (!mdok || !filters) { 68 psError(PS_ERR_UNEXPECTED_NULL, true, "Unable to find FILTER.ID in camera configuration.\n"); 69 return NULL; 70 } 71 72 const char *key = concept->data.str; // The name to look up 73 psString value = psMetadataLookupStr(&mdok, filters, key); // Value to use 74 if (!mdok || !value || strlen(value) == 0) { 75 psError(PS_ERR_UNEXPECTED_NULL, true, 76 "Unable to find %s in FILTER.ID in camera configuration.\n", key); 77 return NULL; 78 } 79 80 return psMetadataItemAllocStr(pattern->name, pattern->comment, value); 81 } 82 83 psMetadataItem *p_pmConceptFormat_FPA_FILTER(const psMetadataItem *concept, 84 const psMetadata *cameraFormat, 85 const pmFPA *fpa, 86 const pmChip *chip, 87 const pmCell *cell) 88 { 89 assert(concept); 90 assert(fpa); 91 assert(fpa->camera); 92 93 if (concept->type != PS_DATA_STRING) { 94 psError(PS_ERR_BAD_PARAMETER_TYPE, true, "Type for %s (%x) is not STR\n", 95 concept->name, concept->type); 96 return NULL; 97 } 98 99 bool mdok; // Status of MD lookup 100 psMetadata *filters = psMetadataLookupMetadata(&mdok, fpa->camera, "FILTER.ID"); 101 if (!mdok || !filters) { 102 psError(PS_ERR_UNEXPECTED_NULL, true, "Unable to find FILTER.ID in camera configuration.\n"); 103 return NULL; 104 } 105 106 psMetadataIterator *iter = psMetadataIteratorAlloc(filters, PS_LIST_HEAD, NULL); // Iterator for filters 107 psMetadataItem *item; // Item from iteration 108 char *name = NULL; // The winning name 109 while ((item = psMetadataGetAndIncrement(iter))) { 110 if (item->type != PS_DATA_STRING) { 111 psWarning("Type for %s (%x) in FILTER.ID in camera configuration is not STR\n", 112 item->name, item->type); 113 continue; 114 } 115 if (strcmp(item->data.str, concept->data.str)) { 116 name = item->name; 117 break; 118 } 119 } 120 if (!name) { 121 psError(PS_ERR_UNEXPECTED_NULL, false, 122 "Unable to find any filter matching %s in FILTER.ID in camera configuration.\n", 123 concept->data.str); 124 return NULL; 125 } 126 127 return psMetadataItemAllocStr(concept->name, concept->comment, name); 44 128 } 45 129 -
trunk/psModules/src/concepts/pmConceptsStandard.h
r9581 r11132 7 7 /// @author Paul Price, IfA 8 8 /// 9 /// @version $Revision: 1. 6$ $Name: not supported by cvs2svn $10 /// @date $Date: 200 6-10-16 22:03:56$9 /// @version $Revision: 1.7 $ $Name: not supported by cvs2svn $ 10 /// @date $Date: 2007-01-18 03:14:09 $ 11 11 /// 12 12 /// Copyright 2005-2006 Institute for Astronomy, University of Hawaii … … 21 21 // Functions to parse and format the standard concepts 22 22 23 24 /// Parse the FPA.FILTER concept to apply a lookup table 25 psMetadataItem *p_pmConceptParse_FPA_FILTER(const psMetadataItem *concept, ///< Concept to parse 26 const psMetadataItem *pattern, ///< Pattern to use in parsing 27 const psMetadata *cameraFormat, ///< Camera format definition 28 const pmFPA *fpa, ///< FPA for concept, or NULL 29 const pmChip *chip, ///< Chip for concept, or NULL 30 const pmCell *cell ///< Cell for concept, or NULL 31 ); 32 33 /// Format the FPA.FILTER concept to (reverse-)apply a lookup table 34 psMetadataItem *p_pmConceptFormat_FPA_FILTER(const psMetadataItem *concept, ///< Concept to format 35 const psMetadata *cameraFormat, ///< Camera format definition 36 const pmFPA *fpa, ///< FPA for concept, or NULL 37 const pmChip *chip, ///< Chip for concept, or NULL 38 const pmCell *cell ///< Cell for concept, or NULL 39 ); 23 40 24 41 /// Parse the coordinates concepts: FPA.RA and FPA.DEC
Note:
See TracChangeset
for help on using the changeset viewer.
