StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
dbStruct.hh
1 /***************************************************************************
2  *
3  * $Id: dbStruct.hh,v 1.10 2016/05/25 20:17:51 dmitry Exp $
4  *
5  * Author: R. Jeff Porter
6  ***************************************************************************
7  *
8  * Description: Simple dictionary for XML file tags
9  *
10  ***************************************************************************
11  *
12  * $Log: dbStruct.hh,v $
13  * Revision 1.10 2016/05/25 20:17:51 dmitry
14  * coverity - uninit ctor
15  *
16  * Revision 1.9 2000/01/27 05:54:35 porter
17  * Updated for compiling on CC5 + HPUX-aCC + KCC (when flags are reset)
18  * Fixed reConnect()+transaction model mismatch
19  * added some in-code comments
20  *
21  * Revision 1.8 1999/12/28 21:31:42 porter
22  * added 'using std::vector' and 'using std::list' for Solaris CC5 compilation.
23  * Also fixed some warnings arising from the CC5 compiles
24  *
25  * Revision 1.7 1999/12/07 21:25:25 porter
26  * some fixes for linux warnings
27  *
28  * Revision 1.6 1999/12/03 17:03:24 porter
29  * added multi-row support for the Xml reader & writer
30  *
31  * Revision 1.5 1999/09/30 02:06:13 porter
32  * add StDbTime to better handle timestamps, modify SQL content (mysqlAccessor)
33  * allow multiple rows (StDbTable), & Added the comment sections at top of
34  * each header and src file
35  *
36  **************************************************************************/
37 #ifndef DBSTRUCT_HH
38 #define DBSTRUCT_HH
39 
40 #include <vector>
41 
42 
43 class basic {
44 
45  public:
46 
47  virtual ~basic(){};
48  char startKey[20];
49  char endKey[20];
50  int istart = 0;
51  int iend = 0;
52  virtual void setStartKey(const char* key){ strcpy(startKey,key); };
53  virtual void setEndKey(const char* key){ strcpy(endKey,key); };
54 
55 
56 };
57 
58 class stsize : public basic {
59 
60 public:
61  int isize;
62  stsize(): isize(0) { setStartKey("<length>");
63  setEndKey("</length>") ;};
64 
65 
66 };
67 
68 class datav : public basic {
69 
70 public:
71  char* data = 0;
72  datav() { setStartKey("<value>");
73  setEndKey("</value>") ;};
74 
75 
76 };
77 
78 class elem : public basic {
79 
80  public:
81 
82  datav val;
83  char* name = 0;
84  char* type = 0;
85  stsize size;
86 
87  elem() { setStartKey("<db");
88  setEndKey("</db") ;};
89 
90 };
91 
92 #ifdef ST_NO_TEMPLATE_DEF_ARGS
93 typedef vector<elem*, allocator<elem*> > elemVec;
94 #else
95 #if !defined(ST_NO_NAMESPACES)
96 using std::vector;
97 #endif
98 typedef vector<elem*> elemVec;
99 #endif
100 
101 class accessor : public basic {
102 
103  public:
104 
105  elemVec e;
106  int nelems = 0;
107 
108  accessor() { setStartKey("<StDbAccessor>");
109  setEndKey("</StDbAccessor>");};
110  virtual ~accessor(){};
111 
112 
113 };
114 
115 
116 class dbRow : public accessor {
117 
118 public:
119 
120  int rowNumber = 0;
121  int rowID = 0;
122 
123  dbRow() { setStartKey("<TabRow>");
124  setEndKey("</TabRow>"); };
125  virtual ~dbRow(){};
126 };
127 
128 #ifdef ST_NO_TEMPLATE_DEF_ARGS
129 typedef vector<dbRow*, allocator<dbRow*> > rowVec;
130 #else
131 typedef vector<dbRow*> rowVec;
132 #endif
133 
134 class dbTable : public basic {
135 
136  public:
137 
138  accessor a;
139  rowVec row;
140  int curRow = 0;
141  int numRows = 0;
142  // elemVec e;
143  // int nelems;
144  char* name = 0;
145 
146  dbTable() { setStartKey("<StDbTable>");
147  setEndKey("</StDbTable>");};
148  virtual ~dbTable(){};
149 
150 };
151 
152 
153 #endif
154 
155 
156 
157 
158 
159 
160 
Definition: dbStruct.hh:78