comparison audioDB_API.h @ 355:94c18f128ce8

First version of the API, committed to the main trunk. Thanks Christophe, for all the help!
author mas01ik
date Wed, 12 Nov 2008 10:21:06 +0000
parents
children 8749d5bf6361
comparison
equal deleted inserted replaced
354:4871a3ed9e36 355:94c18f128ce8
1 /* for API questions contact
2 * Christophe Rhodes c.rhodes@gold.ac.uk
3 * Ian Knopke mas01ik@gold.ac.uk, ian.knopke@gmail.com */
4
5
6 /*******************************************************************/
7 /* Data types for API */
8
9 /* The main struct that stores the name of the database, and in future will hold all
10 * kinds of other interesting information */
11 /* This basically gets passed around to all of the other functions */
12 struct adb {
13
14 char * dbname;
15 unsigned int ntracks; /* number of tracks */
16 unsigned int datadim; /* dimensionality of stored data */
17
18 };
19 typedef struct adb adb_t, *adb_ptr;
20
21 //used for both insert and batchinsert
22 struct adbinsert {
23
24 char * features;
25 char * power;
26 char * key;
27 char * times;
28
29 };
30 typedef struct adbinsert adb_insert_t, *adb_insert_ptr;
31
32 /* struct for returning status results */
33 struct adbstatus {
34
35 unsigned int numFiles;
36 unsigned int dim;
37 unsigned int length;
38 unsigned int dudCount;
39 unsigned int nullCount;
40 unsigned int flags;
41
42 };
43 typedef struct adbstatus adb_status_t, *adb_status_ptr;
44
45 /* needed for constructing a query */
46 struct adbquery {
47
48 char * querytype;
49 char * feature; //usually a file of some kind
50 char * power; //also a file
51 char * keylist; //also a file
52 char * qpoint; //position
53 char * numpoints;
54 char * radius;
55 char * resultlength; //how many results to make
56 char * sequencelength;
57 char * sequencehop;
58 double absolute_threshold;
59 double relative_threshold;
60 int exhaustive; //hidden option in gengetopt
61 double expandfactor; //hidden
62 int rotate; //hidden
63
64 };
65 typedef struct adbquery adb_query_t,*adb_query_ptr;
66
67 /* ... and for getting query results back */
68 struct adbqueryresult {
69
70 int sizeRlist; /* do I really need to return all 4 sizes here */
71 int sizeDist;
72 int sizeQpos;
73 int sizeSpos;
74 char **Rlist;
75 double *Dist;
76 unsigned int *Qpos;
77 unsigned int *Spos;
78
79 };
80 typedef struct adbqueryresult adb_queryresult_t, *adb_queryresult_ptr;
81
82
83 /*******************************************************************/
84 /* Function prototypes for API */
85
86
87 /* open an existing database */
88 /* returns a struct or NULL on failure */
89 adb_ptr audiodb_open(char * path);
90
91 /* create a new database */
92 /* returns a struct or NULL on failure */
93 //adb_ptr audiodb_create(char * path,long ntracks, long datadim);
94 adb_ptr audiodb_create(char * path,long datasize, long ntracks, long datadim);
95
96 /* close a database */
97 void audiodb_close(adb_ptr db);
98
99 /* You'll need to turn both of these on to do anything useful */
100 int audiodb_l2norm(adb_ptr mydb);
101 int audiodb_power(adb_ptr mydb);
102
103 /* insert functions */
104 int audiodb_insert(adb_ptr mydb, adb_insert_ptr ins);
105 int audiodb_batchinsert(adb_ptr mydb, adb_insert_ptr ins, unsigned int size);
106
107 /* query function */
108 int audiodb_query(adb_ptr mydb, adb_query_ptr adbq, adb_queryresult_ptr adbqres);
109
110 /* database status */
111 int audiodb_status(adb_ptr mydb, adb_status_ptr status);
112
113 /* varoius dump formats */
114 int audiodb_dump(adb_ptr mydb);
115 int audiodb_dump_withdir(adb_ptr mydb, char * outputdir);
116
117