IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 10115


Ignore:
Timestamp:
Nov 20, 2006, 2:03:03 PM (19 years ago)
Author:
jhoblitt
Message:

-newExp no longer takes an exp_tag argument and now returns the assigned exp_tag

Location:
trunk/ippTools/src
Files:
2 edited

Legend:

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

    r10047 r10115  
    2626
    2727#include "pxtools.h"
     28#include "pxtag.h"
    2829#include "pxinject.h"
    2930
     
    6970static bool newExpMode(pxConfig *config)
    7071{
     72    PS_ASSERT_PTR_NON_NULL(config, false);
     73
    7174    bool status = false;
    72 
    73     psString exp_tag = psMetadataLookupStr(&status, config->args, "-exp_tag");
    74     if (!status) {
    75         psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -exp_tag");
    76         return false;
    77     }
    78     if (!exp_tag) {
    79         psError(PS_ERR_UNKNOWN, true, "-exp_tag is required");
    80         return false;
    81     }
    8275    psString exp_id = psMetadataLookupStr(&status, config->args, "-exp_id");
    8376    if (!status) {
     
    136129    }
    137130
     131    psString exp_tag = pxGenExpTag(config, exp_id);
     132    if (!exp_tag) {
     133        psError(PS_ERR_UNKNOWN, false, "database error");
     134        return false;
     135    }
    138136
    139137    if (!newExpInsert(config->dbh,
    140                 (psU64)atoll(exp_tag),
     138                exp_tag,
    141139                exp_id,
    142140                camera,
     
    148146        ) {
    149147        psError(PS_ERR_UNKNOWN, false, "database error");
    150         return false;
    151     }
     148        psFree(exp_tag);
     149        return false;
     150    }
     151
     152    psMetadata *md = psMetadataAlloc();
     153    if (!psMetadataAddStr(md, PS_LIST_TAIL, "exp_tag", 0, NULL, exp_tag)) {
     154        psError(PS_ERR_UNKNOWN, false, "failed to add item exp_tag");
     155        psFree(md);
     156        psFree(exp_tag);
     157        psFree(md);
     158    }
     159    psFree(exp_tag);
     160
     161    bool simple = false;
     162    {
     163        bool status = false;
     164        simple = psMetadataLookupBool(&status, config->args, "-simple");
     165        if (!status) {
     166            psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -simple");
     167            psFree(md);
     168            return false;
     169        }
     170    }
     171
     172    // negate simple so the default is true
     173    if (!ippdbPrintMetadata(stdout, md, !simple)) {
     174        psError(PS_ERR_UNKNOWN, false, "failed to print array");
     175        psFree(md);
     176        return false;
     177    }
     178
     179    psFree(md);
    152180
    153181    return true;
     
    156184static bool newImfileMode(pxConfig *config)
    157185{
     186    PS_ASSERT_PTR_NON_NULL(config, false);
     187
    158188    bool status = false;
    159 
    160189    psString exp_tag = psMetadataLookupStr(&status, config->args, "-exp_tag");
    161190    if (!status) {
  • trunk/ippTools/src/pxinjectConfig.c

    r10039 r10115  
    4242    // -newExp
    4343    psMetadata *newExpArgs = psMetadataAlloc();
    44     psMetadataAddStr(newExpArgs, PS_LIST_TAIL, "-exp_tag",  0,
    45         "define the exp_tag (required)", NULL);
    4644    psMetadataAddStr(newExpArgs, PS_LIST_TAIL, "-exp_id",  0,
    4745        "define the exp_id (required)", NULL);
     
    5654    psMetadataAddS32(newExpArgs, PS_LIST_TAIL, "-imfiles",  0,
    5755        "define the number of imfiles in this exp (required)", 0);
     56    psMetadataAddBool(newExpArgs, PS_LIST_TAIL, "-simple",  0,
     57        "use the simple output format", false);
    5858
    5959    // -newImfile
Note: See TracChangeset for help on using the changeset viewer.