IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 6569


Ignore:
Timestamp:
Mar 9, 2006, 4:05:10 PM (20 years ago)
Author:
Paul Price
Message:

Changed recipe to recipes --- a metadata containing multiple recipes.
We suck in all the recipes listed in the camera configuration file.

Location:
branches/rel10_ifa/psModules/src/config
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/rel10_ifa/psModules/src/config/pmConfig.c

    r6553 r6569  
    33 *  @author PAP, IfA
    44 *
    5  *  @version $Revision: 1.7.4.3 $ $Name: not supported by cvs2svn $
    6  *  @date $Date: 2006-03-09 03:09:28 $
     5 *  @version $Revision: 1.7.4.4 $ $Name: not supported by cvs2svn $
     6 *  @date $Date: 2006-03-10 02:05:06 $
    77 *
    88 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    2323    psFree(config->site);
    2424    psFree(config->camera);
    25     psFree(config->recipe);
     25    psFree(config->recipes);
    2626    psFree(config->arguments);
    2727    psFree(config->database);
     
    3636    config->site = NULL;
    3737    config->camera = NULL;
    38     config->recipe = NULL;
     38    config->recipes = NULL;
    3939    config->arguments = NULL;
    4040    config->database = NULL;
     
    8585pmConfig *pmConfigRead(
    8686    int *argc,
    87     char **argv,
    88     const char *recipeName)
     87    char **argv)
    8988{
    9089    PS_ASSERT_INT_POSITIVE(*argc, false);
    9190    PS_ASSERT_PTR_NON_NULL(argv, false);
    9291
    93     pmConfig *config = pmConfigAlloc(); // The configuration, containing site, camera and recipe
     92    pmConfig *config = pmConfigAlloc(); // The configuration, containing site, camera and recipes
    9493
    9594    //
     
    164163    }
    165164
    166     //
    167     // Next, we do a similar thing for the recipe configuration file.  The
    168     // file is read and parsed into psMetadata struct "recipe".
    169     //
    170     //
    171     argNum = psArgumentGet(*argc, argv, "-recipe");
    172     if (argNum > 0) {
    173         psArgumentRemove(argNum, argc, argv);
    174         if (argNum >= *argc) {
    175             psLogMsg(__func__, PS_LOG_WARN,
    176                      "-recipe command-line switch provided without the required filename --- ignored.\n");
    177         } else {
    178             psArgumentRemove(argNum, argc, argv);
    179             readConfig(&config->recipe, argv[argNum], "recipe");
    180         }
    181     }
    182     // Or, load the recipe from the camera file, if appropriate
    183     if (! config->recipe && config->camera && recipeName) {
    184         pmConfigRecipeFromCamera(config, recipeName);
     165    // Load the recipes from the camera file, if appropriate
     166    if (! config->recipes && config->camera) {
     167        pmConfigReadRecipes(config);
    185168    }
    186169
     
    470453        }
    471454
     455        // Now we have the camera, we can read the recipes
     456        if (!config->recipes) {
     457            pmConfigReadRecipes(config);
     458        }
     459
    472460        return format;
    473461    }
     
    482470}
    483471
    484 bool pmConfigRecipeFromCamera(
    485     pmConfig *config,
    486     const char *recipeName)
     472bool pmConfigReadRecipes(
     473    pmConfig *config
     474)
    487475{
    488476    PS_ASSERT_PTR_NON_NULL(config, false);
    489477    PS_ASSERT_PTR_NON_NULL(config->camera, false);
    490     PS_ASSERT_PTR_NON_NULL(recipeName, false);
    491478
    492479    bool mdok = true;                   // Status of MD lookup
     
    496483        return false;
    497484    }
    498     psString recipeFileName = psMetadataLookupStr(&mdok, recipes, recipeName);
    499     (void)readConfig(&config->recipe, recipeFileName, "recipe");
     485    // Go through the recipes and load each one
     486    psMetadataIterator *recipesIter = psMetadataIteratorAlloc(recipes, PS_LIST_HEAD, NULL); // Iterator
     487    psMetadataItem *recipesItem = NULL; // Item from iteration
     488    while ((recipesItem = psMetadataGetAndIncrement(recipesIter))) {
     489        if (recipesItem->type != PS_DATA_STRING) {
     490            psLogMsg(__func__, PS_LOG_WARN, "Filename for recipe %s isn't of type STR --- ignored.\n",
     491                     recipesItem->name);
     492            continue;
     493        }
     494
     495        psMetadata *recipe = NULL;      // Recipe from file
     496        if (readConfig(&recipe, recipesItem->data.V, "recipe")) {
     497            psMetadataAdd(config->recipes, PS_LIST_TAIL, recipesItem->name,
     498                          PS_DATA_METADATA | PS_META_REPLACE, recipesItem->comment, recipe);
     499        }
     500        psFree(recipe);                 // Drop reference
     501    }
     502    psFree(recipesIter);
    500503
    501504    return true;
  • branches/rel10_ifa/psModules/src/config/pmConfig.h

    r6553 r6569  
    33 *  @author PAP, IfA
    44 *
    5  *  @version $Revision: 1.3.4.1 $ $Name: not supported by cvs2svn $
    6  *  @date $Date: 2006-03-09 03:09:28 $
     5 *  @version $Revision: 1.3.4.2 $ $Name: not supported by cvs2svn $
     6 *  @date $Date: 2006-03-10 02:05:10 $
    77 *
    88 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    2020    psMetadata *site;                   // Site configuration
    2121    psMetadata *camera;                 // Camera specification
    22     psMetadata *recipe;                 // Recipe for processing
     22    psMetadata *recipes;                // Recipes for processing
    2323    psMetadata *arguments;              // Command-line arguments
    2424    psDB *database;                     // Database handle
     
    4646pmConfig *pmConfigRead(
    4747    int *argc,
    48     char **argv,
    49     const char *recipeName);
    50 
     48    char **argv);
    5149
    5250/** pmConfigValidateCamera
     
    7876/** pmConfigRecipeFromCamera
    7977 *
    80  * pmConfigRecipeFromCamera shall load the recipe configuration based on the
    81  * recipeName and the list of known recipes contained in the camera
     78 * pmConfigRecipeFromCamera shall load the recipes from the list of known recipes contained in the camera
    8279 * configuration.
    8380 *
    8481 */
    85 bool pmConfigRecipeFromCamera(
    86     pmConfig *config,
    87     const char *recipeName
     82bool pmConfigReadRecipes(
     83    pmConfig *config
    8884);
    8985
Note: See TracChangeset for help on using the changeset viewer.