Changeset 16096
- Timestamp:
- Jan 16, 2008, 10:56:55 AM (18 years ago)
- File:
-
- 1 edited
-
branches/end_stage/ippTools/src/warptool.c (modified) (19 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/end_stage/ippTools/src/warptool.c
r16049 r16096 108 108 109 109 // required options 110 bool status = false; 111 psString mode = psMetadataLookupStr(&status, config->args, "-mode"); 112 if (!status) { 113 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -survey_mode"); 114 return false; 115 } 116 if (!mode) { 117 psError(PS_ERR_UNKNOWN, true, "-mode is required"); 118 return false; 119 } 110 PXOPT_LOOKUP_STR(mode, config->args, "-mode", true, false); 120 111 // check mode 121 112 if (mode && !isValidMode(config, mode)) { … … 123 114 return false; 124 115 } 125 126 psString workdir = psMetadataLookupStr(&status, config->args, "-workdir"); 127 if (!status) { 128 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -workdir"); 129 return false; 130 } 131 if (!workdir) { 132 psError(PS_ERR_UNKNOWN, true, "-workdir is required"); 133 return false; 134 } 135 136 psString dvodb = psMetadataLookupStr(&status, config->args, "-dvodb"); 137 if (!status) { 138 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -dvodb"); 139 return false; 140 } 141 142 psString tess_id = psMetadataLookupStr(&status, config->args, "-tess_id"); 143 if (!status) { 144 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -tess_id"); 145 return false; 146 } 147 148 psString end_stage = psMetadataLookupStr(&status, config->args, "-end_stage"); 149 if (!status) { 150 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -end_stage"); 151 return false; 152 } 116 PXOPT_LOOKUP_STR(workdir, config->args, "-workdir", true, false); 117 118 // optional 119 PXOPT_LOOKUP_STR(dvodb, config->args, "-dvodb", false, false); 120 PXOPT_LOOKUP_STR(tess_id, config->args, "-tess_id", false, false); 121 PXOPT_LOOKUP_STR(end_stage, config->args, "-end_stage", false, false); 122 PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false); 153 123 154 124 psTime *registered = NULL; 155 125 { 126 bool status; 156 127 psString registeredStr = psMetadataLookupStr(&status, config->args, "-registered"); 157 128 if (!status) { … … 193 164 warpRun->warp_id = warp_id; 194 165 195 bool simple = false;196 {197 bool status = false;198 simple = psMetadataLookupBool(&status, config->args, "-simple");199 if (!status) {200 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -simple");201 psFree(warpRun);202 return false;203 }204 }205 206 166 if (!warpRunPrintObject(stdout, warpRun, !simple)) { 207 167 psError(PS_ERR_UNKNOWN, false, "failed to print object"); … … 276 236 PS_ASSERT_PTR_NON_NULL(config, false); 277 237 278 bool status = false; 279 psString warp_id = psMetadataLookupStr(&status, config->args, "-warp_id"); 280 if (!status) { 281 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -warpt_id"); 282 return false; 283 } 284 if (!warp_id) { 285 psError(PS_ERR_UNKNOWN, true, "-warp_id is required"); 286 return false; 287 } 288 289 psString state = psMetadataLookupStr(&status, config->args, "-state"); 290 if (!status) { 291 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -state"); 292 return false; 293 } 294 if (!state) { 295 psError(PS_ERR_UNKNOWN, true, "-state is required"); 296 return false; 297 } 238 PXOPT_LOOKUP_STR(warp_id, config->args, "-warp_id", true, false); 239 PXOPT_LOOKUP_STR(state, config->args, "-state", true, false); 298 240 299 241 if (state) { … … 310 252 PS_ASSERT_PTR_NON_NULL(config, false); 311 253 312 bool status = false; 313 psString warp_id = psMetadataLookupStr(&status, config->args, "-warp_id"); 314 if (!status) { 315 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -warp_id"); 316 return false; 317 } 318 if (!warp_id) { 319 psError(PS_ERR_UNKNOWN, true, "-warp_id is required"); 320 return false; 321 } 322 323 psString cam_id = psMetadataLookupStr(&status, config->args, "-cam_id"); 324 if (!status) { 325 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -cam_id"); 326 return false; 327 } 328 if (!cam_id) { 329 psError(PS_ERR_UNKNOWN, true, "-cam_id is required"); 330 return false; 331 } 254 PXOPT_LOOKUP_STR(warp_id, config->args, "-warp_id", true, false); 255 PXOPT_LOOKUP_STR(cam_id, config->args, "-cam_id", true, false); 332 256 333 257 // defaults to false 334 bool magiced = psMetadataLookupBool(&status, config->args, "-magiced"); 335 if (!status) { 336 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -magiced"); 337 return false; 338 } 339 340 // XXX need to validate the warp_id here 341 // XXX instead of validiting it here we should just use forgein key 342 // constrants 258 PXOPT_LOOKUP_BOOL(magiced, config->args, "-magiced", false); 259 343 260 if (!warpInputExpInsert(config->dbh, 344 261 (psS64)atoll(warp_id), … … 358 275 PS_ASSERT_PTR_NON_NULL(config, false); 359 276 360 bool status = false; 361 psU64 limit = psMetadataLookupU64(&status, config->args, "-limit"); 362 if (!status) { 363 psError(PXTOOLS_ERR_PROG, false, "failed to lookup value for -limit"); 364 return false; 365 } 277 PXOPT_LOOKUP_U64(limit, config->args, "-limit", false, false); 278 PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false); 366 279 367 280 // find all rawImfiles matching the default query … … 412 325 } 413 326 414 bool simple = false;415 {416 bool status = false;417 simple = psMetadataLookupBool(&status, config->args, "-simple");418 if (!status) {419 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -simple");420 return false;421 }422 }423 424 327 if (psArrayLength(output)) { 425 328 if (!convertIdToStr(output)) { … … 447 350 PS_ASSERT_PTR_NON_NULL(config, false); 448 351 449 bool status = false; 450 psU64 limit = psMetadataLookupU64(&status, config->args, "-limit"); 451 if (!status) { 452 psError(PXTOOLS_ERR_PROG, false, "failed to lookup value for -limit"); 453 return false; 454 } 352 PXOPT_LOOKUP_U64(limit, config->args, "-limit", false, false); 353 PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false); 455 354 456 355 // find all rawImfiles matching the default query … … 501 400 } 502 401 503 bool simple = false;504 {505 bool status = false;506 simple = psMetadataLookupBool(&status, config->args, "-simple");507 if (!status) {508 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -simple");509 return false;510 }511 }512 513 402 if (psArrayLength(output)) { 514 403 if (!convertIdToStr(output)) { … … 536 425 PS_ASSERT_PTR_NON_NULL(config, false); 537 426 538 bool status = false; 539 psU64 limit = psMetadataLookupU64(&status, config->args, "-limit"); 540 if (!status) { 541 psError(PXTOOLS_ERR_PROG, false, "failed to lookup value for -limit"); 542 return false; 543 } 427 PXOPT_LOOKUP_U64(limit, config->args, "-limit", false, false); 428 PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false); 544 429 545 430 // find all rawImfiles matching the default query … … 590 475 } 591 476 592 bool simple = false;593 {594 bool status = false;595 simple = psMetadataLookupBool(&status, config->args, "-simple");596 if (!status) {597 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -simple");598 return false;599 }600 }601 602 477 if (psArrayLength(output)) { 603 478 if (!convertIdToStr(output)) { … … 620 495 } 621 496 622 497 623 498 static bool addoverlapMode(pxConfig *config) 624 499 { 625 500 PS_ASSERT_PTR_NON_NULL(config, false); 626 501 627 bool status = false; 628 psString mapfile = psMetadataLookupStr(&status, config->args, "-mapfile"); 629 if (!status) { 630 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -mapfile"); 631 return false; 632 } 633 if (!mapfile) { 634 psError(PS_ERR_UNKNOWN, true, "-mapfile is required"); 635 return false; 636 } 502 PXOPT_LOOKUP_STR(mapfile, config->args, "-mapfile", false, false); 637 503 638 504 if (!psDBTransaction(config->dbh)) { … … 724 590 PS_ASSERT_PTR_NON_NULL(config, false); 725 591 726 bool status = false; 727 psU64 limit = psMetadataLookupU64(&status, config->args, "-limit"); 728 if (!status) { 729 psError(PXTOOLS_ERR_PROG, false, "failed to lookup value for -limit"); 730 return false; 731 } 592 PXOPT_LOOKUP_U64(limit, config->args, "-limit", false, false); 593 PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false); 732 594 733 595 // find all rawImfiles matching the default query … … 778 640 } 779 641 780 bool simple = false;781 {782 bool status = false;783 simple = psMetadataLookupBool(&status, config->args, "-simple");784 if (!status) {785 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -simple");786 return false;787 }788 }789 790 642 if (psArrayLength(output)) { 791 643 if (!convertIdToStr(output)) { … … 813 665 PS_ASSERT_PTR_NON_NULL(config, false); 814 666 815 bool status = false; 816 psU64 limit = psMetadataLookupU64(&status, config->args, "-limit"); 817 if (!status) { 818 psError(PXTOOLS_ERR_PROG, false, "failed to lookup value for -limit"); 819 return false; 820 } 667 PXOPT_LOOKUP_U64(limit, config->args, "-limit", false, false); 668 PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false); 821 669 822 670 // find all rawImfiles matching the default query … … 867 715 } 868 716 869 bool simple = false;870 {871 bool status = false;872 simple = psMetadataLookupBool(&status, config->args, "-simple");873 if (!status) {874 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -simple");875 return false;876 }877 }878 879 717 if (psArrayLength(output)) { 880 718 if (!convertIdToStr(output)) { … … 902 740 PS_ASSERT_PTR_NON_NULL(config, false); 903 741 904 bool status = false; 905 psString warp_id = psMetadataLookupStr(&status, config->args, "-warp_id"); 906 if (!status) { 907 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -warp_id"); 908 return false; 909 } 910 if (!warp_id) { 911 psError(PS_ERR_UNKNOWN, true, "-warp_id is required"); 912 return false; 913 } 914 915 psString skycell_id = psMetadataLookupStr(&status, config->args, "-skycell_id"); 916 if (!status) { 917 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -skycell_id"); 918 return false; 919 } 920 if (!skycell_id) { 921 psError(PS_ERR_UNKNOWN, true, "-skycell_id is required"); 922 return false; 923 } 924 925 psString tess_id = psMetadataLookupStr(&status, config->args, "-tess_id"); 926 if (!status) { 927 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -tess_id"); 928 return false; 929 } 930 if (!tess_id) { 931 psError(PS_ERR_UNKNOWN, true, "-tess_id is required"); 932 return false; 933 } 934 935 psString uri = psMetadataLookupStr(&status, config->args, "-uri"); 936 if (!status) { 937 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -uri"); 938 return false; 939 } 940 941 psString path_base = psMetadataLookupStr(&status, config->args, "-path_base"); 942 if (!status) { 943 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -path_base"); 944 return false; 945 } 742 PXOPT_LOOKUP_STR(warp_id, config->args, "-warp_id", true, false); 743 PXOPT_LOOKUP_STR(skycell_id, config->args, "-skycell_id", true, false); 744 PXOPT_LOOKUP_STR(tess_id, config->args, "-tess_id", true, false); 946 745 947 746 // optional 948 psF64 bg = psMetadataLookupF64(&status, config->args, "-bg"); 949 if (!status) { 950 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -bg"); 951 return false; 952 } 953 954 psF64 bg_stdev = psMetadataLookupF64(&status, config->args, "-bg_stdev"); 955 if (!status) { 956 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -bg_stdev"); 957 return false; 958 } 959 960 psF64 good_frac = psMetadataLookupF64(&status, config->args, "-good_frac"); 961 if (!status) { 962 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -good_frac"); 963 return false; 964 } 965 966 bool ignore = psMetadataLookupBool(&status, config->args, "-ignore"); 967 if (!status) { 968 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -ignore"); 969 return false; 970 } 747 PXOPT_LOOKUP_STR(uri, config->args, "-uri", false, false); 748 PXOPT_LOOKUP_STR(path_base, config->args, "-path_base", false, false); 749 PXOPT_LOOKUP_F64(bg, config->args, "-bg", false, false); 750 PXOPT_LOOKUP_F64(bg_stdev, config->args, "-bg_stdev", false, false); 751 PXOPT_LOOKUP_F64(good_frac, config->args, "-good_frac", false, false); 752 PXOPT_LOOKUP_BOOL(ignore, config->args, "-ignore", false); 971 753 972 754 // default values 973 psS16 code = psMetadataLookupS16(&status, config->args, "-code"); 974 if (!status) { 975 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -code"); 976 return false; 977 } 755 PXOPT_LOOKUP_S16(code, config->args, "-code", false, false); 978 756 979 757 // we don't want to insert the last skyfile in a run but then not mark the … … 1132 910 PS_ASSERT_PTR_NON_NULL(config, false); 1133 911 1134 bool status = false; 1135 psU64 limit = psMetadataLookupU64(&status, config->args, "-limit"); 1136 if (!status) { 1137 psError(PXTOOLS_ERR_PROG, false, "failed to lookup value for -limit"); 1138 return false; 1139 } 912 PXOPT_LOOKUP_U64(limit, config->args, "-limit", false, false); 913 PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false); 1140 914 1141 915 // find all rawImfiles matching the default query … … 1186 960 } 1187 961 1188 bool simple = false;1189 {1190 bool status = false;1191 simple = psMetadataLookupBool(&status, config->args, "-simple");1192 if (!status) {1193 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -simple");1194 return false;1195 }1196 }1197 1198 962 if (psArrayLength(output)) { 1199 963 if (!convertIdToStr(output)) {
Note:
See TracChangeset
for help on using the changeset viewer.
