IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Feb 28, 2008, 3:06:02 PM (18 years ago)
Author:
jhoblitt
Message:

require ippdb 1.1.31
remove warpInputExp table
remove warptool -runone & -addinputexp modes
add -cam_id & -magiced options to warptool -definerun

File:
1 edited

Legend:

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

    r16253 r16733  
    3333
    3434static psS64 definerunMode(pxConfig *config);
    35 static bool runoneMode(pxConfig *config);
    3635static bool updaterunMode(pxConfig *config);
    37 static bool addinputexpMode(pxConfig *config);
    3836static bool expMode(pxConfig *config);
    3937static bool imfileMode(pxConfig *config);
     
    6967    switch (config->mode) {
    7068        MODECASE(WARPTOOL_MODE_DEFINERUN,         definerunMode);
    71         MODECASE(WARPTOOL_MODE_RUNONE,            runoneMode);
    7269        MODECASE(WARPTOOL_MODE_UPDATERUN,         updaterunMode);
    73         MODECASE(WARPTOOL_MODE_ADDINPUTEXP,       addinputexpMode);
    7470        MODECASE(WARPTOOL_MODE_EXP,               expMode);
    7571        MODECASE(WARPTOOL_MODE_IMFILE,            imfileMode);
     
    108104
    109105    // required options
     106    PXOPT_LOOKUP_STR(cam_id, config->args, "-cam_id", true, false);
    110107    PXOPT_LOOKUP_STR(mode, config->args, "-mode", true, false);
    111108    // check mode
     
    122119
    123120    // default
     121    PXOPT_LOOKUP_TIME(registered, config->args, "-registered", false, false);
     122    PXOPT_LOOKUP_BOOL(magiced, config->args, "-magiced", false);
    124123    PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false);
    125     PXOPT_LOOKUP_TIME(registered, config->args, "-registered", false, false);
    126124
    127125    warpRunRow *warpRun = warpRunRowAlloc(
    128126            0,          // ID
     127            (psS64)atoll(cam_id),
    129128            mode,
    130129            "reg",      // state
     
    134133            tess_id,
    135134            end_stage,
    136             registered
     135            registered,
     136            magiced
    137137    );
    138138    if (!warpRun) {
     
    161161}
    162162
    163 static bool runoneMode(pxConfig *config)
    164 {
    165     PS_ASSERT_PTR_NON_NULL(config, false);
    166 
    167     if (!psDBTransaction(config->dbh)) {
    168         psError(PS_ERR_UNKNOWN, false, "database error");
    169         return false;
    170     }
    171 
    172     psS64 warp_id = definerunMode(config);
    173     if (!warp_id) {
    174         // rollback
    175         if (!psDBRollback(config->dbh)) {
    176             psError(PS_ERR_UNKNOWN, false, "database error");
    177         }
    178         psError(PS_ERR_UNKNOWN, false, "failed to define warpRun");
    179         return false;
    180     }
    181 
    182     psString warp_id_str = psDBIntToString(warp_id);
    183     if (!psMetadataAddStr(config->args, PS_LIST_TAIL, "-warp_id", 0, NULL, warp_id_str)) {
    184         // rollback
    185         if (!psDBRollback(config->dbh)) {
    186             psError(PS_ERR_UNKNOWN, false, "database error");
    187         }
    188         psError(PS_ERR_UNKNOWN, false, "failed to add item warp_id");
    189         psFree(warp_id_str);
    190         return false;
    191     }
    192     psFree(warp_id_str);
    193 
    194     if (!addinputexpMode(config)) {
    195         // rollback
    196         if (!psDBRollback(config->dbh)) {
    197             psError(PS_ERR_UNKNOWN, false, "database error");
    198         }
    199         psError(PS_ERR_UNKNOWN, false, "failed to add cam_id to warpRun");
    200         return false;
    201     }
    202     if (!pxwarpRunSetState(config, warp_id, "run")) {
    203         // rollback
    204         if (!psDBRollback(config->dbh)) {
    205             psError(PS_ERR_UNKNOWN, false, "database error");
    206         }
    207         psError(PS_ERR_UNKNOWN, false, "failed to set warpRun.state to run");
    208         return false;
    209     }
    210 
    211     // point of no return
    212     if (!psDBCommit(config->dbh)) {
    213         psError(PS_ERR_UNKNOWN, false, "database error");
    214         return false;
    215     }
    216 
    217     return true;
    218 }
    219163
    220164static bool updaterunMode(pxConfig *config)
     
    228172        // set detRun.state to state
    229173        return pxwarpRunSetState(config, (psS64)atoll(warp_id), state);
    230     }
    231 
    232     return true;
    233 }
    234 
    235 
    236 static bool addinputexpMode(pxConfig *config)
    237 {
    238     PS_ASSERT_PTR_NON_NULL(config, false);
    239 
    240     PXOPT_LOOKUP_STR(warp_id, config->args, "-warp_id", true, false);
    241     PXOPT_LOOKUP_STR(cam_id, config->args, "-cam_id", true, false);
    242 
    243     // defaults to false
    244     PXOPT_LOOKUP_BOOL(magiced, config->args, "-magiced", false);
    245 
    246     if (!warpInputExpInsert(config->dbh,
    247             (psS64)atoll(warp_id),
    248             (psS64)atoll(cam_id),
    249             magiced
    250         )) {
    251         psError(PS_ERR_UNKNOWN, false, "database error");
    252         return false;
    253174    }
    254175
Note: See TracChangeset for help on using the changeset viewer.