annotate accumulator_test.cpp @ 498:342822c2d49a

Merge api-inversion branch (-r656:771, but I don't expect to return to that branch) into the trunk. I expect there to be minor performance regressions (e.g. in the SOAP server index cacheing, which I have forcibly removed) and minor unplugged memory leaks (e.g. in audioDB::query(), where I don't free up the datum). I hope that these leaks and performance regressions can be plugged in short order. I also expect that some (but maybe not all) of the issues currently addressed in the memory-leaks branch are superseded or fixed by this merge. There remains much work to be done; go forth and do it.
author mas01cr
date Sat, 10 Jan 2009 16:47:57 +0000
parents
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 }