IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Mar 11, 2009, 10:54:22 AM (17 years ago)
Author:
Paul Price
Message:

Adding functionality of reading input files from the configuration dump. This is principally used for ensuring we apply the same detrend images with ppImage that we used originally. Applying this framework to ppImage. Will soon apply to other products. Reworked the pmFPAfileDefineFrom* functions to use common code; I think it still works.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/src/config/pmConfigRun.c

    r23259 r23268  
    7171}
    7272
     73psArray *pmConfigRunFileGet(pmConfig *config, const char *name)
     74{
     75    PS_ASSERT_PTR_NON_NULL(config, false);
     76    PS_ASSERT_STRING_NON_EMPTY(name, false);
     77
     78    psMetadata *run = configRun(config);// RUN information
     79    psAssert(run, "Require run-time information");
     80    psMetadata *files = configElement(run, "FILES", "Filerules used during execution");
     81    psAssert(files, "Require list of files");
     82
     83    psList *list = psListAlloc(NULL);   // List of file names
     84
     85    psString regex = NULL;              // Regular expression for iteration
     86    psStringAppend(&regex, "^%s$", name);
     87    psMetadataIterator *iter = psMetadataIteratorAlloc(files, PS_LIST_HEAD, regex);
     88    psFree(regex);
     89    psMetadataItem *item;               // Item from iteration
     90    while ((item = psMetadataGetAndIncrement(iter))) {
     91        psAssert(item->type == PS_DATA_STRING, "We only put STRING types here.");
     92        psListAdd(list, PS_LIST_TAIL, item->data.str);
     93    }
     94    psFree(iter);
     95
     96    if (psListLength(list) == 0) {
     97        // Didn't find anything
     98        psFree(list);
     99        return NULL;
     100    }
     101
     102    psArray *array = psListToArray(list); // Array of file names, to return
     103    psFree(list);
     104
     105    return array;
     106}
     107
    73108
    74109bool pmConfigRunCommand(pmConfig *config, int argc, char **argv)
Note: See TracChangeset for help on using the changeset viewer.