IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 10436


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

added pmConfigRecipeOptions

Location:
trunk/psModules/src/config
Files:
2 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
  • trunk/psModules/src/config/pmConfigRecipes.h

    r10428 r10436  
    99/// @author Eugene Magnier, IfA
    1010///
    11 /// @version $Revision: 1.1 $ $Name: not supported by cvs2svn $
    12 /// @date $Date: 2006-12-04 20:41:51 $
     11/// @version $Revision: 1.2 $ $Name: not supported by cvs2svn $
     12/// @date $Date: 2006-12-04 21:38:08 $
    1313///
    1414/// Copyright 2005-2006 Institute for Astronomy, University of Hawaii
     
    2929bool pmConfigLoadRecipeArguments (pmConfig *config);
    3030bool pmConfigLoadRecipeOptions (pmConfig *config, char *flag);
     31psMetadata *pmConfigRecipeOptions (pmConfig *config, char *recipe);
    3132
    3233#endif
Note: See TracChangeset for help on using the changeset viewer.