Changeset 8543
- Timestamp:
- Aug 23, 2006, 5:13:02 PM (20 years ago)
- Location:
- trunk/ippdb
- Files:
-
- 9 edited
-
configure.ac (modified) (1 diff)
-
src/ippdb.c (modified) (12 diffs)
-
src/ippdb.h (modified) (4 diffs)
-
tests/alloc.c (modified) (2 diffs)
-
tests/insert.c (modified) (1 diff)
-
tests/insertobject.c (modified) (1 diff)
-
tests/metadatafromobject.c (modified) (2 diffs)
-
tests/objectfrommetadata.c (modified) (2 diffs)
-
tests/pop.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippdb/configure.ac
r8528 r8543 1 1 AC_PREREQ(2.59) 2 2 3 AC_INIT([ippdb], [0.0.3 2], [pan-starrs.ifa.hawaii.edu])3 AC_INIT([ippdb], [0.0.33], [pan-starrs.ifa.hawaii.edu]) 4 4 AC_CONFIG_SRCDIR([ippdb.pc.in]) 5 5 -
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) -
trunk/ippdb/src/ippdb.h
r8528 r8543 6058 6058 psF64 bg_stdev; 6059 6059 psF64 bg_mean_stdev; 6060 bool normalize; 6060 6061 } detStackedImfileRow; 6061 6062 … … 6073 6074 psF64 bg, 6074 6075 psF64 bg_stdev, 6075 psF64 bg_mean_stdev 6076 psF64 bg_mean_stdev, 6077 bool normalize 6076 6078 ); 6077 6079 … … 6110 6112 psF64 bg, 6111 6113 psF64 bg_stdev, 6112 psF64 bg_mean_stdev 6114 psF64 bg_mean_stdev, 6115 bool normalize 6113 6116 ); 6114 6117 … … 6138 6141 psF64 *bg, 6139 6142 psF64 *bg_stdev, 6140 psF64 *bg_mean_stdev 6143 psF64 *bg_mean_stdev, 6144 bool *normalize 6141 6145 ); 6142 6146 -
trunk/ippdb/tests/alloc.c
r8528 r8543 1007 1007 detStackedImfileRow *object; 1008 1008 1009 object = detStackedImfileRowAlloc(-32, -32, "a string", "a string", "a string", 64.64, 64.64, 64.64 );1009 object = detStackedImfileRowAlloc(-32, -32, "a string", "a string", "a string", 64.64, 64.64, 64.64, true ); 1010 1010 1011 1011 if (!object) { … … 1042 1042 } 1043 1043 if (!object->bg_mean_stdev == 64.64) { 1044 psFree(object); 1045 exit(EXIT_FAILURE); 1046 } 1047 if (!object->normalize == true) { 1044 1048 psFree(object); 1045 1049 exit(EXIT_FAILURE); -
trunk/ippdb/tests/insert.c
r8528 r8543 388 388 } 389 389 390 if (!detStackedImfileInsert(dbh, -32, -32, "a string", "a string", "a string", 64.64, 64.64, 64.64 )) {390 if (!detStackedImfileInsert(dbh, -32, -32, "a string", "a string", "a string", 64.64, 64.64, 64.64, true)) { 391 391 exit(EXIT_FAILURE); 392 392 } -
trunk/ippdb/tests/insertobject.c
r8528 r8543 564 564 } 565 565 566 object = detStackedImfileRowAlloc(-32, -32, "a string", "a string", "a string", 64.64, 64.64, 64.64 );566 object = detStackedImfileRowAlloc(-32, -32, "a string", "a string", "a string", 64.64, 64.64, 64.64, true); 567 567 if (!object) { 568 568 exit(EXIT_FAILURE); -
trunk/ippdb/tests/metadatafromobject.c
r8528 r8543 1210 1210 bool status; 1211 1211 1212 object = detStackedImfileRowAlloc(-32, -32, "a string", "a string", "a string", 64.64, 64.64, 64.64 );1212 object = detStackedImfileRowAlloc(-32, -32, "a string", "a string", "a string", 64.64, 64.64, 64.64, true); 1213 1213 if (!object) { 1214 1214 exit(EXIT_FAILURE); … … 1251 1251 } 1252 1252 if (!psMetadataLookupF64(&status, md, "bg_mean_stdev") == 64.64) { 1253 psFree(md); 1254 exit(EXIT_FAILURE); 1255 } 1256 if (!psMetadataLookupBool(&status, md, "normalize") == true) { 1253 1257 psFree(md); 1254 1258 exit(EXIT_FAILURE); -
trunk/ippdb/tests/objectfrommetadata.c
r8528 r8543 1839 1839 exit(EXIT_FAILURE); 1840 1840 } 1841 if (!psMetadataAdd(md, PS_LIST_TAIL, "normalize", PS_DATA_BOOL, NULL, true)) { 1842 psFree(md); 1843 exit(EXIT_FAILURE); 1844 } 1841 1845 1842 1846 object = detStackedImfileObjectFromMetadata(md); … … 1877 1881 } 1878 1882 if (!object->bg_mean_stdev == 64.64) { 1883 psFree(object); 1884 exit(EXIT_FAILURE); 1885 } 1886 if (!object->normalize == true) { 1879 1887 psFree(object); 1880 1888 exit(EXIT_FAILURE); -
trunk/ippdb/tests/pop.c
r8528 r8543 558 558 psF64 bg_stdev; 559 559 psF64 bg_mean_stdev; 560 561 dbh = psDBInit("localhost", "test", NULL, "test"); 562 if (!dbh) { 563 exit(EXIT_FAILURE); 564 } 565 566 if (!detStackedImfilePop(dbh, &det_id, &iteration, (char **)&class_id, (char **)&uri, (char **)&recipe, &bg, &bg_stdev, &bg_mean_stdev)) { 560 bool normalize; 561 562 dbh = psDBInit("localhost", "test", NULL, "test"); 563 if (!dbh) { 564 exit(EXIT_FAILURE); 565 } 566 567 if (!detStackedImfilePop(dbh, &det_id, &iteration, (char **)&class_id, (char **)&uri, (char **)&recipe, &bg, &bg_stdev, &bg_mean_stdev, &normalize)) { 567 568 exit(EXIT_FAILURE); 568 569 }
Note:
See TracChangeset
for help on using the changeset viewer.
