comparison audioDB.cpp @ 171:bb934f91d85c powertable

Web services interface to the powertable functionality. * Implemented as a completely new SOAP method, called sequenceQuery * lightly tested with http://doc.gold.ac.uk/~mas01cr/poweradb.php (lacuna: need to pass relative-threshold and absolute-threshold always, even when they don't make sense.) Several uglinesses in the code, some of which will be resolved once all the various branches are merged into the trunk.
author mas01cr
date Wed, 14 Nov 2007 14:00:53 +0000
parents 9ec0f27e07b9
children
comparison
equal deleted inserted replaced
163:9dbff8fea81d 171:bb934f91d85c
2781 soap_receiver_fault(soap, err, ""); 2781 soap_receiver_fault(soap, err, "");
2782 return SOAP_FAULT; 2782 return SOAP_FAULT;
2783 } 2783 }
2784 } 2784 }
2785 2785
2786 int adb__sequenceQuery(struct soap* soap, xsd__string dbName, xsd__string qKey,
2787 adb__sequenceQueryParms *parms,
2788 adb__queryResponse &adbQueryResponse) {
2789
2790 char qPosStr[256];
2791 char pointNNStr[256];
2792 char trackNNStr[256];
2793 char seqLenStr[256];
2794 char relative_thresholdStr[256];
2795 char absolute_thresholdStr[256];
2796
2797 /* When the branch is merged, move this to a header and use it
2798 elsewhere */
2799 #define INTSTRINGIFY(val, str) \
2800 snprintf(str, 256, "%d", val);
2801 #define DOUBLESTRINGIFY(val, str) \
2802 snprintf(str, 256, "%f", val);
2803
2804 INTSTRINGIFY(parms->qPos, qPosStr);
2805 INTSTRINGIFY(parms->pointNN, pointNNStr);
2806 INTSTRINGIFY(parms->segNN, trackNNStr);
2807 /* FIXME: decide which of segLen and seqLen should live */
2808 INTSTRINGIFY(parms->segLen, seqLenStr);
2809
2810 DOUBLESTRINGIFY(parms->relative_threshold, relative_thresholdStr);
2811 DOUBLESTRINGIFY(parms->absolute_threshold, absolute_thresholdStr);
2812
2813 const char *argv[] = {
2814 "./audioDB",
2815 COM_QUERY,
2816 "sequence",
2817 COM_DATABASE,
2818 dbName,
2819 COM_FEATURES,
2820 qKey,
2821 COM_KEYLIST,
2822 /* FIXME: when this branch is merged, use ENSURE_STRING */
2823 parms->keyList==0?"":parms->keyList,
2824 COM_TIMES,
2825 parms->timesFileName==0?"":parms->timesFileName,
2826 COM_QUERYPOWER,
2827 parms->powerFileName==0?"":parms->powerFileName,
2828 COM_QPOINT,
2829 qPosStr,
2830 COM_POINTNN,
2831 pointNNStr,
2832 COM_TRACKNN,
2833 trackNNStr,
2834 COM_SEQLEN,
2835 seqLenStr,
2836 COM_RELATIVE_THRESH,
2837 relative_thresholdStr,
2838 COM_ABSOLUTE_THRESH,
2839 absolute_thresholdStr
2840 };
2841
2842 const unsigned argc = 25;
2843
2844 try {
2845 audioDB(argc, (char* const*)argv, &adbQueryResponse);
2846 return SOAP_OK;
2847 } catch (char *err) {
2848 soap_receiver_fault(soap, err, "");
2849 return SOAP_FAULT;
2850 }
2851 }
2852
2786 int main(const unsigned argc, char* const argv[]){ 2853 int main(const unsigned argc, char* const argv[]){
2787 audioDB(argc, argv); 2854 audioDB(argc, argv);
2788 } 2855 }
2789