Changeset 9307
- Timestamp:
- Oct 5, 2006, 12:04:18 PM (20 years ago)
- Location:
- trunk/ippdb
- Files:
-
- 9 edited
-
configure.ac (modified) (1 diff)
-
src/ippdb.c (modified) (13 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) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippdb/configure.ac
r9301 r9307 7 7 AC_PREREQ(2.59) 8 8 9 AC_INIT([ippdb], [0.0.4 7], [pan-starrs.ifa.hawaii.edu])9 AC_INIT([ippdb], [0.0.48], [pan-starrs.ifa.hawaii.edu]) 10 10 AC_CONFIG_SRCDIR([ippdb.pc.in]) 11 11 -
trunk/ippdb/src/ippdb.c
r9301 r9307 12862 12862 static void p3ProcessedExpRowFree(p3ProcessedExpRow *object); 12863 12863 12864 p3ProcessedExpRow *p3ProcessedExpRowAlloc(const char *exp_tag, const char *uri, const char *recipe, psF64 bg, psF64 bg_stdev, psF64 bg_mean_stdev, psF32 sigma_ra, psF32 sigma_dec, psS32 nastro, const char *b1_uri, const char *b2_uri, ps S32 p2_version, psS32 p3_version)12864 p3ProcessedExpRow *p3ProcessedExpRowAlloc(const char *exp_tag, const char *uri, const char *recipe, psF64 bg, psF64 bg_stdev, psF64 bg_mean_stdev, psF32 sigma_ra, psF32 sigma_dec, psS32 nastro, const char *b1_uri, const char *b2_uri, psF32 zp_mean, psF32 zp_stdev, psS32 p2_version, psS32 p3_version) 12865 12865 { 12866 12866 p3ProcessedExpRow *_object; … … 12880 12880 _object->b1_uri = psStringCopy(b1_uri); 12881 12881 _object->b2_uri = psStringCopy(b2_uri); 12882 _object->zp_mean = zp_mean; 12883 _object->zp_stdev = zp_stdev; 12882 12884 _object->p2_version = p2_version; 12883 12885 _object->p3_version = p3_version; … … 12961 12963 return false; 12962 12964 } 12965 if (!psMetadataAddF32(md, PS_LIST_TAIL, "zp_mean", 0, NULL, 0.0)) { 12966 psError(PS_ERR_UNKNOWN, false, "failed to add item zp_mean"); 12967 psFree(md); 12968 return false; 12969 } 12970 if (!psMetadataAddF32(md, PS_LIST_TAIL, "zp_stdev", 0, NULL, 0.0)) { 12971 psError(PS_ERR_UNKNOWN, false, "failed to add item zp_stdev"); 12972 psFree(md); 12973 return false; 12974 } 12963 12975 if (!psMetadataAddS32(md, PS_LIST_TAIL, "p2_version", 0, NULL, 0)) { 12964 12976 psError(PS_ERR_UNKNOWN, false, "failed to add item p2_version"); … … 12984 12996 } 12985 12997 12986 bool p3ProcessedExpInsert(psDB * dbh, const char *exp_tag, const char *uri, const char *recipe, psF64 bg, psF64 bg_stdev, psF64 bg_mean_stdev, psF32 sigma_ra, psF32 sigma_dec, psS32 nastro, const char *b1_uri, const char *b2_uri, ps S32 p2_version, psS32 p3_version)12998 bool p3ProcessedExpInsert(psDB * dbh, const char *exp_tag, const char *uri, const char *recipe, psF64 bg, psF64 bg_stdev, psF64 bg_mean_stdev, psF32 sigma_ra, psF32 sigma_dec, psS32 nastro, const char *b1_uri, const char *b2_uri, psF32 zp_mean, psF32 zp_stdev, psS32 p2_version, psS32 p3_version) 12987 12999 { 12988 13000 psMetadata *md; … … 13042 13054 if (!psMetadataAddStr(md, PS_LIST_TAIL, "b2_uri", 0, NULL, b2_uri)) { 13043 13055 psError(PS_ERR_UNKNOWN, false, "failed to add item b2_uri"); 13056 psFree(md); 13057 return false; 13058 } 13059 if (!psMetadataAddF32(md, PS_LIST_TAIL, "zp_mean", 0, NULL, zp_mean)) { 13060 psError(PS_ERR_UNKNOWN, false, "failed to add item zp_mean"); 13061 psFree(md); 13062 return false; 13063 } 13064 if (!psMetadataAddF32(md, PS_LIST_TAIL, "zp_stdev", 0, NULL, zp_stdev)) { 13065 psError(PS_ERR_UNKNOWN, false, "failed to add item zp_stdev"); 13044 13066 psFree(md); 13045 13067 return false; … … 13076 13098 return deleted; 13077 13099 } 13078 bool p3ProcessedExpPop(psDB *dbh, char **exp_tag, char **uri, char **recipe, psF64 *bg, psF64 *bg_stdev, psF64 *bg_mean_stdev, psF32 *sigma_ra, psF32 *sigma_dec, psS32 *nastro, char **b1_uri, char **b2_uri, ps S32 *p2_version, psS32 *p3_version)13100 bool p3ProcessedExpPop(psDB *dbh, char **exp_tag, char **uri, char **recipe, psF64 *bg, psF64 *bg_stdev, psF64 *bg_mean_stdev, psF32 *sigma_ra, psF32 *sigma_dec, psS32 *nastro, char **b1_uri, char **b2_uri, psF32 *zp_mean, psF32 *zp_stdev, psS32 *p2_version, psS32 *p3_version) 13079 13101 { 13080 13102 psArray *rowSet; … … 13186 13208 return false; 13187 13209 } 13210 *zp_mean = psMetadataLookupF32(&status, row, "zp_mean"); 13211 if (!status) { 13212 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item zp_mean"); 13213 psFree(row); 13214 return false; 13215 } 13216 *zp_stdev = psMetadataLookupF32(&status, row, "zp_stdev"); 13217 if (!status) { 13218 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item zp_stdev"); 13219 psFree(row); 13220 return false; 13221 } 13188 13222 *p2_version = psMetadataLookupS32(&status, row, "p2_version"); 13189 13223 if (!status) { … … 13206 13240 bool p3ProcessedExpInsertObject(psDB *dbh, p3ProcessedExpRow *object) 13207 13241 { 13208 return p3ProcessedExpInsert(dbh, object->exp_tag, object->uri, object->recipe, object->bg, object->bg_stdev, object->bg_mean_stdev, object->sigma_ra, object->sigma_dec, object->nastro, object->b1_uri, object->b2_uri, object-> p2_version, object->p3_version);13242 return p3ProcessedExpInsert(dbh, object->exp_tag, object->uri, object->recipe, object->bg, object->bg_stdev, object->bg_mean_stdev, object->sigma_ra, object->sigma_dec, object->nastro, object->b1_uri, object->b2_uri, object->zp_mean, object->zp_stdev, object->p2_version, object->p3_version); 13209 13243 } 13210 13244 … … 13233 13267 char b1_uri[256]; 13234 13268 char b2_uri[256]; 13269 psF32 zp_mean; 13270 psF32 zp_stdev; 13235 13271 psS32 p2_version; 13236 13272 psS32 p3_version; 13237 13273 13238 if (!p3ProcessedExpPop(dbh, (char **)&exp_tag, (char **)&uri, (char **)&recipe, &bg, &bg_stdev, &bg_mean_stdev, &sigma_ra, &sigma_dec, &nastro, (char **)&b1_uri, (char **)&b2_uri, & p2_version, &p3_version)) {13274 if (!p3ProcessedExpPop(dbh, (char **)&exp_tag, (char **)&uri, (char **)&recipe, &bg, &bg_stdev, &bg_mean_stdev, &sigma_ra, &sigma_dec, &nastro, (char **)&b1_uri, (char **)&b2_uri, &zp_mean, &zp_stdev, &p2_version, &p3_version)) { 13239 13275 psError(PS_ERR_UNKNOWN, false, "failed to pop a database row"); 13240 13276 return NULL; 13241 13277 } 13242 13278 13243 return p3ProcessedExpRowAlloc(exp_tag, uri, recipe, bg, bg_stdev, bg_mean_stdev, sigma_ra, sigma_dec, nastro, b1_uri, b2_uri, p2_version, p3_version);13279 return p3ProcessedExpRowAlloc(exp_tag, uri, recipe, bg, bg_stdev, bg_mean_stdev, sigma_ra, sigma_dec, nastro, b1_uri, b2_uri, zp_mean, zp_stdev, p2_version, p3_version); 13244 13280 } 13245 13281 … … 13392 13428 if (!psMetadataAddStr(md, PS_LIST_TAIL, "b2_uri", 0, NULL, object->b2_uri)) { 13393 13429 psError(PS_ERR_UNKNOWN, false, "failed to add item b2_uri"); 13430 psFree(md); 13431 return NULL; 13432 } 13433 if (!psMetadataAddF32(md, PS_LIST_TAIL, "zp_mean", 0, NULL, object->zp_mean)) { 13434 psError(PS_ERR_UNKNOWN, false, "failed to add item zp_mean"); 13435 psFree(md); 13436 return NULL; 13437 } 13438 if (!psMetadataAddF32(md, PS_LIST_TAIL, "zp_stdev", 0, NULL, object->zp_stdev)) { 13439 psError(PS_ERR_UNKNOWN, false, "failed to add item zp_stdev"); 13394 13440 psFree(md); 13395 13441 return NULL; … … 13423 13469 char *b1_uri; 13424 13470 char *b2_uri; 13471 psF32 zp_mean; 13472 psF32 zp_stdev; 13425 13473 psS32 p2_version; 13426 13474 psS32 p3_version; … … 13481 13529 return false; 13482 13530 } 13531 zp_mean = psMetadataLookupF32(&status, md, "zp_mean"); 13532 if (!status) { 13533 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item zp_mean"); 13534 return false; 13535 } 13536 zp_stdev = psMetadataLookupF32(&status, md, "zp_stdev"); 13537 if (!status) { 13538 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item zp_stdev"); 13539 return false; 13540 } 13483 13541 p2_version = psMetadataLookupS32(&status, md, "p2_version"); 13484 13542 if (!status) { … … 13492 13550 } 13493 13551 13494 return p3ProcessedExpRowAlloc(exp_tag, uri, recipe, bg, bg_stdev, bg_mean_stdev, sigma_ra, sigma_dec, nastro, b1_uri, b2_uri, p2_version, p3_version);13552 return p3ProcessedExpRowAlloc(exp_tag, uri, recipe, bg, bg_stdev, bg_mean_stdev, sigma_ra, sigma_dec, nastro, b1_uri, b2_uri, zp_mean, zp_stdev, p2_version, p3_version); 13495 13553 } 13496 13554 psArray *p3ProcessedExpSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit) -
trunk/ippdb/src/ippdb.h
r9301 r9307 5416 5416 char *b1_uri; 5417 5417 char *b2_uri; 5418 psF32 zp_mean; 5419 psF32 zp_stdev; 5418 5420 psS32 p2_version; 5419 5421 psS32 p3_version; … … 5437 5439 const char *b1_uri, 5438 5440 const char *b2_uri, 5441 psF32 zp_mean, 5442 psF32 zp_stdev, 5439 5443 psS32 p2_version, 5440 5444 psS32 p3_version … … 5479 5483 const char *b1_uri, 5480 5484 const char *b2_uri, 5485 psF32 zp_mean, 5486 psF32 zp_stdev, 5481 5487 psS32 p2_version, 5482 5488 psS32 p3_version … … 5512 5518 char **b1_uri, 5513 5519 char **b2_uri, 5520 psF32 *zp_mean, 5521 psF32 *zp_stdev, 5514 5522 psS32 *p2_version, 5515 5523 psS32 *p3_version -
trunk/ippdb/tests/alloc.c
r9301 r9307 949 949 p3ProcessedExpRow *object; 950 950 951 object = p3ProcessedExpRowAlloc("a string", "a string", "a string", 64.64, 64.64, 64.64, 32.32, 32.32, -32, "a string", "a string", -32, -32 );951 object = p3ProcessedExpRowAlloc("a string", "a string", "a string", 64.64, 64.64, 64.64, 32.32, 32.32, -32, "a string", "a string", 32.32, 32.32, -32, -32 ); 952 952 953 953 if (!object) { … … 996 996 } 997 997 if (strncmp(object->b2_uri, "a string", MAX_STRING_LENGTH)) { 998 psFree(object); 999 exit(EXIT_FAILURE); 1000 } 1001 if (!object->zp_mean == 32.32) { 1002 psFree(object); 1003 exit(EXIT_FAILURE); 1004 } 1005 if (!object->zp_stdev == 32.32) { 998 1006 psFree(object); 999 1007 exit(EXIT_FAILURE); -
trunk/ippdb/tests/insert.c
r9301 r9307 343 343 } 344 344 345 if (!p3ProcessedExpInsert(dbh, "a string", "a string", "a string", 64.64, 64.64, 64.64, 32.32, 32.32, -32, "a string", "a string", -32, -32)) {345 if (!p3ProcessedExpInsert(dbh, "a string", "a string", "a string", 64.64, 64.64, 64.64, 32.32, 32.32, -32, "a string", "a string", 32.32, 32.32, -32, -32)) { 346 346 exit(EXIT_FAILURE); 347 347 } -
trunk/ippdb/tests/insertobject.c
r9301 r9307 498 498 } 499 499 500 object = p3ProcessedExpRowAlloc("a string", "a string", "a string", 64.64, 64.64, 64.64, 32.32, 32.32, -32, "a string", "a string", -32, -32);500 object = p3ProcessedExpRowAlloc("a string", "a string", "a string", 64.64, 64.64, 64.64, 32.32, 32.32, -32, "a string", "a string", 32.32, 32.32, -32, -32); 501 501 if (!object) { 502 502 exit(EXIT_FAILURE); -
trunk/ippdb/tests/metadatafromobject.c
r9301 r9307 1127 1127 bool status; 1128 1128 1129 object = p3ProcessedExpRowAlloc("a string", "a string", "a string", 64.64, 64.64, 64.64, 32.32, 32.32, -32, "a string", "a string", -32, -32);1129 object = p3ProcessedExpRowAlloc("a string", "a string", "a string", 64.64, 64.64, 64.64, 32.32, 32.32, -32, "a string", "a string", 32.32, 32.32, -32, -32); 1130 1130 if (!object) { 1131 1131 exit(EXIT_FAILURE); … … 1180 1180 } 1181 1181 if (strncmp(psMetadataLookupPtr(&status, md, "b2_uri"), "a string", MAX_STRING_LENGTH)) { 1182 psFree(md); 1183 exit(EXIT_FAILURE); 1184 } 1185 if (!psMetadataLookupF32(&status, md, "zp_mean") == 32.32) { 1186 psFree(md); 1187 exit(EXIT_FAILURE); 1188 } 1189 if (!psMetadataLookupF32(&status, md, "zp_stdev") == 32.32) { 1182 1190 psFree(md); 1183 1191 exit(EXIT_FAILURE); -
trunk/ippdb/tests/objectfrommetadata.c
r9301 r9307 1757 1757 exit(EXIT_FAILURE); 1758 1758 } 1759 if (!psMetadataAddF32(md, PS_LIST_TAIL, "zp_mean", 0, NULL, 32.32)) { 1760 psFree(md); 1761 exit(EXIT_FAILURE); 1762 } 1763 if (!psMetadataAddF32(md, PS_LIST_TAIL, "zp_stdev", 0, NULL, 32.32)) { 1764 psFree(md); 1765 exit(EXIT_FAILURE); 1766 } 1759 1767 if (!psMetadataAddS32(md, PS_LIST_TAIL, "p2_version", 0, NULL, -32)) { 1760 1768 psFree(md); … … 1815 1823 } 1816 1824 if (strncmp(object->b2_uri, "a string", MAX_STRING_LENGTH)) { 1825 psFree(object); 1826 exit(EXIT_FAILURE); 1827 } 1828 if (!object->zp_mean == 32.32) { 1829 psFree(object); 1830 exit(EXIT_FAILURE); 1831 } 1832 if (!object->zp_stdev == 32.32) { 1817 1833 psFree(object); 1818 1834 exit(EXIT_FAILURE); -
trunk/ippdb/tests/pop.c
r9301 r9307 511 511 char b1_uri[256]; 512 512 char b2_uri[256]; 513 psF32 zp_mean; 514 psF32 zp_stdev; 513 515 psS32 p2_version; 514 516 psS32 p3_version; … … 519 521 } 520 522 521 if (!p3ProcessedExpPop(dbh, (char **)&exp_tag, (char **)&uri, (char **)&recipe, &bg, &bg_stdev, &bg_mean_stdev, &sigma_ra, &sigma_dec, &nastro, (char **)&b1_uri, (char **)&b2_uri, & p2_version, &p3_version)) {523 if (!p3ProcessedExpPop(dbh, (char **)&exp_tag, (char **)&uri, (char **)&recipe, &bg, &bg_stdev, &bg_mean_stdev, &sigma_ra, &sigma_dec, &nastro, (char **)&b1_uri, (char **)&b2_uri, &zp_mean, &zp_stdev, &p2_version, &p3_version)) { 522 524 exit(EXIT_FAILURE); 523 525 }
Note:
See TracChangeset
for help on using the changeset viewer.
