IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jun 26, 2008, 3:39:54 PM (18 years ago)
Author:
jhoblitt
Message:

consitently handle *_id fields as numeric values instead of converting back of forth between ints and strings

File:
1 edited

Legend:

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

    r18093 r18336  
    9797    PS_ASSERT_PTR_NON_NULL(config, NULL);
    9898
    99     PXOPT_LOOKUP_STR(chip_id, config->args, "-chip_id", false, false);
    100     PXOPT_LOOKUP_STR(exp_id, config->args, "-exp_id", false, false);
    101 
    10299    psMetadata *where = psMetadataAlloc();
    103     // convert chip_id into a psS64
    104     if (chip_id) {
    105         if (!psMetadataAddS64(where, PS_LIST_TAIL, "chip_id", 0, "==", (psS64)atoll(chip_id))) {
    106             psError(PS_ERR_UNKNOWN, false, "failed to add item chip_id");
    107             psFree(where);
    108             return false;
    109         }
    110     }
    111 
    112     // convert exp_id into a psS64
    113     if (exp_id) {
    114         if (!psMetadataAddS64(where, PS_LIST_TAIL, "exp_id", 0, "==", (psS64)atoll(exp_id))) {
    115             psError(PS_ERR_UNKNOWN, false, "failed to add item exp_id");
    116             psFree(where);
    117             return false;
    118         }
    119     }
    120 
     100    PXOPT_COPY_S64(config->args, where, "-chip_id", "chip_id", "==");
     101    PXOPT_COPY_S64(config->args, where, "-exp_id", "exp_id", "==");
    121102    PXOPT_COPY_STR(config->args, where, "-exp_name", "exp_name", "==");
    122103    PXOPT_COPY_STR(config->args, where, "-inst", "camera", "==");
     
    268249    PS_ASSERT_PTR_NON_NULL(config, false);
    269250
    270     PXOPT_LOOKUP_STR(cam_id, config->args, "-cam_id", false, false);
    271     PXOPT_LOOKUP_STR(chip_id, config->args, "-chip_id", false, false);
    272     PXOPT_LOOKUP_STR(exp_id, config->args, "-exp_id", false, false);
    273 
    274251    psMetadata *where = psMetadataAlloc();
    275     // convert cam_id into a psS64
    276     if (cam_id) {
    277         if (!psMetadataAddS64(where, PS_LIST_TAIL, "cam_id", 0, "==", (psS64)atoll(cam_id))) {
    278             psError(PS_ERR_UNKNOWN, false, "failed to add item cam_id");
    279             psFree(where);
    280             return false;
    281         }
    282     }
    283 
    284     // convert chip_id into a psS64
    285     if (chip_id) {
    286         if (!psMetadataAddS64(where, PS_LIST_TAIL, "chip_id", 0, "==", (psS64)atoll(chip_id))) {
    287             psError(PS_ERR_UNKNOWN, false, "failed to add item chip_id");
    288             psFree(where);
    289             return false;
    290         }
    291     }
    292 
    293     // convert exp_id into a psS64
    294     if (exp_id) {
    295         if (!psMetadataAddS64(where, PS_LIST_TAIL, "exp_id", 0, "==", (psS64)atoll(exp_id))) {
    296             psError(PS_ERR_UNKNOWN, false, "failed to add item exp_id");
    297             psFree(where);
    298             return false;
    299         }
    300     }
    301 
     252    PXOPT_COPY_S64(config->args, where, "-cam_id", "cam_id", "==");
     253    PXOPT_COPY_S64(config->args, where, "-chip_id", "chip_id", "==");
     254    PXOPT_COPY_S64(config->args, where, "-exp_id", "exp_id", "==");
    302255    PXOPT_COPY_STR(config->args, where, "-exp_name", "exp_name", "==");
    303256    PXOPT_COPY_STR(config->args, where, "-inst", "camera", "==");
     
    421374    }
    422375
    423     if (!convertIdToStr(output)) {
    424         psError(PS_ERR_UNKNOWN, false, "failed to convert id fields into a strings");
    425         psFree(output);
    426         return false;
    427     }
    428 
    429376    // negate simple so the default is true
    430377    if (!ippdbPrintMetadatas(stdout, output, "camPendingExp", !simple)) {
     
    475422    }
    476423
    477     if (!convertIdToStr(output)) {
    478         psError(PS_ERR_UNKNOWN, false, "failed to convert id fields into a strings");
    479         psFree(output);
    480         return false;
    481     }
    482 
    483424    // negate simple so the default is true
    484425    if (!ippdbPrintMetadatas(stdout, output, "chipProcessedImfile", !simple)) {
     
    498439
    499440    // required
    500     PXOPT_LOOKUP_STR(cam_id, config->args, "-cam_id", true, false);
     441    PXOPT_LOOKUP_S64(cam_id, config->args, "-cam_id", true, false);
    501442    PXOPT_LOOKUP_STR(uri, config->args, "-uri", true, false);
    502443
     
    554495        psMetadata *where = psMetadataAlloc();
    555496        if (cam_id) {
    556             if (!psMetadataAddS64(where, PS_LIST_TAIL, "cam_id", 0, "==", (psS64)atoll(cam_id))) {
     497            if (!psMetadataAddS64(where, PS_LIST_TAIL, "cam_id", 0, "==", cam_id)) {
    557498                psError(PS_ERR_UNKNOWN, false, "failed to add item cam_id");
    558499                psFree(where);
     
    746687    }
    747688
    748     if (!convertIdToStr(output)) {
    749         psError(PS_ERR_UNKNOWN, false, "failed to convert id fields into a strings");
    750         psFree(output);
    751         return false;
    752     }
    753 
    754689    // negate simple so the default is true
    755690    if (!ippdbPrintMetadatas(stdout, output, "camProcessedExp", !simple)) {
     
    769704    PS_ASSERT_PTR_NON_NULL(config, false);
    770705
    771     PXOPT_LOOKUP_STR(cam_id, config->args, "-cam_id", false, false);
    772     PXOPT_LOOKUP_STR(chip_id, config->args, "-chip_id", false, false);
    773     PXOPT_LOOKUP_STR(exp_id, config->args, "-exp_id", false, false);
    774 
    775706    psMetadata *where = psMetadataAlloc();
    776     // convert cam_id into a psS64
    777     if (cam_id) {
    778         if (!psMetadataAddS64(where, PS_LIST_TAIL, "cam_id", 0, "==", (psS64)atoll(cam_id))) {
    779             psError(PS_ERR_UNKNOWN, false, "failed to add item cam_id");
    780             psFree(where);
    781             return false;
    782         }
    783     }
    784 
    785     // convert chip_id into a psS64
    786     if (chip_id) {
    787         if (!psMetadataAddS64(where, PS_LIST_TAIL, "chip_id", 0, "==", (psS64)atoll(chip_id))) {
    788             psError(PS_ERR_UNKNOWN, false, "failed to add item chip_id");
    789             psFree(where);
    790             return false;
    791         }
    792     }
    793 
    794     // convert exp_id into a psS64
    795     if (exp_id) {
    796         if (!psMetadataAddS64(where, PS_LIST_TAIL, "exp_id", 0, "==", (psS64)atoll(exp_id))) {
    797             psError(PS_ERR_UNKNOWN, false, "failed to add item exp_id");
    798             psFree(where);
    799             return false;
    800         }
    801     }
    802 
     707    PXOPT_COPY_S64(config->args, where, "-cam_id", "cam_id", "==");
     708    PXOPT_COPY_S64(config->args, where, "-chip_id", "chip_id", "==");
     709    PXOPT_COPY_S64(config->args, where, "-exp_id", "exp_id", "==");
    803710    PXOPT_COPY_STR(config->args, where, "-exp_name", "exp_name", "==");
    804711    PXOPT_COPY_STR(config->args, where, "-inst", "camera", "==");
     
    977884    }
    978885
    979     if (!convertIdToStr(output)) {
    980         psError(PS_ERR_UNKNOWN, false, "failed to convert id fields into a strings");
    981         psFree(output);
    982         return false;
    983     }
    984 
    985886    // negative simple so the default is true
    986887    if (!ippdbPrintMetadatas(stdout, output, "camMask", !simple)) {
Note: See TracChangeset for help on using the changeset viewer.