IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 13658


Ignore:
Timestamp:
Jun 5, 2007, 3:08:13 PM (19 years ago)
Author:
Paul Price
Message:

Adding maskVal parameter to ppStats so that when it's called as a library function, it uses the nominated maskVal rather than it's own (which may be completely different from what the parent program may think it should mask).

Location:
trunk/ppStats/src
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/ppStats/src/ppStats.c

    r13640 r13658  
    1212                    pmFPA *fpa,         // FPA for which to get statistics
    1313                    pmFPAview *view,    // View for analysis
     14                    psMaskType maskVal, // Value to mask
    1415                    pmConfig *config    // Configuration
    1516    )
    1617{
    17     psExit status;
     18    PS_ASSERT_PTR_NON_NULL(fpa, NULL)
     19    PS_ASSERT_PTR_NON_NULL(view, NULL);
     20    PS_ASSERT_PTR_NON_NULL(config, NULL);
     21
     22    ppStatsData *data = ppStatsDataAlloc(); // All the input data
    1823
    1924    // Get the options, open the files
    20     ppStatsData *data = ppStatsSetupFromRecipe(NULL, config);
     25    if (!ppStatsSetupFromRecipe(data, config)) {
     26        psError(PS_ERR_UNKNOWN, false, "Unable to get ppStats options from recipe.");
     27        psFree(data);
     28        return NULL;
     29    }
     30
     31    // Override recipe mask value if one is provided
     32    if (maskVal != 0) {
     33        data->maskVal = maskVal;
     34    }
    2135
    2236    if (data->fpa) {
     
    3145
    3246    // Go through the FPA and do the hard work
     47    psExit status;                      // Status of statistics loop
    3348    psMetadata *result = ppStatsLoop(&status, out, data, config);
    3449    if (status != PS_EXIT_SUCCESS) {
    35         psError (PS_ERR_UNKNOWN, false, "trouble getting stats\n");
     50        psError (PS_ERR_UNKNOWN, false, "Not able to measure FPA statistics.\n");
    3651        psFree(result);
    37         psFree(data);
    38         return (NULL);
     52        psFree(data);
     53        return (NULL);
    3954    }
    4055
  • trunk/ppStats/src/ppStats.h

    r10293 r13658  
    1515                    pmFPA *fpa,         // FPA for which to get statistics
    1616                    pmFPAview *view,    // View for analysis
     17                    psMaskType maskVal, // Value to mask
    1718                    pmConfig *config    // Configuration
    1819    );
  • trunk/ppStats/src/ppStatsSetupFromArgs.c

    r13640 r13658  
    191191
    192192    // Get the rest from the recipe
    193     ppStatsSetupFromRecipe(data, config);
     193    if (!ppStatsSetupFromRecipe(data, config)) {
     194        psError(PS_ERR_UNKNOWN, false, "Unable to read ppStats options from recipe.");
     195        psFree(data);
     196        return NULL;
     197    }
    194198
    195199    // Print out what we're going to do
  • trunk/ppStats/src/ppStatsSetupFromRecipe.c

    r13603 r13658  
    1414// Strings in a recipe may be defined multiply (with MULTI) or listed on a single line
    1515static void listFromRecipe(psList *target, // The target list
    16                            const psMetadata *recipe, // Recipe to search
     16                           const psMetadata *recipe, // Recipe to search
    1717                           const char *name // Name for item within recipe
    1818    )
     
    6565
    6666
    67 ppStatsData *ppStatsSetupFromRecipe(ppStatsData *data, // Data for running ppStats
    68                                     pmConfig *config // Configuration
     67bool ppStatsSetupFromRecipe(ppStatsData *data, // Data for running ppStats
     68                            pmConfig *config // Configuration
    6969    )
    7070{
    71     if (!data) {
    72         data = ppStatsDataAlloc();
    73     }
     71    PS_ASSERT_PTR_NON_NULL(data, false);
     72    PS_ASSERT_PTR_NON_NULL(config, false);
    7473
    7574    // Determine recipe parameters
  • trunk/ppStats/src/ppStatsSetupFromRecipe.h

    r8337 r13658  
    55#include "ppStatsData.h"
    66
    7 ppStatsData *ppStatsSetupFromRecipe(ppStatsData *data, // Data for running ppStats
    8                                     pmConfig *config // Configuration
     7bool ppStatsSetupFromRecipe(ppStatsData *data, // Data for running ppStats
     8                            pmConfig *config // Configuration
    99    );
    1010
  • trunk/ppStats/src/ppStatsStandAlone.c

    r13640 r13658  
    6161    if (status != PS_EXIT_SUCCESS) {
    6262        psErrorStackPrint(stderr, "Error in stats loop.\n");
    63         exit (status);
     63        exit (status);
    6464    }
    6565    if (psListLength(results->list) == 0) {
    6666        psErrorStackPrint(stderr, "No output.\n");
    67         exit (status);
     67        exit (status);
    6868    }
    6969
Note: See TracChangeset for help on using the changeset viewer.