Changeset 16170 for trunk/ippTools/src/pztool.c
- Timestamp:
- Jan 20, 2008, 3:48:37 PM (18 years ago)
- File:
-
- 1 edited
-
trunk/ippTools/src/pztool.c (modified) (14 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippTools/src/pztool.c
r15293 r16170 92 92 PS_ASSERT_PTR_NON_NULL(config, false); 93 93 94 bool status = false; 95 psString camera = psMetadataLookupStr(&status, config->args, "-inst"); 96 if (!status) { 97 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -inst"); 98 return false; 99 } 100 if (!camera) { 101 psError(PS_ERR_UNKNOWN, true, "-inst is required"); 102 return false; 103 } 104 105 psString telescope = psMetadataLookupStr(&status, config->args, "-telescope"); 106 if (!status) { 107 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -telescope"); 108 return false; 109 } 110 if (!telescope) { 111 psError(PS_ERR_UNKNOWN, true, "-telescope is required"); 112 return false; 113 } 114 115 psString uri = psMetadataLookupStr(&status, config->args, "-uri"); 116 if (!status) { 117 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -uri"); 118 return false; 119 } 120 if (!uri) { 121 psError(PS_ERR_UNKNOWN, true, "-uri is required"); 122 return false; 123 } 94 // required 95 PXOPT_LOOKUP_STR(camera, config->args, "-inst", true, false); 96 PXOPT_LOOKUP_STR(telescope, config->args, "-telescope", true, false); 97 PXOPT_LOOKUP_STR(uri, config->args, "-uri", true, false); 124 98 125 99 if (!pzDataStoreInsert(config->dbh, … … 139 113 PS_ASSERT_PTR_NON_NULL(config, false); 140 114 115 PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false); 116 141 117 if (!p_psDBRunQuery(config->dbh, "SELECT * FROM pzDataStore")) { 142 118 psError(PS_ERR_UNKNOWN, false, "database error"); … … 153 129 psFree(output); 154 130 return true; 155 }156 157 bool simple = false;158 {159 bool status = false;160 simple = psMetadataLookupBool(&status, config->args, "-simple");161 if (!status) {162 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -simple");163 return false;164 }165 131 } 166 132 … … 180 146 { 181 147 PS_ASSERT_PTR_NON_NULL(config, false); 148 149 PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false); 182 150 183 151 psString query = psStringCopy("SELECT * FROM summitExp"); … … 207 175 } 208 176 209 bool simple = false;210 {211 bool status = false;212 simple = psMetadataLookupBool(&status, config->args, "-simple");213 if (!status) {214 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -simple");215 return false;216 }217 }218 219 177 // negative simple so the default is true 220 178 if (!ippdbPrintMetadatas(stdout, output, "summitExp", !simple)) { … … 233 191 PS_ASSERT_PTR_NON_NULL(config, false); 234 192 235 bool status = false; 236 psU64 limit = psMetadataLookupU64(&status, config->args, "-limit"); 237 if (!status) { 238 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -limit"); 239 return false; 240 } 193 PXOPT_LOOKUP_U64(limit, config->args, "-limit", false, false); 194 PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false); 241 195 242 196 psString query = psStringCopy( … … 279 233 } 280 234 281 bool simple = false;282 {283 bool status = false;284 simple = psMetadataLookupBool(&status, config->args, "-simple");285 if (!status) {286 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -simple");287 psFree(output);288 return false;289 }290 }291 292 235 // negative simple so the default is true 293 236 if (!ippdbPrintMetadatas(stdout, output, "pzPendingExp", !simple)) { … … 306 249 PS_ASSERT_PTR_NON_NULL(config, false); 307 250 308 bool status = false; 309 psU64 limit = psMetadataLookupU64(&status, config->args, "-limit"); 310 if (!status) { 311 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -limit"); 312 return false; 313 } 251 PXOPT_LOOKUP_U64(limit, config->args, "-limit", false, false); 252 PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false); 314 253 315 254 psArray *cameras = pzGetPendingCameras(config); … … 330 269 } 331 270 271 bool status; 332 272 psString camera = psMetadataLookupStr(&status, cameras->data[i], "camera"); 333 273 psStringAppend(&query, " WHERE camera = \"%s\"", camera); … … 380 320 psFree(cameraImfiles); 381 321 382 bool simple = false;383 {384 bool status = false;385 simple = psMetadataLookupBool(&status, config->args, "-simple");386 if (!status) {387 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -simple");388 psFree(output);389 return false;390 }391 }392 393 322 // negative simple so the default is true 394 323 if (!ippdbPrintMetadatas(stdout, output, "pzPendingImfile", !simple)) { … … 407 336 PS_ASSERT_PTR_NON_NULL(config, false); 408 337 409 bool status = false; 410 psString exp_name = psMetadataLookupStr(&status, config->args, "-exp_name"); 411 if (!status) { 412 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -exp_name"); 413 return false; 414 } 415 if (!exp_name) { 416 psError(PS_ERR_UNKNOWN, true, "-exp_name is required"); 417 return false; 418 } 419 420 psString camera = psMetadataLookupStr(&status, config->args, "-inst"); 421 if (!status) { 422 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -inst"); 423 return NULL; 424 } 425 if (!camera) { 426 psError(PS_ERR_UNKNOWN, true, "-inst is required"); 427 return NULL; 428 } 429 430 psString telescope = psMetadataLookupStr(&status, config->args, "-telescope"); 431 if (!status) { 432 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -telescope"); 433 return NULL; 434 } 435 if (!telescope) { 436 psError(PS_ERR_UNKNOWN, true, "-telescope is required"); 437 return NULL; 438 } 439 440 psString class = psMetadataLookupStr(&status, config->args, "-class"); 441 if (!status) { 442 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -class"); 443 return NULL; 444 } 445 if (!class) { 446 psError(PS_ERR_UNKNOWN, true, "-class is required"); 447 return NULL; 448 } 449 450 psString class_id = psMetadataLookupStr(&status, config->args, "-class_id"); 451 if (!status) { 452 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -class_id"); 453 return NULL; 454 } 455 if (!class_id) { 456 psError(PS_ERR_UNKNOWN, true, "-class_id is required"); 457 return NULL; 458 } 459 460 psString uri = psMetadataLookupStr(&status, config->args, "-uri"); 461 if (!status) { 462 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -uri"); 463 return false; 464 } 465 if (!uri) { 466 psError(PS_ERR_UNKNOWN, true, "-uri is required"); 467 return false; 468 } 338 // required 339 PXOPT_LOOKUP_STR(exp_name, config->args, "-exp_name", true, false); 340 PXOPT_LOOKUP_STR(camera, config->args, "-inst", true, false); 341 PXOPT_LOOKUP_STR(telescope, config->args, "-telescope", true, false); 342 PXOPT_LOOKUP_STR(class, config->args, "-class", true, false); 343 PXOPT_LOOKUP_STR(class_id, config->args, "-class_id", true, false); 344 PXOPT_LOOKUP_STR(uri, config->args, "-uri", true, false); 469 345 470 346 // need to know exp_name, camera, telescope, class, class_id (to find the … … 476 352 return false; 477 353 } 478 479 354 480 355 // cp the imfile into pzDoneImfile … … 568 443 PS_ASSERT_PTR_NON_NULL(config, false); 569 444 445 // XXX this is an ugly hack! 446 // we are passing exp level info to a imfile level mode (-copydone) 447 // these options are thrown away unless we just -copydone'd the last imfile 448 // in an exp. 449 // This function MUST NOT be invoked from anywhere but copydoneMode(). 450 451 // optional 452 PXOPT_LOOKUP_STR(workdir, config->args, "-workdir", false, false); 453 PXOPT_LOOKUP_STR(dvodb, config->args, "-dvodb", false, false); 454 PXOPT_LOOKUP_STR(tess_id, config->args, "-tess_id", false, false); 455 PXOPT_LOOKUP_STR(end_stage, config->args, "-end_stage", false, false); 456 570 457 // find all exposures that have had all of their imfiles downloaded but do 571 458 // not appear in newExp … … 613 500 doneExp->telescope, // tmp_telescope 614 501 "run", // state 615 NULL,// workdir502 workdir, // workdir 616 503 "dirty", // workdir state 617 NULL // reduction class 504 NULL, // reduction class 505 dvodb, // dvodb 506 tess_id, // tess_id 507 end_stage // end_stage 618 508 ) 619 509 ) {
Note:
See TracChangeset
for help on using the changeset viewer.
