IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jan 8, 2007, 12:31:41 PM (19 years ago)
Author:
Paul Price
Message:

Fixed bugs with writing concepts to DEFAULTS --- code was all confused! Added function to return a list of concepts defined at a particular level, pmConceptsList.

File:
1 edited

Legend:

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

    r10487 r10967  
    119119        if (spec->format) {
    120120            formatted = spec->format(concept, cameraFormat, fpa, chip, cell);
     121        } else if (strcmp(concept->name, spec->blank->name) != 0) {
     122            // Adjust so that the name is correct
     123            formatted = psMetadataItemCopy(concept);
     124            psFree(formatted->name);
     125            formatted->name = psStringCopy(spec->blank->name);
    121126        } else {
     127            // Can get away with merely incrementing the reference counter
    122128            formatted = psMemIncrRefCounter((const psPtr)concept);
    123129        }
     
    294300    PS_ASSERT_PTR_NON_NULL(concepts, false);
    295301
    296     pmHDU *hdu = pmHDUGetLowest(NULL, NULL, cell); // The HDU at the lowest level
     302    pmHDU *hdu = pmHDUGetLowest(fpa, chip, cell); // The HDU at the lowest level
    297303    if (!hdu) {
    298304        return false;
     
    316322                // It's a menu --- need to look up the .DEPEND
    317323                psString dependName = NULL; // The concept name with ".DEPEND" on the end
    318                 psStringAppend(&dependName, ".DEPEND");
     324                psStringAppend(&dependName, "%s.DEPEND", defaultItem->name);
    319325                psString dependKey = psMetadataLookupStr(&mdok, defaults, dependName); // The keyword
    320                 psFree(dependName);
    321326                if (!mdok || !dependKey || strlen(dependKey) == 0) {
    322327                    psLogMsg(__func__, PS_LOG_WARN, "Can't find %s in the DEFAULTS for %s --- ignored.\n",
    323328                             dependName, name);
     329                    psFree(dependName);
    324330                    continue;
    325331                }
    326                 psString dependValue = psMetadataLookupStr(&mdok, concepts, dependName); // The value
    327                 if (!mdok || !dependKey || strlen(dependKey) == 0) {
     332                psString dependValue = psMetadataLookupStr(&mdok, concepts, dependKey); // The value
     333                if (!mdok || !dependValue || strlen(dependValue) == 0) {
    328334                    psLogMsg(__func__, PS_LOG_WARN, "Concept %s specified by %s isn't of type STR -- "
    329                              "ignored.\n", name, dependName);
     335                             "ignored.\n", dependKey, dependName);
     336                    psFree(dependName);
    330337                    continue;
    331338                }
    332                 conceptItem = psMetadataLookup(defaultItem->data.V, dependValue);
     339                psFree(dependName);
     340                // Get the actual item of interest, and correct the name to match the concept name
     341                defaultItem = psMetadataItemCopy(psMetadataLookup(defaultItem->data.md, dependValue));
     342                psFree(defaultItem->name);
     343                defaultItem->name = psStringCopy(name);
    333344            } else {
    334                 conceptItem = psMetadataLookup(concepts, name); // The item from the concepts
    335             }
     345                psMemIncrRefCounter(defaultItem);
     346            }
     347            conceptItem = psMetadataLookup(concepts, name); // The item from the concepts
    336348            psMetadataItem *formatted = conceptFormat(spec, conceptItem, cameraFormat, fpa, chip, cell);
    337349            if (!formatted) {
     
    342354                         "format, but the values don't match.\n", name);
    343355            }
     356            psFree(defaultItem);
    344357            psFree(formatted);
    345358        }
     
    356369    PS_ASSERT_PTR_NON_NULL(concepts, false);
    357370
    358     pmHDU *hdu = pmHDUGetLowest(NULL, NULL, cell); // The HDU at the lowest level
     371    pmHDU *hdu = pmHDUGetLowest(fpa, chip, cell); // The HDU at the lowest level
    359372    if (!hdu) {
    360373        return false;
     
    408421    #else
    409422
    410     pmHDU *hdu = pmHDUGetLowest(NULL, NULL, cell); // The HDU at the lowest level
     423    pmHDU *hdu = pmHDUGetLowest(fpa, chip, cell); // The HDU at the lowest level
    411424    if (!hdu) {
    412425        return false;
Note: See TracChangeset for help on using the changeset viewer.