root/vtcross/branches/fixingCBR/src/include/vtcross/cbr.h @ 240

Revision 240, 2.1 KB (checked in by bhilburn, 15 years ago)

First pass at making cbr.h readable.

Line 
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
33/* TODO  Please explain me.
34 */
35struct cbr_s {
36    char filename[64];
37    char tablename[64];
38    char command[2048];
39    sqlite3 *db;
40    unsigned int num_columns;
41};
42
43typedef 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. */
50cbr cbr_create(char * _filename, char * _tablename, char * _cols[], \
51        unsigned int _len);
52void cbr_free(cbr _cbr);
53
54void cbr_print(cbr _cbr);
55
56int cbr_search(cbr _cbr, char *_names[], int * _ops, float *_vals, \
57        unsigned int _n, float *_retvals);
58
59int cbr_add_row(cbr _cbr, char *_cols[], float *_vals, unsigned int _len);
60
61
62// open a database or create a database if it does not exist
63int OpenDatabase(cbr _cbr);
64
65
66// simple callback function, display result
67int callback(void *notUsed, int argc, char **argv, char **azColName);
68
69
70// execute command
71int ExecuteCommand(cbr _cbr);
72
73
74// execute search command
75int ExecuteSearchCommand(cbr _cbr, float *_retvals);
76
77
78// print
79void cbr_print(cbr _cbr);
80
81
82// cbr search
83int cbr_search(cbr _cbr, char *_names[], int * _ops, float *_vals, \
84        unsigned int _n, float *_retvals);
85
86// update a row
87int cbr_update(cbr _cbr, char *_where[], char*_set[], float *_wherevals, \
88        float *_setvals, unsigned int _wherelen, unsigned int _setlen);
89
90// cbr add a row
91int cbr_add_row(cbr _cbr, char *_cols[], float *_vals, unsigned int _len);
92
93#endif
Note: See TracBrowser for help on using the browser.