Changeset 240 for vtcross/branches/fixingCBR/src/include
- Timestamp:
- 04/08/09 17:45:44 (15 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
vtcross/branches/fixingCBR/src/include/vtcross/cbr.h
r238 r240 1 // 2 // Case-based reasoner 3 // 4 // 5 // TODO REDO THIS FILE 1 /* Virginia Tech Cognitive Radio Open Source Systems 2 * Virginia Tech, 2009 3 * 4 * LICENSE INFORMATION GOES HERE 5 */ 6 7 /* TODO description of this file 8 */ 6 9 7 10 #ifndef CBR_H 8 11 #define CBR_H 9 12 13 10 14 #include "sqlite3.h" 11 //#define CBR_LEN_FILENAME 6412 15 16 17 /* TODO 18 */ 13 19 #define DATABASENAME "cactus_cbr" 14 20 15 typedef struct cbr_s * cbr; 16 17 const char * ops_str[] = { 18 "==", "!=", ">", ">=", "<", "<="}; 19 20 // create the CBR 21 cbr cbr_create(char * _filename, char * _tablename, char * _cols[], unsigned int _len); 22 23 // free the CBR 24 void cbr_free(cbr _cbr); 25 26 // print databse/table 27 void cbr_print(cbr _cbr); 28 21 /* TODO What exactly are these?? They don't appear to ever be used in the actual 22 * code? 23 */ 29 24 #define EQ 0 // equals 30 25 #define NE 1 // not equals … … 33 28 #define LT 4 // less than 34 29 #define LE 5 // less than or equal to 35 int cbr_search(cbr _cbr, char *_names[], int * _ops, float *_vals, unsigned int _n, float *_retvals);36 30 37 int cbr_add_row(cbr _cbr, char *_cols[], float *_vals, unsigned int _len);38 31 32 33 /* TODO Please explain me. 34 */ 39 35 struct cbr_s { 40 36 char filename[64]; … … 44 40 unsigned int num_columns; 45 41 }; 42 43 typedef cbr_s * cbr; 44 45 /* TODO I don't think these functions do what you want them to do. The 46 * cbr_create is returning an object by value, which means the object that is 47 * being malloc'd in the cbr_create function is effectively a memory leak, since 48 * you lose the reference to that memory, and instead return a copy of the data 49 * in that memory space. */ 50 cbr cbr_create(char * _filename, char * _tablename, char * _cols[], \ 51 unsigned int _len); 52 void cbr_free(cbr _cbr); 53 54 void cbr_print(cbr _cbr); 55 56 int cbr_search(cbr _cbr, char *_names[], int * _ops, float *_vals, \ 57 unsigned int _n, float *_retvals); 58 59 int cbr_add_row(cbr _cbr, char *_cols[], float *_vals, unsigned int _len); 46 60 47 61 … … 62 76 63 77 64 // create database65 cbr cbr_create(char * _filename, char * _tablename, char * _cols[], unsigned int _len);66 67 68 // free space69 void cbr_free(cbr _cbr);70 71 72 78 // print 73 79 void cbr_print(cbr _cbr); … … 75 81 76 82 // cbr search 77 int cbr_search( 78 cbr _cbr, 79 char *_names[], 80 int * _ops, 81 float *_vals, 82 unsigned int _n, 83 float *_retvals); 84 83 int cbr_search(cbr _cbr, char *_names[], int * _ops, float *_vals, \ 84 unsigned int _n, float *_retvals); 85 85 86 86 // update a row 87 int cbr_update(cbr _cbr, char *_where[], char*_set[], float *_wherevals, float *_setvals,88 87 int cbr_update(cbr _cbr, char *_where[], char*_set[], float *_wherevals, \ 88 float *_setvals, unsigned int _wherelen, unsigned int _setlen); 89 89 90 90 // cbr add a row