Mercurial > hg > audiodb
annotate accumulator_test.cpp @ 546:e8193805ce42 multiprobeLSH
Rework new audiodb_track_id_datum_offset() and audiodb_insert_create_datum_offset() so that all offsets are in num_vectors. Internals of data storage are left the the methods to implement. If we are going to export these methods to the API, how do we expose the cache ? It needs to be passed back to the user and back in by the user on each call for caching to be re-entrant. No (intentional) functional changes this version.
author | mas01mc |
---|---|
date | Sun, 08 Feb 2009 22:32:33 +0000 |
parents | 342822c2d49a |
children |
rev | line source |
---|---|
mas01cr@498 | 1 #include "audioDB.h" |
mas01cr@498 | 2 extern "C" { |
mas01cr@498 | 3 #include "audioDB_API.h" |
mas01cr@498 | 4 } |
mas01cr@498 | 5 #include "audioDB-internals.h" |
mas01cr@498 | 6 |
mas01cr@498 | 7 #include "accumulators.h" |
mas01cr@498 | 8 |
mas01cr@498 | 9 static NearestAccumulator<adb_result_dist_lt> *foo = new NearestAccumulator<adb_result_dist_lt>(); |
mas01cr@498 | 10 |
mas01cr@498 | 11 int main() { |
mas01cr@498 | 12 adb_result_t r; |
mas01cr@498 | 13 r.key = "hello"; |
mas01cr@498 | 14 r.ipos = 0; |
mas01cr@498 | 15 r.qpos = 0; |
mas01cr@498 | 16 r.dist = 3; |
mas01cr@498 | 17 foo->add_point(&r); |
mas01cr@498 | 18 r.ipos = 1; |
mas01cr@498 | 19 r.dist = 2; |
mas01cr@498 | 20 foo->add_point(&r); |
mas01cr@498 | 21 r.qpos = 1; |
mas01cr@498 | 22 foo->add_point(&r); |
mas01cr@498 | 23 |
mas01cr@498 | 24 adb_query_results_t *rs; |
mas01cr@498 | 25 rs = foo->get_points(); |
mas01cr@498 | 26 for (unsigned int k = 0; k < rs->nresults; k++) { |
mas01cr@498 | 27 r = rs->results[k]; |
mas01cr@498 | 28 printf("%s: %f %u %u\n", r.key, r.dist, r.qpos, r.ipos); |
mas01cr@498 | 29 } |
mas01cr@498 | 30 free(rs->results); |
mas01cr@498 | 31 free(rs); |
mas01cr@498 | 32 delete foo; |
mas01cr@498 | 33 return 1; |
mas01cr@498 | 34 } |