Particle Identification and Tracking
sql_handler.h
Go to the documentation of this file.
1 //Copyright 2010 Thomas A Caswell
2 //tcaswell@uchicago.edu
3 //http://jfi.uchicago.edu/~tcaswell
4 //
5 //This program is free software; you can redistribute it and/or modify
6 //it under the terms of the GNU General Public License as published by
7 //the Free Software Foundation; either version 3 of the License, or (at
8 //your option) any later version.
9 //
10 //This program is distributed in the hope that it will be useful, but
11 //WITHOUT ANY WARRANTY; without even the implied warranty of
12 //MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 //General Public License for more details.
14 //
15 //You should have received a copy of the GNU General Public License
16 //along with this program; if not, see <http://www.gnu.org/licenses>.
17 
18 #ifndef SQL_HANDLER
19 #define SQL_HANDLER
20 
21 #include<string>
22 
23 // forward definition of sqlite3 class do get around include the header for sqlite3 in
24 // a lot of my code.
25 struct sqlite3;
26 
27 
28 namespace utilities
29 {
30 class Md_store;
31 
38 typedef enum F_TYPE{
40  F_IDEN = 1,
42  F_GOFR = 3,
43  F_GOFR3D = 4,
45  F_LINK3D = 6,
46  F_MSD = 7,
47  F_PHI6 = 8,
49  F_TRACKING = 10,
50  F_VANHOVE = 11,
52 }F_TYPE;
53 
54 
55 
56 std::string ftype_to_str(F_TYPE f);
57 
58 
65 {
66 public:
71  SQL_handler();
75  ~SQL_handler();
76 
77 
82  void open_connection(const std::string& db_name);
83 
87  void close_connection();
88 
101  int start_comp(int dset_key,
102  int & comp_key,
103  F_TYPE f_type
104  );
105 
109  void add_mdata(const Md_store & md_store);
110 
118  void commit();
125  void rollback();
126 
127 
131  void make_test_db(std::string fname = "");
132 
136  void get_comp_mdata(int comp_key,Md_store & md_store,std::string table_name);
137 
138 protected:
139  void iden_md_fun( const Md_store& md_store);
140  void tracking_md_fun( const Md_store & md_store);
141  void msd_md_fun( const Md_store & md_store);
142  void gofr_md_fun( const Md_store & md_store);
143  void vanHove_md_fun( const Md_store & md_store);
144  void gofr_by_plane_md_fun(const Md_store & md_store);
145  void msd_sweep_md_fun( const Md_store & md_store);
146  void phi6_md_fun( const Md_store & md_store);
147 
148 
149 private:
153  sqlite3 * db_;
154 
167 
172 
173 };
174 
175 }
176 
177 
178 #endif