Changeset 16170 for trunk/ippTools/src/warptool.c
- Timestamp:
- Jan 20, 2008, 3:48:37 PM (18 years ago)
- File:
-
- 1 edited
-
trunk/ippTools/src/warptool.c (modified) (21 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippTools/src/warptool.c
r15532 r16170 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 psTime *registered = NULL; 137 { 138 psString registeredStr = psMetadataLookupStr(&status, config->args, "-registered"); 139 if (!status) { 140 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -registered"); 141 return false; 142 } 143 // pass through NULL as this is an optional field 144 if (registeredStr) { 145 registered = psTimeFromISO(registeredStr, PS_TIME_UTC); 146 } else { 147 registered = NULL; 148 } 149 } 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 123 // default 124 PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false); 125 PXOPT_LOOKUP_TIME(registered, config->args, "-registered", false, false); 150 126 151 127 warpRunRow *warpRun = warpRunRowAlloc( … … 154 130 "reg", // state 155 131 workdir, 156 NULL, // dvodb 132 "dirty", // workdir_state 133 dvodb, 134 tess_id, 135 end_stage, 157 136 registered 158 137 ); 159 psFree(registered);160 138 if (!warpRun) { 161 139 psError(PS_ERR_UNKNOWN, false, "failed to alloc warpRun object"); … … 171 149 psS64 warp_id = psDBLastInsertID(config->dbh); 172 150 warpRun->warp_id = warp_id; 173 174 bool simple = false;175 {176 bool status = false;177 simple = psMetadataLookupBool(&status, config->args, "-simple");178 if (!status) {179 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -simple");180 psFree(warpRun);181 return false;182 }183 }184 151 185 152 if (!warpRunPrintObject(stdout, warpRun, !simple)) { … … 255 222 PS_ASSERT_PTR_NON_NULL(config, false); 256 223 257 bool status = false; 258 psString warp_id = psMetadataLookupStr(&status, config->args, "-warp_id"); 259 if (!status) { 260 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -warpt_id"); 261 return false; 262 } 263 if (!warp_id) { 264 psError(PS_ERR_UNKNOWN, true, "-warp_id is required"); 265 return false; 266 } 267 268 psString state = psMetadataLookupStr(&status, config->args, "-state"); 269 if (!status) { 270 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -state"); 271 return false; 272 } 273 if (!state) { 274 psError(PS_ERR_UNKNOWN, true, "-state is required"); 275 return false; 276 } 224 PXOPT_LOOKUP_STR(warp_id, config->args, "-warp_id", true, false); 225 PXOPT_LOOKUP_STR(state, config->args, "-state", true, false); 277 226 278 227 if (state) { … … 289 238 PS_ASSERT_PTR_NON_NULL(config, false); 290 239 291 bool status = false; 292 psString warp_id = psMetadataLookupStr(&status, config->args, "-warp_id"); 293 if (!status) { 294 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -warp_id"); 295 return false; 296 } 297 if (!warp_id) { 298 psError(PS_ERR_UNKNOWN, true, "-warp_id is required"); 299 return false; 300 } 301 302 psString cam_id = psMetadataLookupStr(&status, config->args, "-cam_id"); 303 if (!status) { 304 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -cam_id"); 305 return false; 306 } 307 if (!cam_id) { 308 psError(PS_ERR_UNKNOWN, true, "-cam_id is required"); 309 return false; 310 } 240 PXOPT_LOOKUP_STR(warp_id, config->args, "-warp_id", true, false); 241 PXOPT_LOOKUP_STR(cam_id, config->args, "-cam_id", true, false); 311 242 312 243 // defaults to false 313 bool magiced = psMetadataLookupBool(&status, config->args, "-magiced"); 314 if (!status) { 315 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -magiced"); 316 return false; 317 } 318 319 // XXX need to validate the warp_id here 320 // XXX instead of validiting it here we should just use forgein key 321 // constrants 244 PXOPT_LOOKUP_BOOL(magiced, config->args, "-magiced", false); 245 322 246 if (!warpInputExpInsert(config->dbh, 323 247 (psS64)atoll(warp_id), … … 337 261 PS_ASSERT_PTR_NON_NULL(config, false); 338 262 339 bool status = false; 340 psU64 limit = psMetadataLookupU64(&status, config->args, "-limit"); 341 if (!status) { 342 psError(PXTOOLS_ERR_PROG, false, "failed to lookup value for -limit"); 343 return false; 344 } 263 PXOPT_LOOKUP_U64(limit, config->args, "-limit", false, false); 264 PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false); 345 265 346 266 // find all rawImfiles matching the default query … … 391 311 } 392 312 393 bool simple = false;394 {395 bool status = false;396 simple = psMetadataLookupBool(&status, config->args, "-simple");397 if (!status) {398 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -simple");399 return false;400 }401 }402 403 313 if (psArrayLength(output)) { 404 314 if (!convertIdToStr(output)) { … … 426 336 PS_ASSERT_PTR_NON_NULL(config, false); 427 337 428 bool status = false; 429 psU64 limit = psMetadataLookupU64(&status, config->args, "-limit"); 430 if (!status) { 431 psError(PXTOOLS_ERR_PROG, false, "failed to lookup value for -limit"); 432 return false; 433 } 338 PXOPT_LOOKUP_U64(limit, config->args, "-limit", false, false); 339 PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false); 434 340 435 341 // find all rawImfiles matching the default query … … 480 386 } 481 387 482 bool simple = false;483 {484 bool status = false;485 simple = psMetadataLookupBool(&status, config->args, "-simple");486 if (!status) {487 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -simple");488 return false;489 }490 }491 492 388 if (psArrayLength(output)) { 493 389 if (!convertIdToStr(output)) { … … 515 411 PS_ASSERT_PTR_NON_NULL(config, false); 516 412 517 bool status = false; 518 psU64 limit = psMetadataLookupU64(&status, config->args, "-limit"); 519 if (!status) { 520 psError(PXTOOLS_ERR_PROG, false, "failed to lookup value for -limit"); 521 return false; 522 } 413 PXOPT_LOOKUP_U64(limit, config->args, "-limit", false, false); 414 PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false); 523 415 524 416 // find all rawImfiles matching the default query … … 569 461 } 570 462 571 bool simple = false;572 {573 bool status = false;574 simple = psMetadataLookupBool(&status, config->args, "-simple");575 if (!status) {576 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -simple");577 return false;578 }579 }580 581 463 if (psArrayLength(output)) { 582 464 if (!convertIdToStr(output)) { … … 599 481 } 600 482 601 483 602 484 static bool addoverlapMode(pxConfig *config) 603 485 { 604 486 PS_ASSERT_PTR_NON_NULL(config, false); 605 487 606 bool status = false; 607 psString mapfile = psMetadataLookupStr(&status, config->args, "-mapfile"); 608 if (!status) { 609 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -mapfile"); 610 return false; 611 } 612 if (!mapfile) { 613 psError(PS_ERR_UNKNOWN, true, "-mapfile is required"); 614 return false; 615 } 488 PXOPT_LOOKUP_STR(mapfile, config->args, "-mapfile", false, false); 616 489 617 490 if (!psDBTransaction(config->dbh)) { … … 703 576 PS_ASSERT_PTR_NON_NULL(config, false); 704 577 705 bool status = false; 706 psU64 limit = psMetadataLookupU64(&status, config->args, "-limit"); 707 if (!status) { 708 psError(PXTOOLS_ERR_PROG, false, "failed to lookup value for -limit"); 709 return false; 710 } 578 PXOPT_LOOKUP_U64(limit, config->args, "-limit", false, false); 579 PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false); 711 580 712 581 // find all rawImfiles matching the default query … … 757 626 } 758 627 759 bool simple = false;760 {761 bool status = false;762 simple = psMetadataLookupBool(&status, config->args, "-simple");763 if (!status) {764 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -simple");765 return false;766 }767 }768 769 628 if (psArrayLength(output)) { 770 629 if (!convertIdToStr(output)) { … … 792 651 PS_ASSERT_PTR_NON_NULL(config, false); 793 652 794 bool status = false; 795 psU64 limit = psMetadataLookupU64(&status, config->args, "-limit"); 796 if (!status) { 797 psError(PXTOOLS_ERR_PROG, false, "failed to lookup value for -limit"); 798 return false; 799 } 653 PXOPT_LOOKUP_U64(limit, config->args, "-limit", false, false); 654 PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false); 800 655 801 656 // find all rawImfiles matching the default query … … 846 701 } 847 702 848 bool simple = false;849 {850 bool status = false;851 simple = psMetadataLookupBool(&status, config->args, "-simple");852 if (!status) {853 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -simple");854 return false;855 }856 }857 858 703 if (psArrayLength(output)) { 859 704 if (!convertIdToStr(output)) { … … 881 726 PS_ASSERT_PTR_NON_NULL(config, false); 882 727 883 bool status = false; 884 psString warp_id = psMetadataLookupStr(&status, config->args, "-warp_id"); 885 if (!status) { 886 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -warp_id"); 887 return false; 888 } 889 if (!warp_id) { 890 psError(PS_ERR_UNKNOWN, true, "-warp_id is required"); 891 return false; 892 } 893 894 psString skycell_id = psMetadataLookupStr(&status, config->args, "-skycell_id"); 895 if (!status) { 896 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -skycell_id"); 897 return false; 898 } 899 if (!skycell_id) { 900 psError(PS_ERR_UNKNOWN, true, "-skycell_id is required"); 901 return false; 902 } 903 904 psString tess_id = psMetadataLookupStr(&status, config->args, "-tess_id"); 905 if (!status) { 906 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -tess_id"); 907 return false; 908 } 909 if (!tess_id) { 910 psError(PS_ERR_UNKNOWN, true, "-tess_id is required"); 911 return false; 912 } 913 914 psString uri = psMetadataLookupStr(&status, config->args, "-uri"); 915 if (!status) { 916 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -uri"); 917 return false; 918 } 919 920 psString path_base = psMetadataLookupStr(&status, config->args, "-path_base"); 921 if (!status) { 922 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -path_base"); 923 return false; 924 } 728 PXOPT_LOOKUP_STR(warp_id, config->args, "-warp_id", true, false); 729 PXOPT_LOOKUP_STR(skycell_id, config->args, "-skycell_id", true, false); 730 PXOPT_LOOKUP_STR(tess_id, config->args, "-tess_id", true, false); 925 731 926 732 // optional 927 psF64 bg = psMetadataLookupF64(&status, config->args, "-bg"); 928 if (!status) { 929 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -bg"); 930 return false; 931 } 932 933 psF64 bg_stdev = psMetadataLookupF64(&status, config->args, "-bg_stdev"); 934 if (!status) { 935 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -bg_stdev"); 936 return false; 937 } 938 939 psF64 good_frac = psMetadataLookupF64(&status, config->args, "-good_frac"); 940 if (!status) { 941 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -good_frac"); 942 return false; 943 } 944 945 bool ignore = psMetadataLookupBool(&status, config->args, "-ignore"); 946 if (!status) { 947 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -ignore"); 948 return false; 949 } 733 PXOPT_LOOKUP_STR(uri, config->args, "-uri", false, false); 734 PXOPT_LOOKUP_STR(path_base, config->args, "-path_base", false, false); 735 PXOPT_LOOKUP_F64(bg, config->args, "-bg", false, false); 736 PXOPT_LOOKUP_F64(bg_stdev, config->args, "-bg_stdev", false, false); 737 PXOPT_LOOKUP_F64(good_frac, config->args, "-good_frac", false, false); 738 PXOPT_LOOKUP_BOOL(ignore, config->args, "-ignore", false); 950 739 951 740 // default values 952 psS16 code = psMetadataLookupS16(&status, config->args, "-code"); 953 if (!status) { 954 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -code"); 955 return false; 956 } 741 PXOPT_LOOKUP_S16(code, config->args, "-code", false, false); 957 742 958 743 // we don't want to insert the last skyfile in a run but then not mark the … … 1071 856 " USING(warp_id)\n" 1072 857 " LEFT JOIN warpSkyfile\n" 1073 " USING(warp_id, skycell_id , tess_id)\n"858 " USING(warp_id, skycell_id)\n" 1074 859 " WHERE\n" 1075 860 " warpRun.state = 'run'\n" … … 1111 896 PS_ASSERT_PTR_NON_NULL(config, false); 1112 897 1113 bool status = false; 1114 psU64 limit = psMetadataLookupU64(&status, config->args, "-limit"); 1115 if (!status) { 1116 psError(PXTOOLS_ERR_PROG, false, "failed to lookup value for -limit"); 1117 return false; 1118 } 898 PXOPT_LOOKUP_U64(limit, config->args, "-limit", false, false); 899 PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false); 1119 900 1120 901 // find all rawImfiles matching the default query … … 1165 946 } 1166 947 1167 bool simple = false;1168 {1169 bool status = false;1170 simple = psMetadataLookupBool(&status, config->args, "-simple");1171 if (!status) {1172 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -simple");1173 return false;1174 }1175 }1176 1177 948 if (psArrayLength(output)) { 1178 949 if (!convertIdToStr(output)) {
Note:
See TracChangeset
for help on using the changeset viewer.
