Changeset 9229 for trunk/ippdb/src/ippdb.c
- Timestamp:
- Oct 4, 2006, 12:26:17 PM (20 years ago)
- File:
-
- 1 edited
-
trunk/ippdb/src/ippdb.c (modified) (13 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippdb/src/ippdb.c
r9213 r9229 16080 16080 static void detNormalizedImfileRowFree(detNormalizedImfileRow *object); 16081 16081 16082 detNormalizedImfileRow *detNormalizedImfileRowAlloc(psS32 det_id, psS32 iteration, const char *class_id, const char *uri, const char *b1_uri, const char *b2_uri)16082 detNormalizedImfileRow *detNormalizedImfileRowAlloc(psS32 det_id, psS32 iteration, const char *class_id, const char *uri, psF64 bg, psF64 bg_stdev, psF64 bg_mean_stdev, const char *b1_uri, const char *b2_uri) 16083 16083 { 16084 16084 detNormalizedImfileRow *object; … … 16091 16091 object->class_id = psStringCopy(class_id); 16092 16092 object->uri = psStringCopy(uri); 16093 object->bg = bg; 16094 object->bg_stdev = bg_stdev; 16095 object->bg_mean_stdev = bg_mean_stdev; 16093 16096 object->b1_uri = psStringCopy(b1_uri); 16094 16097 object->b2_uri = psStringCopy(b2_uri); … … 16136 16139 return false; 16137 16140 } 16141 if (!psMetadataAddF64(md, PS_LIST_TAIL, "bg", 0, NULL, 0.0)) { 16142 psError(PS_ERR_UNKNOWN, false, "failed to add item bg"); 16143 psFree(md); 16144 return false; 16145 } 16146 if (!psMetadataAddF64(md, PS_LIST_TAIL, "bg_stdev", 0, NULL, 0.0)) { 16147 psError(PS_ERR_UNKNOWN, false, "failed to add item bg_stdev"); 16148 psFree(md); 16149 return false; 16150 } 16151 if (!psMetadataAddF64(md, PS_LIST_TAIL, "bg_mean_stdev", 0, NULL, 0.0)) { 16152 psError(PS_ERR_UNKNOWN, false, "failed to add item bg_mean_stdev"); 16153 psFree(md); 16154 return false; 16155 } 16138 16156 if (!psMetadataAddStr(md, PS_LIST_TAIL, "b1_uri", 0, NULL, "255")) { 16139 16157 psError(PS_ERR_UNKNOWN, false, "failed to add item b1_uri"); … … 16159 16177 } 16160 16178 16161 bool detNormalizedImfileInsert(psDB * dbh, psS32 det_id, psS32 iteration, const char *class_id, const char *uri, const char *b1_uri, const char *b2_uri)16179 bool detNormalizedImfileInsert(psDB * dbh, psS32 det_id, psS32 iteration, const char *class_id, const char *uri, psF64 bg, psF64 bg_stdev, psF64 bg_mean_stdev, const char *b1_uri, const char *b2_uri) 16162 16180 { 16163 16181 psMetadata *md; … … 16182 16200 if (!psMetadataAddStr(md, PS_LIST_TAIL, "uri", 0, NULL, uri)) { 16183 16201 psError(PS_ERR_UNKNOWN, false, "failed to add item uri"); 16202 psFree(md); 16203 return false; 16204 } 16205 if (!psMetadataAddF64(md, PS_LIST_TAIL, "bg", 0, NULL, bg)) { 16206 psError(PS_ERR_UNKNOWN, false, "failed to add item bg"); 16207 psFree(md); 16208 return false; 16209 } 16210 if (!psMetadataAddF64(md, PS_LIST_TAIL, "bg_stdev", 0, NULL, bg_stdev)) { 16211 psError(PS_ERR_UNKNOWN, false, "failed to add item bg_stdev"); 16212 psFree(md); 16213 return false; 16214 } 16215 if (!psMetadataAddF64(md, PS_LIST_TAIL, "bg_mean_stdev", 0, NULL, bg_mean_stdev)) { 16216 psError(PS_ERR_UNKNOWN, false, "failed to add item bg_mean_stdev"); 16184 16217 psFree(md); 16185 16218 return false; … … 16216 16249 return deleted; 16217 16250 } 16218 bool detNormalizedImfilePop(psDB *dbh, psS32 *det_id, psS32 *iteration, char **class_id, char **uri, char **b1_uri, char **b2_uri)16251 bool detNormalizedImfilePop(psDB *dbh, psS32 *det_id, psS32 *iteration, char **class_id, char **uri, psF64 *bg, psF64 *bg_stdev, psF64 *bg_mean_stdev, char **b1_uri, char **b2_uri) 16219 16252 { 16220 16253 psArray *rowSet; … … 16284 16317 return false; 16285 16318 } 16319 *bg = psMetadataLookupF64(&status, row, "bg"); 16320 if (!status) { 16321 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item bg"); 16322 psFree(row); 16323 return false; 16324 } 16325 *bg_stdev = psMetadataLookupF64(&status, row, "bg_stdev"); 16326 if (!status) { 16327 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item bg_stdev"); 16328 psFree(row); 16329 return false; 16330 } 16331 *bg_mean_stdev = psMetadataLookupF64(&status, row, "bg_mean_stdev"); 16332 if (!status) { 16333 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item bg_mean_stdev"); 16334 psFree(row); 16335 return false; 16336 } 16286 16337 *b1_uri = psMetadataLookupPtr(&status, row, "b1_uri"); 16287 16338 if (!status) { … … 16304 16355 bool detNormalizedImfileInsertObject(psDB *dbh, detNormalizedImfileRow *object) 16305 16356 { 16306 return detNormalizedImfileInsert(dbh, object->det_id, object->iteration, object->class_id, object->uri, object->b 1_uri, object->b2_uri);16357 return detNormalizedImfileInsert(dbh, object->det_id, object->iteration, object->class_id, object->uri, object->bg, object->bg_stdev, object->bg_mean_stdev, object->b1_uri, object->b2_uri); 16307 16358 } 16308 16359 … … 16324 16375 char class_id[256]; 16325 16376 char uri[256]; 16377 psF64 bg; 16378 psF64 bg_stdev; 16379 psF64 bg_mean_stdev; 16326 16380 char b1_uri[256]; 16327 16381 char b2_uri[256]; 16328 16382 16329 if (!detNormalizedImfilePop(dbh, &det_id, &iteration, (char **)&class_id, (char **)&uri, (char **)&b1_uri, (char **)&b2_uri)) {16383 if (!detNormalizedImfilePop(dbh, &det_id, &iteration, (char **)&class_id, (char **)&uri, &bg, &bg_stdev, &bg_mean_stdev, (char **)&b1_uri, (char **)&b2_uri)) { 16330 16384 psError(PS_ERR_UNKNOWN, false, "failed to pop a database row"); 16331 16385 return NULL; 16332 16386 } 16333 16387 16334 return detNormalizedImfileRowAlloc(det_id, iteration, class_id, uri, b 1_uri, b2_uri);16388 return detNormalizedImfileRowAlloc(det_id, iteration, class_id, uri, bg, bg_stdev, bg_mean_stdev, b1_uri, b2_uri); 16335 16389 } 16336 16390 … … 16451 16505 return NULL; 16452 16506 } 16507 if (!psMetadataAddF64(md, PS_LIST_TAIL, "bg", 0, NULL, object->bg)) { 16508 psError(PS_ERR_UNKNOWN, false, "failed to add item bg"); 16509 psFree(md); 16510 return NULL; 16511 } 16512 if (!psMetadataAddF64(md, PS_LIST_TAIL, "bg_stdev", 0, NULL, object->bg_stdev)) { 16513 psError(PS_ERR_UNKNOWN, false, "failed to add item bg_stdev"); 16514 psFree(md); 16515 return NULL; 16516 } 16517 if (!psMetadataAddF64(md, PS_LIST_TAIL, "bg_mean_stdev", 0, NULL, object->bg_mean_stdev)) { 16518 psError(PS_ERR_UNKNOWN, false, "failed to add item bg_mean_stdev"); 16519 psFree(md); 16520 return NULL; 16521 } 16453 16522 if (!psMetadataAddStr(md, PS_LIST_TAIL, "b1_uri", 0, NULL, object->b1_uri)) { 16454 16523 psError(PS_ERR_UNKNOWN, false, "failed to add item b1_uri"); … … 16472 16541 char *class_id; 16473 16542 char *uri; 16543 psF64 bg; 16544 psF64 bg_stdev; 16545 psF64 bg_mean_stdev; 16474 16546 char *b1_uri; 16475 16547 char *b2_uri; … … 16495 16567 return false; 16496 16568 } 16569 bg = psMetadataLookupF64(&status, md, "bg"); 16570 if (!status) { 16571 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item bg"); 16572 return false; 16573 } 16574 bg_stdev = psMetadataLookupF64(&status, md, "bg_stdev"); 16575 if (!status) { 16576 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item bg_stdev"); 16577 return false; 16578 } 16579 bg_mean_stdev = psMetadataLookupF64(&status, md, "bg_mean_stdev"); 16580 if (!status) { 16581 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item bg_mean_stdev"); 16582 return false; 16583 } 16497 16584 b1_uri = psMetadataLookupPtr(&status, md, "b1_uri"); 16498 16585 if (!status) { … … 16506 16593 } 16507 16594 16508 return detNormalizedImfileRowAlloc(det_id, iteration, class_id, uri, b 1_uri, b2_uri);16595 return detNormalizedImfileRowAlloc(det_id, iteration, class_id, uri, bg, bg_stdev, bg_mean_stdev, b1_uri, b2_uri); 16509 16596 } 16510 16597 psArray *detNormalizedImfileSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit)
Note:
See TracChangeset
for help on using the changeset viewer.
