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 | */ |
---|
9 | |
---|
10 | #ifndef CBR_H |
---|
11 | #define CBR_H |
---|
12 | |
---|
13 | |
---|
14 | #include "sqlite3.h" |
---|
15 | |
---|
16 | |
---|
17 | /* TODO |
---|
18 | */ |
---|
19 | #define DATABASENAME "cactus_cbr" |
---|
20 | |
---|
21 | /* TODO What exactly are these?? They don't appear to ever be used in the actual |
---|
22 | * code? |
---|
23 | */ |
---|
24 | #define EQ 0 // equals |
---|
25 | #define NE 1 // not equals |
---|
26 | #define GT 2 // greater than |
---|
27 | #define GE 3 // greater than or equal to |
---|
28 | #define LT 4 // less than |
---|
29 | #define LE 5 // less than or equal to |
---|
30 | |
---|
31 | |
---|
32 | /* TODO Please explain me. |
---|
33 | */ |
---|
34 | struct cbr_s { |
---|
35 | char filename[64]; |
---|
36 | char tablename[64]; |
---|
37 | char command[2048]; |
---|
38 | sqlite3 *db; |
---|
39 | unsigned int num_columns; |
---|
40 | }; |
---|
41 | |
---|
42 | /* TODO This is a terribly hackish way to go about this. Why not just use actual |
---|
43 | * pointers? Typedefing the pointer out makes the code misleading and hard to |
---|
44 | * understand. |
---|
45 | */ |
---|
46 | typedef cbr_s * cbr; |
---|
47 | |
---|
48 | |
---|
49 | /* TODO I don't think these functions do what you want them to do. The |
---|
50 | * cbr_create is returning an object by value, which means the object that is |
---|
51 | * being malloc'd in the cbr_create function is effectively a memory leak, since |
---|
52 | * you lose the reference to that memory, and instead return a copy of the data |
---|
53 | * in that memory space. |
---|
54 | */ |
---|
55 | cbr cbr_create(char * _filename, char * _tablename, char * _cols[], \ |
---|
56 | unsigned int _len); |
---|
57 | |
---|
58 | void cbr_free(cbr _cbr); |
---|
59 | |
---|
60 | /* Opens a database, or creates a new one if it does not exist, with the name |
---|
61 | * stored within the passed cbr struct object. |
---|
62 | */ |
---|
63 | int OpenDatabase(cbr _cbr); |
---|
64 | |
---|
65 | /* TODO What is this for? |
---|
66 | */ |
---|
67 | int callback(void *notUsed, int argc, char **argv, char **azColName); |
---|
68 | |
---|
69 | /* TODO |
---|
70 | */ |
---|
71 | int ExecuteCommand(cbr _cbr); |
---|
72 | |
---|
73 | /* TODO |
---|
74 | */ |
---|
75 | int ExecuteSearchCommand(cbr _cbr, float *_retvals); |
---|
76 | |
---|
77 | /* TODO |
---|
78 | */ |
---|
79 | void cbr_print(cbr _cbr); |
---|
80 | |
---|
81 | /* TODO |
---|
82 | */ |
---|
83 | int cbr_search(cbr _cbr, char *_names[], int * _ops, float *_vals, \ |
---|
84 | unsigned int _n, float *_retvals); |
---|
85 | |
---|
86 | /* TODO |
---|
87 | */ |
---|
88 | int cbr_add_row(cbr _cbr, char *_cols[], float *_vals, unsigned int _len); |
---|
89 | |
---|
90 | /* TODO |
---|
91 | */ |
---|
92 | int cbr_update(cbr _cbr, char *_where[], char*_set[], float *_wherevals, \ |
---|
93 | float *_setvals, unsigned int _wherelen, unsigned int _setlen); |
---|
94 | |
---|
95 | |
---|
96 | #endif |
---|