IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 7367 for trunk/ippTools/src


Ignore:
Timestamp:
Jun 6, 2006, 11:44:24 AM (20 years ago)
Author:
jhoblitt
Message:

implement -addresidexpMode

Location:
trunk/ippTools/src
Files:
2 edited

Legend:

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

    r7363 r7367  
    15051505{
    15061506    PS_ASSERT_PTR_NON_NULL(config, false);
     1507 
     1508    // det_id, exp_id, stats, & recipe are required
     1509    bool status = false;
     1510    psString det_id = psMetadataLookupStr(&status, config->args, "-det_id");
     1511    if (!status) {
     1512        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -det_id");
     1513        return false;
     1514    }
     1515    if (!det_id) {
     1516        psError(PS_ERR_UNKNOWN, true, "-det_id is required");
     1517        return false;
     1518    }
     1519    psString exp_id = psMetadataLookupStr(&status, config->args, "-exp_id");
     1520    if (!status) {
     1521        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -exp_id");
     1522        return false;
     1523    }
     1524    if (!exp_id) {
     1525        psError(PS_ERR_UNKNOWN, true, "-exp_id is required");
     1526        return false;
     1527    }
     1528    psString stats = psMetadataLookupStr(&status, config->args, "-stats");
     1529    if (!status) {
     1530        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -stats");
     1531        return false;
     1532    }
     1533    if (!stats) {
     1534        psError(PS_ERR_UNKNOWN, true, "-stats is required");
     1535        return false;
     1536    }
     1537    psString recipe = psMetadataLookupStr(&status, config->args, "-recipe");
     1538    if (!status) {
     1539        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -recipe");
     1540        return false;
     1541    }
     1542    if (!recipe) {
     1543        psError(PS_ERR_UNKNOWN, true, "-recipe is required");
     1544        return false;
     1545    }
     1546    // accept is optional
     1547    bool accept = psMetadataLookupBool(&status, config->args, "-accept");
     1548    if (!status) {
     1549        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -recipe");
     1550        return false;
     1551    }
     1552
     1553    // check det_id, exp_id against detInputExp
     1554   
     1555    // we have to generate our own where claus as we want to exclude -stats
     1556    // from the search
     1557    psMetadata *where = psMetadataAlloc();
     1558    if (!psMetadataAddS32(where, PS_LIST_TAIL, "det_id", 0, "==",
     1559            (psS32)atoi(det_id))) {
     1560        psError(PS_ERR_UNKNOWN, false, "failed to add item det_id");
     1561        psFree(where);
     1562        return false;
     1563    }
     1564    if (!psMetadataAddStr(where, PS_LIST_TAIL, "exp_id", 0, "==", exp_id)) {
     1565        psError(PS_ERR_UNKNOWN, false, "failed to add item exp_id");
     1566        psFree(where);
     1567        return false;
     1568    }
     1569
     1570    psArray *inputExp = detInputExpSelectRowObjects(config->dbh, where, 0);
     1571    psFree(where);
     1572    if (!inputExp) {
     1573        psError(PS_ERR_UNKNOWN, true,
     1574    "det_id %s, exp_id %s does not corespond to an input exp", det_id, exp_id);
     1575        return false;
     1576    }
     1577
     1578    // if we've made it this far then we must have found a match
     1579    psFree(inputExp);
     1580
     1581    // create a new detResidExpAnalysis row and insert it
     1582    detResidExpAnalysisRow *residExp = detResidExpAnalysisRowAlloc(
     1583                (psS32)atol(det_id),
     1584                exp_id,
     1585                stats,
     1586                recipe,
     1587                accept
     1588            );
     1589
     1590    if (!detResidExpAnalysisInsertObject(config->dbh, residExp)) {
     1591        psError(PS_ERR_UNKNOWN, false, "database error");
     1592        psFree(residExp);
     1593        return false;
     1594    }
     1595
     1596    psFree(residExp);
     1597
    15071598    return true;
    15081599}
  • trunk/ippTools/src/dettoolConfig.c

    r7363 r7367  
    203203    psMetadataAddStr(addresidexpArgs, PS_LIST_TAIL, "-exp_id",  0,
    204204        "define detrend ID (required)", NULL);
    205     psMetadataAddStr(addresidexpArgs, PS_LIST_TAIL, "-class_id",  0,
    206         "define class ID (required)", NULL);
    207205    psMetadataAddStr(addresidexpArgs, PS_LIST_TAIL, "-stats",  0,
    208206        "define stats (required)", NULL);
Note: See TracChangeset for help on using the changeset viewer.