Changeset 8543 for trunk/ippdb/src/ippdb.c
- Timestamp:
- Aug 23, 2006, 5:13:02 PM (20 years ago)
- File:
-
- 1 edited
-
trunk/ippdb/src/ippdb.c (modified) (12 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippdb/src/ippdb.c
r8528 r8543 14057 14057 static void detStackedImfileRowFree(detStackedImfileRow *object); 14058 14058 14059 detStackedImfileRow *detStackedImfileRowAlloc(psS32 det_id, psS32 iteration, const char *class_id, const char *uri, const char *recipe, psF64 bg, psF64 bg_stdev, psF64 bg_mean_stdev )14059 detStackedImfileRow *detStackedImfileRowAlloc(psS32 det_id, psS32 iteration, const char *class_id, const char *uri, const char *recipe, psF64 bg, psF64 bg_stdev, psF64 bg_mean_stdev, bool normalize) 14060 14060 { 14061 14061 detStackedImfileRow *object; … … 14072 14072 object->bg_stdev = bg_stdev; 14073 14073 object->bg_mean_stdev = bg_mean_stdev; 14074 object->normalize = normalize; 14074 14075 14075 14076 return object; … … 14134 14135 return false; 14135 14136 } 14137 if (!psMetadataAdd(md, PS_LIST_TAIL, "normalize", PS_DATA_BOOL, NULL, false)) { 14138 psError(PS_ERR_UNKNOWN, false, "failed to add item normalize"); 14139 psFree(md); 14140 return false; 14141 } 14136 14142 14137 14143 status = psDBCreateTable(dbh, DETSTACKEDIMFILE_TABLE_NAME, md); … … 14147 14153 } 14148 14154 14149 bool detStackedImfileInsert(psDB * dbh, psS32 det_id, psS32 iteration, const char *class_id, const char *uri, const char *recipe, psF64 bg, psF64 bg_stdev, psF64 bg_mean_stdev )14155 bool detStackedImfileInsert(psDB * dbh, psS32 det_id, psS32 iteration, const char *class_id, const char *uri, const char *recipe, psF64 bg, psF64 bg_stdev, psF64 bg_mean_stdev, bool normalize) 14150 14156 { 14151 14157 psMetadata *md; … … 14190 14196 if (!psMetadataAddF64(md, PS_LIST_TAIL, "bg_mean_stdev", 0, NULL, bg_mean_stdev)) { 14191 14197 psError(PS_ERR_UNKNOWN, false, "failed to add item bg_mean_stdev"); 14198 psFree(md); 14199 return false; 14200 } 14201 if (!psMetadataAdd(md, PS_LIST_TAIL, "normalize", PS_DATA_BOOL, NULL, normalize)) { 14202 psError(PS_ERR_UNKNOWN, false, "failed to add item normalize"); 14192 14203 psFree(md); 14193 14204 return false; … … 14214 14225 return deleted; 14215 14226 } 14216 bool detStackedImfilePop(psDB *dbh, psS32 *det_id, psS32 *iteration, char **class_id, char **uri, char **recipe, psF64 *bg, psF64 *bg_stdev, psF64 *bg_mean_stdev )14227 bool detStackedImfilePop(psDB *dbh, psS32 *det_id, psS32 *iteration, char **class_id, char **uri, char **recipe, psF64 *bg, psF64 *bg_stdev, psF64 *bg_mean_stdev, bool *normalize) 14217 14228 { 14218 14229 psArray *rowSet; … … 14306 14317 return false; 14307 14318 } 14319 *normalize = psMetadataLookupBool(&status, row, "normalize"); 14320 if (!status) { 14321 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item normalize"); 14322 psFree(row); 14323 return false; 14324 } 14308 14325 14309 14326 psFree(row); … … 14314 14331 bool detStackedImfileInsertObject(psDB *dbh, detStackedImfileRow *object) 14315 14332 { 14316 return detStackedImfileInsert(dbh, object->det_id, object->iteration, object->class_id, object->uri, object->recipe, object->bg, object->bg_stdev, object->bg_mean_stdev );14333 return detStackedImfileInsert(dbh, object->det_id, object->iteration, object->class_id, object->uri, object->recipe, object->bg, object->bg_stdev, object->bg_mean_stdev, object->normalize); 14317 14334 } 14318 14335 … … 14338 14355 psF64 bg_stdev; 14339 14356 psF64 bg_mean_stdev; 14340 14341 if (!detStackedImfilePop(dbh, &det_id, &iteration, (char **)&class_id, (char **)&uri, (char **)&recipe, &bg, &bg_stdev, &bg_mean_stdev)) { 14357 bool normalize; 14358 14359 if (!detStackedImfilePop(dbh, &det_id, &iteration, (char **)&class_id, (char **)&uri, (char **)&recipe, &bg, &bg_stdev, &bg_mean_stdev, &normalize)) { 14342 14360 psError(PS_ERR_UNKNOWN, false, "failed to pop a database row"); 14343 14361 return NULL; 14344 14362 } 14345 14363 14346 return detStackedImfileRowAlloc(det_id, iteration, class_id, uri, recipe, bg, bg_stdev, bg_mean_stdev );14364 return detStackedImfileRowAlloc(det_id, iteration, class_id, uri, recipe, bg, bg_stdev, bg_mean_stdev, normalize); 14347 14365 } 14348 14366 … … 14480 14498 if (!psMetadataAddF64(md, PS_LIST_TAIL, "bg_mean_stdev", 0, NULL, object->bg_mean_stdev)) { 14481 14499 psError(PS_ERR_UNKNOWN, false, "failed to add item bg_mean_stdev"); 14500 psFree(md); 14501 return NULL; 14502 } 14503 if (!psMetadataAdd(md, PS_LIST_TAIL, "normalize", PS_DATA_BOOL, NULL, object->normalize)) { 14504 psError(PS_ERR_UNKNOWN, false, "failed to add item normalize"); 14482 14505 psFree(md); 14483 14506 return NULL; … … 14498 14521 psF64 bg_stdev; 14499 14522 psF64 bg_mean_stdev; 14523 bool normalize; 14500 14524 14501 14525 det_id = psMetadataLookupS32(&status, md, "det_id"); … … 14539 14563 return false; 14540 14564 } 14541 14542 return detStackedImfileRowAlloc(det_id, iteration, class_id, uri, recipe, bg, bg_stdev, bg_mean_stdev); 14565 normalize = psMetadataLookupBool(&status, md, "normalize"); 14566 if (!status) { 14567 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item normalize"); 14568 return false; 14569 } 14570 14571 return detStackedImfileRowAlloc(det_id, iteration, class_id, uri, recipe, bg, bg_stdev, bg_mean_stdev, normalize); 14543 14572 } 14544 14573 psArray *detStackedImfileSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit)
Note:
See TracChangeset
for help on using the changeset viewer.
