diff audioDB.h @ 280:3be15407e814

Merge sampling branch (-r361:405, though I hope that the branch is now finished) onto trunk. API developers take note. Things still to clear up: * whether the threshold distance it currently reports bears any relation to reality; * if not, how to bring it a bit more into alignment; * minor code cleanup issues in sample.cpp; * incorporating --absolute-threshold handling into sampling; * writing suitable test cases.
author mas01cr
date Wed, 02 Jul 2008 14:07:10 +0000
parents 210b2f661b88
children cacad987d785
line wrap: on
line diff
--- a/audioDB.h	Mon Jun 30 17:38:59 2008 +0000
+++ b/audioDB.h	Wed Jul 02 14:07:10 2008 +0000
@@ -12,6 +12,7 @@
 #include <assert.h>
 #include <float.h>
 #include <signal.h>
+#include <gsl/gsl_rng.h>
 
 // includes for web services
 #include "soapH.h"
@@ -29,6 +30,7 @@
 #define COM_POWER "--POWER"
 #define COM_DUMP "--DUMP"
 #define COM_SERVER "--SERVER"
+#define COM_SAMPLE "--SAMPLE"
 
 // parameters
 #define COM_CLIENT "--client"
@@ -176,6 +178,8 @@
   // Flags and parameters
   unsigned verbosity;   // how much do we want to know?
 
+  unsigned nsamples;
+
   //off_t size; // given size (for creation)
   unsigned datasize; // size in MB
   unsigned ntracks;
@@ -247,6 +251,8 @@
   void batchinsert(const char* dbName, const char* inFile);
   void query(const char* dbName, const char* inFile, adb__queryResponse *adbQueryResponse=0);
   void status(const char* dbName, adb__statusResponse *adbStatusResponse=0);
+  unsigned random_track(unsigned *propTable, unsigned total, gsl_rng *);
+  void sample(const char *dbName);
   void ws_status(const char*dbName, char* hostport);
   void ws_query(const char*dbName, const char *trackKey, const char* hostport);
   void l2norm(const char* dbName);
@@ -291,6 +297,7 @@
   powerTableLength(0), \
   l2normTableLength(0), \
   verbosity(1), \
+  nsamples(2000), \
   datasize(O2_DEFAULT_DATASIZE), \
   ntracks(O2_DEFAULT_NTRACKS), \
   datadim(O2_DEFAULT_DATADIM), \