changeset 670:684339bb8d21

Remove most backwards-compatibility cruft from audioDB_API.h "most": audiodb_insert() and audiodb_batchinsert(), along with adb_insert_t, are still there, basically because the distinction between LARGE_ADB and "normal" isn't exposed properly.
author mas01cr
date Fri, 05 Mar 2010 16:00:44 +0000
parents 780ebab29268
children 537bfd7e15a1
files audioDB_API.h
diffstat 1 files changed, 19 insertions(+), 66 deletions(-) [+]
line wrap: on
line diff
--- a/audioDB_API.h	Wed Mar 03 17:17:08 2010 +0000
+++ b/audioDB_API.h	Fri Mar 05 16:00:44 2010 +0000
@@ -16,36 +16,29 @@
 /*******************************************************************/
 /* Data types for API */
 
-/* The main struct that stores the name of the database, and in future will hold all
- * kinds of other interesting information */
-/* This basically gets passed around to all of the other functions */
-
 /* FIXME: it might be that "adb_" isn't such a good prefix to use, and
    that we should prefer "audiodb_".  Or else maybe we should be
    calling ourselves libadb? */
-typedef struct adb adb_t, *adb_ptr;
+typedef struct adb adb_t;
 
-struct adb_datum {
+typedef struct adb_datum {
   uint32_t nvectors;
   uint32_t dim;
   const char *key;
   double *data;
   double *power;
   double *times;
-};
-typedef struct adb_datum adb_datum_t;
+} adb_datum_t;
 
-//used for both insert and batchinsert
-struct adbinsert {
+typedef struct adb_reference {
   const char *features;
   const char *power;
   const char *key;
   const char *times;
-};
-typedef struct adbinsert adb_insert_t, adb_reference_t, *adb_insert_ptr;
+} adb_reference_t, adb_insert_t;
 
 /* struct for returning status results */
-struct adbstatus {
+typedef struct adb_status {
     unsigned int numFiles;  
     unsigned int dim;
     unsigned int dudCount;
@@ -53,50 +46,9 @@
     unsigned int flags;
     uint64_t length;
     uint64_t data_region_size;
-};
-typedef struct adbstatus adb_status_t, *adb_status_ptr;
+} adb_status_t;
 
-/* needed for constructing a query */
-struct adbquery {
-
-    char * querytype;
-    char * feature; //usually a file of some kind
-    char * key;
-    char * power; //also a file
-    char * keylist; //also a file
-    char * qpoint;  //position 
-    char * numpoints;
-    char * radius; 
-    char * resultlength; //how many results to make
-    char * sequencelength; 
-    char * sequencehop; 
-    double absolute_threshold; 
-    double relative_threshold;
-    int exhaustive; //hidden option in gengetopt
-    double expandfactor; //hidden
-    int rotate; //hidden
-
-};
-typedef struct adbquery adb_query_t,*adb_query_ptr;
-
-/* ... and for getting query results back */
-struct adbqueryresult {
-
-    int sizeRlist; /* do I really need to return all 4 sizes here */
-    int sizeDist;
-    int sizeQpos;
-    int sizeSpos;
-    char **Rlist;
-    double *Dist;
-    unsigned int *Qpos;
-    unsigned int *Spos;
-
-};
-typedef struct adbqueryresult adb_queryresult_t, *adb_queryresult_ptr;
-
-/* New ("new" == December 2008) query API */
-
-typedef struct adbresult {
+typedef struct adb_result {
   const char *key;
   double dist;
   uint32_t qpos;
@@ -178,42 +130,43 @@
 
 /* open an existing database */
 /* returns a struct or NULL on failure */
-adb_ptr audiodb_open(const char *path, int flags);
+adb_t *audiodb_open(const char *path, int flags);
 
 /* create a new database */
 /* returns a struct or NULL on failure */
-adb_ptr audiodb_create(const char *path, unsigned datasize, unsigned ntracks, unsigned datadim);
+adb_t *audiodb_create(const char *path, unsigned datasize, unsigned ntracks, unsigned datadim);
 
 /* close a database */
-void audiodb_close(adb_ptr db);
+void audiodb_close(adb_t *adb);
 
 /* You'll need to turn both of these on to do anything useful */
-int audiodb_l2norm(adb_ptr mydb);
-int audiodb_power(adb_ptr mydb);
+int audiodb_l2norm(adb_t *adb);
+int audiodb_power(adb_t *adb);
 
 /* insert functions */
 int audiodb_insert_datum(adb_t *, const adb_datum_t *);
 int audiodb_insert_reference(adb_t *, const adb_reference_t *);
-int audiodb_insert(adb_ptr mydb, adb_insert_ptr ins);
-int audiodb_batchinsert(adb_ptr mydb, adb_insert_ptr ins, unsigned int size);
 
 /* query function */
-int audiodb_query(adb_ptr mydb, adb_query_ptr adbq, adb_queryresult_ptr adbqres);
 adb_query_results_t *audiodb_query_spec(adb_t *, const adb_query_spec_t *);
 int audiodb_query_free_results(adb_t *, const adb_query_spec_t *, adb_query_results_t *);
 
 /* database status */  
-int audiodb_status(adb_ptr mydb, adb_status_ptr status);
+int audiodb_status(adb_t *, adb_status_t *status);
 
 /* retrieval of inserted data */
 int audiodb_retrieve_datum(adb_t *, const char *, adb_datum_t *);
 int audiodb_free_datum(adb_t *, adb_datum_t *);
 
 /* various dump formats */
-int audiodb_dump(adb_ptr mydb, const char *outputdir);
+int audiodb_dump(adb_t *, const char *outputdir);
 
 /* liszt */
 adb_liszt_results_t *audiodb_liszt(adb_t *);
 int audiodb_liszt_free_results(adb_t *, adb_liszt_results_t *);
 
+/* backwards compatibility */
+int audiodb_insert(adb_t *, adb_insert_t *ins);
+int audiodb_batchinsert(adb_t *, adb_insert_t *ins, unsigned int size);
+
 #endif