IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Dec 4, 2006, 11:38:08 AM (19 years ago)
Author:
magnier
Message:

added pmConfigRecipeOptions

File:
1 edited

Legend:

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

    r10428 r10436  
    1919static bool loadRecipeSymbols(pmConfig *config);
    2020static bool loadRecipeOptions(pmConfig *config);
     21
     22// use this function to select the options structure for the specified recipe
     23// add additional command-line options to this metadata (before parsing the camera)
     24psMetadata *pmConfigRecipeOptions (pmConfig *config, char *recipeName)
     25{
     26
     27    // if the recipe is already defined in config->arguments, supplement
     28    // save the recipe options onto config->arguments:RECIPES
     29    psMetadata *options = psMetadataLookupMetadata(NULL, config->arguments, "OPTIONS");
     30    if (!options) {
     31        options = psMetadataAlloc ();
     32        psMetadataAddPtr (config->arguments, PS_LIST_TAIL, "OPTIONS",  PS_DATA_METADATA, "", options);
     33    } else {
     34        psMemIncrRefCounter (options); // so we can free options below if not allocated here
     35    }
     36
     37    // look for the recipe defined in recipes
     38    psMetadata *recipe = psMetadataLookupMetadata(NULL, options, recipeName);
     39    if (!recipe) {
     40        recipe = psMetadataAlloc ();
     41        psMetadataAddPtr (options, PS_LIST_TAIL, recipeName,  PS_DATA_METADATA, "", recipe);
     42    } else {
     43        psMemIncrRefCounter (recipe); // so we can free options below if not allocated here
     44    }
     45    psFree (options);
     46    return (recipe);
     47}
    2148
    2249// this function may be called several times.  it attempts to load the recipe data from one of
Note: See TracChangeset for help on using the changeset viewer.