IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jul 17, 2006, 5:01:41 PM (20 years ago)
Author:
Paul Price
Message:

Cleaning up ppStatsSetup(). Bug fixes. Seems to be working.

File:
1 edited

Legend:

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

    r7910 r7924  
    11#include <stdio.h>
     2#include <string.h>
    23#include <pslib.h>
    34#include <psmodules.h>
     
    2223}
    2324
     25static bool doThis(psList *toDoList,    // List of things to do
     26                   const char *this     // The name of "this"
     27    )
     28{
     29    if (psListLength(toDoList) == 0) {
     30        // No list --- do everything
     31        return true;
     32    }
     33
     34    psListIterator *iterator = psListIteratorAlloc(toDoList, PS_LIST_HEAD, false); // Iterator
     35    psString test;                      // Test string, from iteration
     36    while ((test = psListGetAndIncrement(iterator))) {
     37        if (strcmp(this, test) == 0) {
     38            // It's in the list --- do it
     39            psFree(iterator);
     40            return true;
     41        }
     42    }
     43    psFree(iterator);
     44    // Couldn't find it --- don't do it
     45    return false;
     46}
     47
    2448
    2549void ppStatsLoop(ppStatsData *data,     // The data
     
    5175        }
    5276        const char *chipName = psMetadataLookupStr(NULL, chip->concepts, "CHIP.NAME"); // Name of chip
     77
     78        // Check to see if this is a chip of interest
     79        if (!doThis(data->chips, chipName)) {
     80            continue;
     81        }
     82
    5383        psMetadata *chipResults = psMetadataAlloc(); // Metadata to hold the chip-level results
    5484
     
    6999            }
    70100            const char *cellName = psMetadataLookupStr(NULL, cell->concepts, "CELL.NAME"); // Name of cell
     101
     102            // Check to see if this is a cell of interest
     103            if (!doThis(data->cells, cellName)) {
     104                continue;
     105            }
     106
    71107            psMetadata *cellResults = psMetadataAlloc(); // Metadata to hold the cell-level results
    72108
     
    84120            if (!data->doStats) {
    85121                // Nothing further to do --- don't want to waste our time reading the data
     122                continue;
     123            }
     124
     125            pmHDU *hdu = pmHDUFromCell(cell); // HDU for cell
     126            if (!hdu || hdu->blankPHU) {
    86127                continue;
    87128            }
     
    192233    psFree(conceptsIter);
    193234
     235    if (psListLength(fpaResults->list) == 0) {
     236        psError(PS_ERR_UNKNOWN, true, "No output.\n");
     237        return;
     238    }
     239
    194240    psString output = psMetadataConfigFormat(fpaResults);
    195241    psFree(fpaResults);
Note: See TracChangeset for help on using the changeset viewer.