diff audioDB.cpp @ 277:abfb26e08d9c audiodb-debian

Merge trunk changes -r326:386 into audiodb-debian branch. Plus new debian/changelog version. (Should have used an epoch really, but couldn't be bothered; TODO: work out a sane version numbering policy).
author mas01cr
date Tue, 01 Jul 2008 09:12:40 +0000
parents 15b8ff55ea5b
children
line wrap: on
line diff
--- a/audioDB.cpp	Mon Dec 17 16:44:37 2007 +0000
+++ b/audioDB.cpp	Tue Jul 01 09:12:40 2008 +0000
@@ -136,10 +136,32 @@
   }
 
   if(args_info.size_given) {
+    if(args_info.datasize_given) {
+      error("both --size and --datasize given", "");
+    }
+    if(args_info.ntracks_given) {
+      error("both --size and --ntracks given", "");
+    }
+    if(args_info.datadim_given) {
+      error("both --size and --datadim given", "");
+    }
     if (args_info.size_arg < 50 || args_info.size_arg > 32000) {
       error("Size out of range", "");
     }
-    size = (off_t) args_info.size_arg * 1000000;
+    double ratio = (double) args_info.size_arg * 1000000 / ((double) O2_DEFAULTDBSIZE);
+    /* FIXME: what's the safe way of doing this? */
+    datasize = (unsigned int) ceil(datasize * ratio);
+    ntracks = (unsigned int) ceil(ntracks * ratio);
+  } else {
+    if(args_info.datasize_given) {
+      datasize = args_info.datasize_arg;
+    }
+    if(args_info.ntracks_given) {
+      ntracks = args_info.ntracks_arg;
+    }
+    if(args_info.datadim_given) {
+      datadim = args_info.datadim_arg;
+    }
   }
 
   if(args_info.radius_given) {
@@ -306,6 +328,10 @@
       queryType=O2_POINT_QUERY;
     else if(strncmp(args_info.QUERY_arg, "sequence", MAXSTR)==0)
       queryType=O2_SEQUENCE_QUERY;
+    else if(strncmp(args_info.QUERY_arg, "nsequence", MAXSTR)==0)
+      queryType=O2_N_SEQUENCE_QUERY;
+    else if(strncmp(args_info.QUERY_arg, "onetoonensequence", MAXSTR)==0)
+      queryType=O2_ONE_TO_ONE_N_SEQUENCE_QUERY;
     else
       error("unsupported query type",args_info.QUERY_arg);
     
@@ -317,12 +343,12 @@
     }
     
     pointNN = args_info.pointnn_arg;
-    if(pointNN < 1 || pointNN > 1000) {
-      error("pointNN out of range: 1 <= pointNN <= 1000");
+    if(pointNN < 1 || pointNN > O2_MAXNN) {
+      error("pointNN out of range: 1 <= pointNN <= 1000000");
     }
     trackNN = args_info.resultlength_arg;
-    if(trackNN < 1 || trackNN > 1000) {
-      error("resultlength out of range: 1 <= resultlength <= 1000");
+    if(trackNN < 1 || trackNN > O2_MAXNN) {
+      error("resultlength out of range: 1 <= resultlength <= 1000000");
     }
     sequenceLength = args_info.sequencelength_arg;
     if(sequenceLength < 1 || sequenceLength > 1000) {