Changeset 10690 for trunk/ippTools/src/warptool.c
- Timestamp:
- Dec 12, 2006, 6:47:03 PM (19 years ago)
- File:
-
- 1 edited
-
trunk/ippTools/src/warptool.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippTools/src/warptool.c
r10642 r10690 25 25 #include <string.h> 26 26 #include <stdlib.h> 27 #include <math.h> 27 28 #include <ippdb.h> 28 29 … … 91 92 PS_ASSERT_PTR_NON_NULL(config, NULL); 92 93 94 // required options 95 bool status = false; 96 psString survey_mode = psMetadataLookupStr(&status, config->args, "-survey_mode"); 97 if (!status) { 98 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -survey_mode"); 99 return false; 100 } 101 if (!survey_mode) { 102 psError(PS_ERR_UNKNOWN, true, "-survery_mode is required"); 103 return false; 104 } 105 106 psString filter = psMetadataLookupStr(&status, config->args, "-filter"); 107 if (!status) { 108 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -filter"); 109 return false; 110 } 111 if (!filter) { 112 psError(PS_ERR_UNKNOWN, true, "-survery_mode is required"); 113 return false; 114 } 115 116 psString skycell_id = psMetadataLookupStr(&status, config->args, "-skycell_id"); 117 if (!status) { 118 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -skycell_id"); 119 return false; 120 } 121 if (!skycell_id) { 122 psError(PS_ERR_UNKNOWN, true, "-survery_mode is required"); 123 return false; 124 } 125 126 psString tess_id = psMetadataLookupStr(&status, config->args, "-tess_id"); 127 if (!status) { 128 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -tess_id"); 129 return false; 130 } 131 if (!tess_id) { 132 psError(PS_ERR_UNKNOWN, true, "-survery_mode is required"); 133 return false; 134 } 135 136 psS32 imfiles = psMetadataLookupS32(&status, config->args, "-imfiles"); 137 if (!status) { 138 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -imfiles"); 139 return false; 140 } 141 if (imfiles < 1) { 142 psError(PS_ERR_UNKNOWN, true, "-imfiles is required"); 143 return false; 144 } 145 146 // optional options 147 psF64 ra = psMetadataLookupS32(&status, config->args, "-ra"); 148 if (!status) { 149 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -ra"); 150 return false; 151 } 152 153 psF64 decl = psMetadataLookupS32(&status, config->args, "-decl"); 154 if (!status) { 155 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -decl"); 156 return false; 157 } 158 159 psString input_ss = psMetadataLookupStr(&status, config->args, "-input_ss"); 160 if (!status) { 161 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -input_ss"); 162 return false; 163 } 164 165 psString output_ss = psMetadataLookupStr(&status, config->args, "-output_ss"); 166 if (!status) { 167 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -output_ss"); 168 return false; 169 } 170 171 psTime *registered = NULL; 172 { 173 psString registeredStr = psMetadataLookupStr(&status, config->args, "-registered"); 174 if (!status) { 175 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -registered"); 176 return false; 177 } 178 // pass through NULL as this is an optional field 179 if (registeredStr) { 180 registered = psTimeFromISO(registeredStr, PS_TIME_UTC); 181 } else { 182 registered = NULL; 183 } 184 } 185 186 p4RunRow *p4Run = p4RunRowAlloc( 187 0, 188 survey_mode, 189 "run", 190 filter, 191 skycell_id, 192 tess_id, 193 ra, 194 decl, 195 input_ss, 196 output_ss 197 ); 198 psFree(registered); 199 if (!p4Run) { 200 psError(PS_ERR_UNKNOWN, false, "failed to alloc p4Run object"); 201 return true; 202 } 203 if (!p4RunInsertObject(config->dbh, p4Run)) { 204 psError(PS_ERR_UNKNOWN, false, "database error"); 205 psFree(p4Run); 206 return true; 207 } 208 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 psFree(p4Run); 216 return false; 217 } 218 } 219 220 if (!p4RunPrintObject(stdout, p4Run, !simple)) { 221 psError(PS_ERR_UNKNOWN, false, "failed to print object"); 222 psFree(p4Run); 223 return false; 224 } 225 226 psFree(p4Run); 227 93 228 return true; 94 229 }
Note:
See TracChangeset
for help on using the changeset viewer.
