IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 7470


Ignore:
Timestamp:
Jun 9, 2006, 3:57:59 PM (20 years ago)
Author:
jhoblitt
Message:

partial implementation of -rerun

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ippTools/src/dettool.c

    r7424 r7470  
    17851785
    17861786
    1787 static bool rerunMode(pxConfig *config)
     1787static bool rerunMode1(pxConfig *config)
    17881788{
    17891789    PS_ASSERT_PTR_NON_NULL(config, false);
     
    18081808        return false;
    18091809    }
    1810     psMetadata *where = psMetadataAlloc();
     1810    psList *exp_id_list = item->data.list;
    18111811
    18121812    // make sure that -exp_id was parsed correctly
    18131813    // XXX this can be removed someday
    18141814    if (item->type == PS_DATA_METADATA_MULTI) {
    1815         psListIterator *iter = psListIteratorAlloc(item->data.list, 0, false);
     1815        psListIterator *iter = psListIteratorAlloc(exp_id_list, 0, false);
    18161816        psMetadataItem *mItem = NULL;
    18171817        while ((mItem = psListGetAndIncrement(iter))) {
    18181818            psString exp_id = mItem->data.V;
    18191819            // if exp_id is NULL then it means that -exp_id has not been
    1820             // specified
     1820            // specified or something really bad happened
    18211821            if (!exp_id) {
    18221822                psError(PS_ERR_UNKNOWN, true,
    18231823                        "at least one -exp_id is required");
    1824                 psFree(where);
    1825                 return false;
    1826             }
    1827 
    1828             if (!psMetadataAddStr(where, PS_LIST_TAIL, "exp_id",
    1829                         PS_META_DUPLICATE_OK, "==", exp_id)) {
    1830                 psError(PS_ERR_UNKNOWN, false, "failed to add item exp_id");
    1831                 psFree(iter);
    1832                 psFree(where);
    18331824                return false;
    18341825            }
     
    18401831    }
    18411832
    1842     if (where->list->n < 1) {
    1843         psFree(where);
    1844         where = NULL;
    1845     }
    1846 
    18471833    // check that the specified exp_ids actually exist in the iteration zero
    18481834    // detInputExp set
    18491835
    18501836    // add the det_id & iteration == 0 to the where claus
     1837    psMetadata *where = psMetadataAlloc();
    18511838    if (!psMetadataAddS32(where, PS_LIST_TAIL, "det_id", 0, "==",
    18521839                (psS32)atol(det_id))) {
     
    18681855    }
    18691856
    1870     return true;
    1871 }
     1857    // build a hash for the valid exp_ids
     1858    psHash *valid_exp_ids = psHashAlloc(psArrayLength(detrendExps));
     1859    for (long i = 0; i < psArrayLength(detrendExps); i++) {
     1860        psHashAdd(valid_exp_ids,
     1861            ((detInputExpRow *)detrendExps->data[i])->exp_id,
     1862            ((detInputExpRow *)detrendExps->data[i])->exp_id
     1863        );
     1864    }
     1865
     1866    psListIterator *iter = psListIteratorAlloc(exp_id_list, 0, false);
     1867    psMetadataItem *mItem = NULL;
     1868    while ((mItem = psListGetAndIncrement(iter))) {
     1869        if (!psHashLookup(valid_exp_ids, (char *)mItem->data.V)) {
     1870            // invalid exp_id
     1871            psError(PS_ERR_UNKNOWN, false, "exp_id %s is invalid for det_id %s",
     1872                    (char *)mItem->data.V, det_id);
     1873            psFree(valid_exp_ids);
     1874            psFree(iter);
     1875            return false;
     1876        }
     1877    }
     1878    psFree(valid_exp_ids);
     1879    psFree(iter);
     1880
     1881    psFree(exp_id_list);
     1882
     1883    return true;
     1884}
Note: See TracChangeset for help on using the changeset viewer.