IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 13862


Ignore:
Timestamp:
Jun 18, 2007, 12:17:11 PM (19 years ago)
Author:
magnier
Message:

invert order of FILTER.ID: internal STR external (key names are controlled)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/src/concepts/pmConceptsStandard.c

    r13742 r13862  
    7474    }
    7575
    76     const char *key = concept->data.str;        // The name to look up
    77     psString value = psMetadataLookupStr(&mdok, filters, key); // Value to use
    78     if (!mdok || !value || strlen(value) == 0) {
    79         psError(PS_ERR_UNEXPECTED_NULL, true,
    80                 "Unable to find %s in FILTER.ID in camera configuration.\n", key);
    81         return NULL;
    82     }
    83 
    84     return psMetadataItemAllocStr(pattern->name, pattern->comment, value);
    85 }
    86 
    87 psMetadataItem *p_pmConceptFormat_FPA_FILTER(const psMetadataItem *concept,
    88                                              pmConceptSource source,
    89                                              const psMetadata *cameraFormat,
    90                                              const pmFPA *fpa,
    91                                              const pmChip *chip,
    92                                              const pmCell *cell)
    93 {
    94     assert(concept);
    95     assert(fpa);
    96     assert(fpa->camera);
    97 
    98     if (concept->type != PS_DATA_STRING) {
    99         psError(PS_ERR_BAD_PARAMETER_TYPE, true, "Type for %s (%x) is not STR\n",
    100                 concept->name, concept->type);
    101         return NULL;
    102     }
    103 
    104     bool mdok;                          // Status of MD lookup
    105     psMetadata *filters = psMetadataLookupMetadata(&mdok, fpa->camera, "FILTER.ID");
    106     if (!mdok || !filters) {
    107         psError(PS_ERR_UNEXPECTED_NULL, true, "Unable to find FILTER.ID in camera configuration.\n");
    108         return NULL;
    109     }
    110 
     76    // the metadata is in the format (internal) STR (external)
     77    // do a reverse lookup to get the internal name
    11178    psMetadataIterator *iter = psMetadataIteratorAlloc(filters, PS_LIST_HEAD, NULL); // Iterator for filters
    11279    psMetadataItem *item;               // Item from iteration
     
    13198    }
    13299
    133     return psMetadataItemAllocStr(concept->name, concept->comment, name);
    134 }
    135 
     100    return psMetadataItemAllocStr(pattern->name, pattern->comment, name);
     101}
     102
     103psMetadataItem *p_pmConceptFormat_FPA_FILTER(const psMetadataItem *concept,
     104                                             pmConceptSource source,
     105                                             const psMetadata *cameraFormat,
     106                                             const pmFPA *fpa,
     107                                             const pmChip *chip,
     108                                             const pmCell *cell)
     109{
     110    assert(concept);
     111    assert(fpa);
     112    assert(fpa->camera);
     113
     114    if (concept->type != PS_DATA_STRING) {
     115        psError(PS_ERR_BAD_PARAMETER_TYPE, true, "Type for %s (%x) is not STR\n",
     116                concept->name, concept->type);
     117        return NULL;
     118    }
     119
     120    bool mdok;                          // Status of MD lookup
     121    psMetadata *filters = psMetadataLookupMetadata(&mdok, fpa->camera, "FILTER.ID");
     122    if (!mdok || !filters) {
     123        psError(PS_ERR_UNEXPECTED_NULL, true, "Unable to find FILTER.ID in camera configuration.\n");
     124        return NULL;
     125    }
     126
     127    const char *key = concept->data.str;        // The name to look up
     128   
     129    // the metadata is in the format (internal) STR (external)
     130    // find the first internal name that matches
     131    psString value = psMetadataLookupStr(&mdok, filters, key); // Value to use
     132    if (!mdok || !value || strlen(value) == 0) {
     133        psError(PS_ERR_UNEXPECTED_NULL, true,
     134                "Unable to find %s in FILTER.ID in camera configuration.\n", key);
     135        return NULL;
     136    }
     137
     138    return psMetadataItemAllocStr(concept->name, concept->comment, value);
     139}
    136140
    137141// FPA.RA and FPA.DEC
Note: See TracChangeset for help on using the changeset viewer.