Changeset 7128
- Timestamp:
- May 16, 2006, 6:05:00 PM (20 years ago)
- File:
-
- 1 edited
-
trunk/ippTools/src/dettool.c (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippTools/src/dettool.c
r7114 r7128 16 16 17 17 static detInputExpRow *rawDetrenTodetInputExpRow(rawDetrendExpRow *rawExp, psS32 det_id); 18 static psArray *searchRawImfiles(pxConfig *config); 18 19 19 20 int main(int argc, char **argv) … … 157 158 PS_ASSERT_PTR_NON_NULL(config, false); 158 159 160 // search from rawImfiles 161 psArray *rawImfiles = searchRawImfiles(config); 162 163 // print imfile list 164 psMetadata *output = psMetadataAlloc(); 165 for (long i = 0; i < psArrayLength(rawImfiles); i++) { 166 psMetadata *md = rawImfileMetadataFromObject(rawImfiles->data[i]); 167 psMetadataAddMetadata( 168 output, PS_LIST_TAIL, "rawImfile", PS_META_DUPLICATE_OK, NULL, md); 169 } 170 171 psString str = psMetadataConfigFormat(output); 172 psFree(output); 173 fprintf(stdout, "%s\n", str); 174 psFree(str); 175 176 return true; 177 } 178 179 static psArray *searchRawImfiles(pxConfig *config) 180 { 181 PS_ASSERT_PTR_NON_NULL(config, NULL); 182 159 183 // select exp_ids from detInputExp matching det_idp 160 184 // where query should be pre-generated … … 163 187 if (!detInputExp) { 164 188 psError(PS_ERR_UNKNOWN, false, "no rawDetrendExp rows found"); 165 return false;189 return NULL; 166 190 } 167 191 … … 176 200 psFree(detInputExp); 177 201 psFree(where_exp_ids); 178 return false;202 return NULL; 179 203 } 180 204 } … … 187 211 if (!rawImfiles) { 188 212 psError(PS_ERR_UNKNOWN, false, "no rawImfile rows found"); 189 return false; 190 } 191 192 // print imfile list 193 psMetadata *output = psMetadataAlloc(); 194 for (long i = 0; i < psArrayLength(rawImfiles); i++) { 195 psMetadata *md = rawImfileMetadataFromObject(rawImfiles->data[i]); 196 psMetadataAddMetadata( 197 output, PS_LIST_TAIL, "rawImfile", PS_META_DUPLICATE_OK, NULL, md); 198 } 199 200 psString str = psMetadataConfigFormat(output); 201 psFree(output); 202 fprintf(stdout, "%s\n", str); 203 psFree(str); 204 205 return true; 213 return NULL; 214 } 215 216 return rawImfiles; 206 217 } 207 218 … … 310 321 PS_ASSERT_PTR_NON_NULL(config, false); 311 322 323 // det_id, class_id, uri, & recipe are required 324 bool status = false; 325 psString det_id = psMetadataLookupStr(&status, config->args, "-det_id"); 326 if (!status) { 327 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -det_id"); 328 return false; 329 } 330 psString class_id = psMetadataLookupStr(&status, config->args, "-class_id"); 331 if (!status) { 332 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -class_id"); 333 return false; 334 } 335 psString uri = psMetadataLookupStr(&status, config->args, "-uri"); 336 if (!status) { 337 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -uri"); 338 return false; 339 } 340 psString recipe = psMetadataLookupStr(&status, config->args, "-recipe"); 341 if (!status) { 342 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -recipe"); 343 return false; 344 } 345 psString stats = psMetadataLookupStr(&status, config->args, "-stats"); 346 if (!status) { 347 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -stats"); 348 return false; 349 } 350 351 // correlate the class_id against the input exposure(s) 352 psArray *rawImfiles = searchRawImfiles(config); 353 354 bool valid_class_id = false; 355 for (long i = 0; i < psArrayLength(rawImfiles); i++) { 356 if (class_id == ((rawImfileRow *)rawImfiles->data[i])->class_id) { 357 valid_class_id = true; 358 break; 359 } 360 } 361 psFree(rawImfiles); 362 363 if (!valid_class_id) { 364 psError(PS_ERR_UNKNOWN, true, 365 "class_id can not be correlated with the input exposures"); 366 return false; 367 } 368 369 // create a new detStackedImfile object 370 detStackedImfileRow *stackedImfile = detStackedImfileRowAlloc( 371 (psS32)atol(det_id), class_id, uri, stats, recipe 372 ); 373 psFree(rawImfiles); 374 375 // insert the new row into the detProcessedImfile table 376 if (!detStackedImfileInsertObject(config->dbh, stackedImfile)) { 377 psError(PS_ERR_UNKNOWN, false, "database error"); 378 return false; 379 } 380 312 381 return true; 313 382 }
Note:
See TracChangeset
for help on using the changeset viewer.
