ATLAS Offline Software
GenericDbTable.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 #include <cstdlib>
7 #include <climits>
8 #include <cfloat>
9 #include <algorithm> //count_if
10 
11 #define NULLINT -INT_MAX
12 #define NULLFLOAT -FLT_MAX
13 #define NULLDOUBLE -DBL_MAX
14 // DRQ: This is temporary hack while I think of a better way of doing this
15 #if defined __APPLE__
16 #define NULLLONG -__LONG_LONG_MAX__
17 #else
18 #define NULLLONG -LONG_LONG_MAX
19 #endif
20 #define atoi64(x) atoll(x)
21 
22 
23 using std::cerr;
24 using std::endl;
25 using std::string;
26 using std::vector;
27 
28 GenericDbTable::GenericDbTable(unsigned n_columns, int n_rows):m_numRows(n_rows)
29 {
30 
31  m_numRows=0;
32  m_isInitialized = false;
33  unsigned i;
34 
35  for (i=0;i<n_columns; i++)
36  m_conddbtable.push_back(new CondDBColumn);
37 
38  for (i = 0; i<m_conddbtable.size(); i++ )
39  {
40  m_conddbtable[i]->initialized = false;
41  m_conddbtable[i]->type = kNull;
42  }
43 
44  if (n_rows)
45  {
46  resize(n_rows);
47  // status = vector<CondDBStatus>(n_rows,untouched);
48  }
49 }
50 
51 
52 
54 {
55  for (unsigned i=0; i< m_conddbtable.size(); i++)
56  {
57  delete m_conddbtable[i];
58  }
59 }
60 
61 void GenericDbTable::Initialize(unsigned n_columns, int n_rows)
62 {
63  unsigned i;
64 
65  if (m_conddbtable.size() > 0 || m_isInitialized == true)
66  return;
67 
68  for (i=0;i<n_columns; i++)
69  m_conddbtable.push_back(new CondDBColumn);
70 
71  for (i = 0; i<m_conddbtable.size(); i++ )
72  {
73  m_conddbtable[i]->initialized = false;
74  m_conddbtable[i]->type = kNull;
75  }
76 
77  if (n_rows)
78  {
79  resize(n_rows);
80 // status = vector<CondDBStatus>(n_rows,untouched);
81  }
82 }
83 
84 
86 {
87  if (!m_isInitialized)
88  return CDB_NOT_INITIALIZED;
89 
90  for (unsigned i = 0; i < m_conddbtable.size(); i++)
91  {
92  names.push_back(m_conddbtable[i]->name);
93  }
94 
95  return 0;
96 }
97 
98 int GenericDbTable::getTypes(vector<dataTypes> &types) const
99 {
100  if (!m_isInitialized)
101  return CDB_NOT_INITIALIZED;
102 
103  for (unsigned i = 0; i < m_conddbtable.size(); i++)
104  {
105  types.push_back(m_conddbtable[i]->type);
106  }
107  return 0;
108 }
109 
110 
111 int GenericDbTable::getRowID(std::string &pID) const
112 {
113  std::vector<std::string> names;
114  unsigned int ncolumn = 0;
115 
116  if (getNames(names) != CDB_NOT_INITIALIZED) { //success
117  ncolumn = std::count_if(names.begin(),names.end(), [](const auto & s){return s != "Id";} );
118 
119  // if the table does not have id's
120  if (ncolumn == names.size())
121  return -1;
122 
123  CondDBColumnString *dcolumn = static_cast<CondDBColumnString*>(m_conddbtable[ncolumn]);
124 
125  for (unsigned int i = 0; i < dcolumn->column.size(); i++) {
126  if (dcolumn->column[i] == pID) {
127  return i;
128  }
129  }
130  }
131  // if the execution is here it means that the id doesn't exist in the column
132  return -1;
133 
134 }
135 
136 // when the argument is a string there must be done a spetial treatment
137 int GenericDbTable::getNull(unsigned n_column, string &null) const
138 {
139  if (!m_isInitialized)
140  return CDB_NOT_INITIALIZED;
141 
142  if (m_conddbtable.size() > n_column)
143  {
144  switch (m_conddbtable[n_column]->type)
145  {
146  case kString:
147  {
148  CondDBColumnString *tmpColumn = static_cast<CondDBColumnString*>(m_conddbtable[n_column]);
149  return __getNull(null, tmpColumn);
150  }
151  case kArrayString:
152  {
154  CondDBColumnArrayString *tmpColumn = static_cast<CondDBColumnArrayString*>(m_conddbtable[n_column]);
155  __getNull(tmp, tmpColumn);
156  null = tmp[0];
157  return CDB_SUCCESS;
158  }
159  case kFloat:
160  {
161  float tmp;
162  CondDBColumnFloat *tmpColumn = static_cast<CondDBColumnFloat*>(m_conddbtable[n_column]);
163  __getNull(tmp, tmpColumn);
164  null = ToString<float>(tmp);
165  return CDB_SUCCESS;
166  }
167  case kArrayFloat:
168  {
170  CondDBColumnArrayFloat *tmpColumn = static_cast<CondDBColumnArrayFloat*>(m_conddbtable[n_column]);
171  __getNull(tmp, tmpColumn);
172  null = ToString<float>(tmp[0]);
173  return CDB_SUCCESS;
174  }
175  case kInt:
176  {
177  long int tmp;
178  CondDBColumnInt *tmpColumn = static_cast<CondDBColumnInt*>(m_conddbtable[n_column]);
179  __getNull(tmp, tmpColumn);
180  null = ToString<float>(tmp);
181  return CDB_SUCCESS;
182  }
183  case kArrayInt:
184  {
185  vector<long int> tmp;
186  CondDBColumnArrayInt *tmpColumn = static_cast<CondDBColumnArrayInt*>(m_conddbtable[n_column]);
187  __getNull(tmp, tmpColumn);
188  null = ToString(tmp[0]);
189  return CDB_SUCCESS;
190  }
191  case kDouble:
192  {
193  double tmp;
194  CondDBColumnDouble *tmpColumn = static_cast<CondDBColumnDouble*>(m_conddbtable[n_column]);
195  __getNull(tmp, tmpColumn);
196  null = ToString(tmp);
197  return CDB_SUCCESS;
198  }
199  case kArrayDouble:
200  {
202  CondDBColumnArrayDouble *tmpColumn = static_cast<CondDBColumnArrayDouble*>(m_conddbtable[n_column]);
203  __getNull(tmp, tmpColumn);
204  null = ToString(tmp[0]);
205  return CDB_SUCCESS;
206  }
207  case kLongLong:
208  {
209  int64 tmp;
210  CondDBColumnLong *tmpColumn = static_cast<CondDBColumnLong*>(m_conddbtable[n_column]);
211  __getNull(tmp, tmpColumn);
212  null = ToString(tmp);
213  return CDB_SUCCESS;
214  }
215  case kArrayLongLong:
216  {
217  vector<int64> tmp;
218  CondDBColumnArrayLong *tmpColumn = static_cast<CondDBColumnArrayLong*>(m_conddbtable[n_column]);
219  __getNull(tmp, tmpColumn);
220  null = ToString(tmp[0]);
221  return CDB_SUCCESS;
222  }
223  case kBool:
224  case kArrayBool:
225  {
226  null=ToString(-1);
227  return CDB_SUCCESS;
228  }
229  default:
230  return CDB_TYPE_ERROR;
231  }
232  }
233  else
234  return CDB_RANGE_ERROR;
235 }
236 
237 int GenericDbTable::getNull(unsigned n_column, float &null) const
238 {
239  if (!m_isInitialized)
240  return CDB_NOT_INITIALIZED;
241 
242  if (m_conddbtable.size() > n_column)
243  if (m_conddbtable[n_column]->type == kFloat)
244  {
245  CondDBColumnFloat *tmpColumn = static_cast<CondDBColumnFloat*>(m_conddbtable[n_column]);
246  return __getNull(null, tmpColumn);
247  }
248  else if ( m_conddbtable[n_column]->type == kArrayFloat)
249  {
251  CondDBColumnArrayFloat *tmpColumn = static_cast<CondDBColumnArrayFloat*>(m_conddbtable[n_column]);
252  __getNull(tmp, tmpColumn);
253  null=tmp[0];
254  return CDB_SUCCESS;
255  }
256  else
257  return CDB_TYPE_ERROR;
258  else
259  return CDB_RANGE_ERROR;
260 }
261 
262 int GenericDbTable::getNull(unsigned n_column, long int &null) const
263 {
264  if (!m_isInitialized)
265  return CDB_NOT_INITIALIZED;
266 
267  if (m_conddbtable.size() > n_column)
268  if (m_conddbtable[n_column]->type == kInt)
269  {
270  CondDBColumnInt *tmpColumn = static_cast<CondDBColumnInt*>(m_conddbtable[n_column]);
271  return __getNull(null, tmpColumn);
272  }
273  else if (m_conddbtable[n_column]->type == kArrayInt)
274  {
275  vector<long int> tmp;
276  CondDBColumnArrayInt *tmpColumn = static_cast<CondDBColumnArrayInt*>(m_conddbtable[n_column]);
277  __getNull(tmp, tmpColumn);
278  return CDB_SUCCESS;
279  }
280  else
281  return CDB_TYPE_ERROR;
282  else
283  return CDB_RANGE_ERROR;
284 }
285 
286 int GenericDbTable::getNull(unsigned n_column, double &null) const
287 {
288  if (!m_isInitialized)
289  return CDB_NOT_INITIALIZED;
290 
291  if (m_conddbtable.size() > n_column)
292  if (m_conddbtable[n_column]->type == kDouble)
293  {
294  CondDBColumnDouble *tmpColumn = static_cast<CondDBColumnDouble*>(m_conddbtable[n_column]);
295  return __getNull(null, tmpColumn);
296  }
297  else if (m_conddbtable[n_column]->type == kArrayDouble)
298  {
300  CondDBColumnArrayDouble *tmpColumn = static_cast<CondDBColumnArrayDouble*>(m_conddbtable[n_column]);
301  __getNull(tmp, tmpColumn);
302  null = tmp[0];
303  return CDB_SUCCESS;
304  }
305  else
306  return CDB_TYPE_ERROR;
307  else
308  return CDB_RANGE_ERROR;
309 }
310 
311 int GenericDbTable::getNull(unsigned n_column, int64 &null) const
312 {
313  if (!m_isInitialized)
314  return CDB_NOT_INITIALIZED;
315 
316  if (m_conddbtable.size() > n_column)
317  if (m_conddbtable[n_column]->type == kLongLong)
318  {
319  CondDBColumnLong *tmpColumn = static_cast<CondDBColumnLong*>(m_conddbtable[n_column]);
320  return __getNull(null, tmpColumn);
321  }
322  else if ( m_conddbtable[n_column]->type == kArrayLongLong)
323  {
324  vector<int64> tmp;
325  CondDBColumnArrayLong *tmpColumn = static_cast<CondDBColumnArrayLong*>(m_conddbtable[n_column]);
326  __getNull(tmp, tmpColumn);
327  null = tmp[0];
328  return CDB_SUCCESS;
329  }
330  else
331  return CDB_TYPE_ERROR;
332  else
333  return CDB_RANGE_ERROR;
334 }
335 
336 
337 int GenericDbTable::setName(unsigned n_column, const string& name)
338 {
339  if (m_conddbtable.size() > n_column)
340  if (m_conddbtable[n_column]->name.size() == 0)
341  {
342  m_conddbtable[n_column]->name = name;
343  if (m_conddbtable[n_column]->type != kNull)
344  {
345  m_conddbtable[n_column]->initialized = true;
347  }
348  }
349  else
350  return CDB_TYPE_ERROR;
351  else
352  return CDB_RANGE_ERROR;
353  return CDB_SUCCESS;
354 }
355 
356 int GenericDbTable::setType(unsigned n_column, dataTypes type)
357 {
358  if (m_conddbtable.size() > n_column)
359  if (m_conddbtable[n_column]->type == kNull)
360  {
361  m_conddbtable[n_column]->type = type;
362 
363  switch (type)
364  {
365  case kBool:
366  {
367  CondDBColumnBool * tmpColumn = new CondDBColumnBool;
368  tmpColumn->type = m_conddbtable[n_column]->type;
369  tmpColumn->column.push_back(-1);
370  if ((m_conddbtable[n_column]->name.size()))
371  tmpColumn->name = m_conddbtable[n_column]->name;
372 
373  delete(m_conddbtable[n_column]);
374  m_conddbtable[n_column] = tmpColumn;
375  break;
376  }
377  case kInt:
378  {
379  CondDBColumnInt * tmpColumn = new CondDBColumnInt;
380  tmpColumn->type = m_conddbtable[n_column]->type;
381  tmpColumn->column.push_back(NULLINT);
382  if ((m_conddbtable[n_column]->name.size()))
383  tmpColumn->name = m_conddbtable[n_column]->name;
384  delete(m_conddbtable[n_column]);
385  m_conddbtable[n_column] = tmpColumn;
386  break;
387  }
388  case kLongLong:
389  {
390  CondDBColumnLong * tmpColumn = new CondDBColumnLong;
391  tmpColumn->type = m_conddbtable[n_column]->type;
392  tmpColumn->column.push_back(NULLLONG);
393  if ((m_conddbtable[n_column]->name.size()))
394  tmpColumn->name = m_conddbtable[n_column]->name;
395  delete(m_conddbtable[n_column]);
396  m_conddbtable[n_column] = tmpColumn;
397  break;
398  }
399 
400  case kFloat:
401  {
402  CondDBColumnFloat * tmpColumn = new CondDBColumnFloat;
403  tmpColumn->type = m_conddbtable[n_column]->type;
404  tmpColumn->column.push_back(NULLFLOAT);
405  if ((m_conddbtable[n_column]->name.size()))
406  tmpColumn->name = m_conddbtable[n_column]->name;
407  delete(m_conddbtable[n_column]);
408  m_conddbtable[n_column] = tmpColumn;
409  break;
410  }
411  case kString:
412  {
413  CondDBColumnString * tmpColumn = new CondDBColumnString;
414  tmpColumn->type = m_conddbtable[n_column]->type;
415  tmpColumn->column.push_back("NULL");
416  if ((m_conddbtable[n_column]->name.size()))
417  tmpColumn->name = m_conddbtable[n_column]->name;
418 
419  delete(m_conddbtable[n_column]);
420  m_conddbtable[n_column] = tmpColumn;
421  break;
422  }
423  case kDouble:
424  {
425  CondDBColumnDouble * tmpColumn = new CondDBColumnDouble;
426  tmpColumn->type = m_conddbtable[n_column]->type;
427  tmpColumn->column.push_back(NULLDOUBLE);
428  if ((m_conddbtable[n_column]->name.size()))
429  tmpColumn->name = m_conddbtable[n_column]->name;
430 
431  delete(m_conddbtable[n_column]);
432  m_conddbtable[n_column] = tmpColumn;
433  break;
434  }
435  case kArrayInt:
436  {
437  CondDBColumnArrayInt * tmpColumn = new CondDBColumnArrayInt;
438  tmpColumn->type = m_conddbtable[n_column]->type;
439  vector<long int> tmp;
440  tmp.push_back(NULLINT);
441  tmpColumn->column.push_back(tmp);
442  if ((m_conddbtable[n_column]->name.size()))
443  tmpColumn->name = m_conddbtable[n_column]->name;
444  delete(m_conddbtable[n_column]);
445  m_conddbtable[n_column] = tmpColumn;
446  break;
447  }
448  case kArrayLongLong:
449  {
451  tmpColumn->type = m_conddbtable[n_column]->type;
452  vector<int64> tmp;
453  tmp.push_back(NULLLONG);
454  tmpColumn->column.push_back(tmp);
455  if ((m_conddbtable[n_column]->name.size()))
456  tmpColumn->name = m_conddbtable[n_column]->name;
457  delete(m_conddbtable[n_column]);
458  m_conddbtable[n_column] = tmpColumn;
459  break;
460  }
461  case kArrayBool:
462  {
464  tmpColumn->type = m_conddbtable[n_column]->type;
465  vector<short int> tmp;
466  tmp.push_back(-1);
467  tmpColumn->column.push_back(tmp);
468  if ((m_conddbtable[n_column]->name.size()))
469  tmpColumn->name = m_conddbtable[n_column]->name;
470  delete(m_conddbtable[n_column]);
471  m_conddbtable[n_column] = tmpColumn;
472  break;
473  }
474  case kArrayFloat:
475  {
477  tmpColumn->type = m_conddbtable[n_column]->type;
479  tmp.push_back(NULLFLOAT);
480  tmpColumn->column.push_back(tmp);
481  if ((m_conddbtable[n_column]->name.size()))
482  tmpColumn->name = m_conddbtable[n_column]->name;
483  delete(m_conddbtable[n_column]);
484  m_conddbtable[n_column] = tmpColumn;
485  break;
486  }
487  case kArrayString:
488  {
490  tmpColumn->type = m_conddbtable[n_column]->type;
492  tmp.push_back("NULL");
493  tmpColumn->column.push_back(tmp);
494  if ((m_conddbtable[n_column]->name.size()))
495  tmpColumn->name = m_conddbtable[n_column]->name;
496  delete(m_conddbtable[n_column]);
497  m_conddbtable[n_column] = tmpColumn;
498  break;
499  }
500  case kArrayDouble:
501  {
503  tmpColumn->type = m_conddbtable[n_column]->type;
505  tmp.push_back(NULLDOUBLE);
506  tmpColumn->column.push_back(tmp);
507  if ((m_conddbtable[n_column]->name.size()))
508  tmpColumn->name = m_conddbtable[n_column]->name;
509  delete(m_conddbtable[n_column]);
510  m_conddbtable[n_column] = tmpColumn;
511  break;
512  }
513  default : break;
514  }
515 
516  if (m_conddbtable[n_column]->name.size() != 0)
517  {
518  m_conddbtable[n_column]->initialized = true;
520  }
521  }
522  else
523  return CDB_TYPE_ERROR;
524  else
525  return CDB_RANGE_ERROR;
526  return CDB_SUCCESS;
527 
528 }
529 
530 int GenericDbTable::setNull(unsigned n_column, const string &null)
531 {
532  if (!m_isInitialized)
533  return CDB_NOT_INITIALIZED;
534 
535  if (m_conddbtable.size() > n_column)
536  switch (m_conddbtable[n_column]->type)
537  {
538  case kString:
539  {
540  static_cast<CondDBColumnString*>(m_conddbtable[n_column])->column[0] = null;
541  return CDB_SUCCESS;
542  }
543  case kArrayString:
544  {
545  vector<string> tmp(1,null);
546  static_cast<CondDBColumnArrayString*>(m_conddbtable[n_column])->column[0] = tmp;
547  return CDB_SUCCESS;
548  }
549  case kFloat:
550  {
551  static_cast<CondDBColumnFloat*>(m_conddbtable[n_column])->column[0] = atof(null.c_str());
552  return CDB_SUCCESS;
553  }
554  case kArrayFloat:
555  {
556  vector<float> tmp(1,atof(null.c_str()));
557  static_cast<CondDBColumnArrayFloat*>(m_conddbtable[n_column])->column[0] = tmp;
558  return CDB_SUCCESS;
559  }
560  case kInt:
561  {
562  static_cast<CondDBColumnInt*>(m_conddbtable[n_column])->column[0] = atol(null.c_str());
563  return CDB_SUCCESS;
564  }
565  case kArrayInt:
566  {
567  vector<long int> tmp(1,atol(null.c_str()));
568  static_cast<CondDBColumnArrayInt*>(m_conddbtable[n_column])->column[0] = tmp;
569  return CDB_SUCCESS;
570  }
571  case kBool:
572  case kArrayBool:
573  {
574  return CDB_SUCCESS;
575  }
576  case kLongLong:
577  {
578  static_cast<CondDBColumnString*>(m_conddbtable[n_column])->column[0] = atoi64(null.c_str());
579  return CDB_SUCCESS;
580  }
581  case kArrayLongLong:
582  {
583  vector<int64> tmp(1,atoi64(null.c_str()));
584  static_cast<CondDBColumnArrayLong*>(m_conddbtable[n_column])->column[0] = tmp;
585  return CDB_SUCCESS;
586  }
587  case kDouble:
588  {
589  static_cast<CondDBColumnDouble*>(m_conddbtable[n_column])->column[0] = atof(null.c_str());
590  return CDB_SUCCESS;
591  }
592  case kArrayDouble:
593  {
594  vector<double> tmp(1,atof(null.c_str()));
595  static_cast<CondDBColumnArrayDouble*>(m_conddbtable[n_column])->column[0] = tmp;
596  return CDB_SUCCESS;
597  }
598  default:
599  return CDB_TYPE_ERROR;
600  }
601  else
602  return CDB_RANGE_ERROR;
603 }
604 
605 int GenericDbTable::setNull(unsigned n_column, const long int &null)
606 {
607  if (!m_isInitialized)
608  return CDB_NOT_INITIALIZED;
609 
610  if (m_conddbtable.size() > n_column)
611  if (m_conddbtable[n_column]->type == kInt)
612  {
613  static_cast<CondDBColumnInt*>(m_conddbtable[n_column])->column[0] = null;
614  return CDB_SUCCESS;
615  }
616  else if (m_conddbtable[n_column]->type == kArrayInt)
617  {
618  vector<long int> tmp(1,null);
619  static_cast<CondDBColumnArrayInt*>(m_conddbtable[n_column])->column[0] = tmp;
620  return CDB_SUCCESS;
621  }
622  else
623  return CDB_TYPE_ERROR;
624  else
625  return CDB_RANGE_ERROR;
626 }
627 
628 int GenericDbTable::setNull(unsigned n_column, const int64 &null)
629 {
630  if (!m_isInitialized)
631  return CDB_NOT_INITIALIZED;
632 
633  if (m_conddbtable.size() > n_column)
634  if (m_conddbtable[n_column]->type == kLongLong )
635  {
636  static_cast<CondDBColumnLong*>(m_conddbtable[n_column])->column[0] = null;
637  return CDB_SUCCESS;
638  }
639  else if (m_conddbtable[n_column]->type == kArrayLongLong)
640  {
641  vector<int64> tmp(1,null);
642  static_cast<CondDBColumnArrayLong*>(m_conddbtable[n_column])->column[0] = tmp;
643  return CDB_SUCCESS;
644  }
645  else
646  return CDB_TYPE_ERROR;
647  else
648  return CDB_RANGE_ERROR;
649 }
650 
651 int GenericDbTable::setNull(unsigned n_column, const float &null)
652 {
653  if (!m_isInitialized)
654  return CDB_NOT_INITIALIZED;
655 
656  if (m_conddbtable.size() > n_column)
657  if (m_conddbtable[n_column]->type == kFloat )
658  {
659  static_cast<CondDBColumnFloat*>(m_conddbtable[n_column])->column[0] = null;
660  return CDB_SUCCESS;
661  }
662  else if (m_conddbtable[n_column]->type == kArrayFloat)
663  {
664  vector<float> tmp(1,null);
665  static_cast<CondDBColumnArrayFloat*>(m_conddbtable[n_column])->column[0] = tmp;
666  return CDB_SUCCESS;
667  }
668  else
669  return CDB_TYPE_ERROR;
670  else
671  return CDB_RANGE_ERROR;
672 }
673 
674 int GenericDbTable::setNull(unsigned n_column, const double &null)
675 {
676  if (!m_isInitialized)
677  return CDB_NOT_INITIALIZED;
678 
679  if (m_conddbtable.size() > n_column)
680  if (m_conddbtable[n_column]->type == kDouble || m_conddbtable[n_column]->type == kArrayDouble)
681  {
682  static_cast<CondDBColumnDouble*>(m_conddbtable[n_column])->column[0] = null;
683  return CDB_SUCCESS;
684  }
685  else if (m_conddbtable[n_column]->type == kArrayDouble)
686  {
687  vector<double> tmp(1, null);
688  static_cast<CondDBColumnArrayDouble*>(m_conddbtable[n_column])->column[0] = tmp;
689  return CDB_SUCCESS;
690  }
691  else
692  return CDB_TYPE_ERROR;
693  else
694  return CDB_RANGE_ERROR;
695 }
696 
697 
698 // getCell - getting the value of a cell.
699 
700 int GenericDbTable::getCell(unsigned n_column, unsigned n_row, long int &ndata) const
701 {
702  CondDBColumnInt *tmpColumn = static_cast<CondDBColumnInt*>(m_conddbtable[n_column]);
703  return __getCell(n_column, n_row, ndata, kInt, tmpColumn);
704 }
705 
706 int GenericDbTable::getCell(unsigned n_column, unsigned n_row, short int &ndata) const
707 {
708  CondDBColumnBool *tmpColumn = static_cast<CondDBColumnBool*>(m_conddbtable[n_column]);
709  return __getCell(n_column, n_row, ndata, kBool, tmpColumn);
710 }
711 
712 int GenericDbTable::getCell(unsigned n_column, unsigned n_row, int64 &ndata) const
713 {
714  CondDBColumnLong *tmpColumn = static_cast<CondDBColumnLong*>(m_conddbtable[n_column]);
715  return __getCell(n_column, n_row, ndata, kLongLong, tmpColumn);
716 }
717 
718 
719 int GenericDbTable::getCell(unsigned n_column, unsigned n_row, float &ndata) const
720 {
721  CondDBColumnFloat *tmpColumn = static_cast<CondDBColumnFloat*>(m_conddbtable[n_column]);
722  return __getCell(n_column, n_row, ndata, kFloat, tmpColumn);
723 }
724 
725 int GenericDbTable::getCell(unsigned n_column, unsigned n_row, string &ndata) const
726 {
727 
728  int status;
729 
730  if (!m_isInitialized)
731  return CDB_NOT_INITIALIZED;
732 
733  if ((m_numRows > n_row) && (m_conddbtable.size() > n_column))
734  {
735  if (m_conddbtable[n_column]->type == kString) {
736  CondDBColumnString *tmpColumn = static_cast<CondDBColumnString*>(m_conddbtable[n_column]);
737  return __getCell(n_column, n_row, ndata, kString, tmpColumn);
738  }
739  else {
740  switch(m_conddbtable[n_column]->type)
741  {
742  case kInt:
743  {
744  long int aux;
745  CondDBColumnInt *tmpColumn = static_cast<CondDBColumnInt*>(m_conddbtable[n_column]);
746  status = __getCell(n_column, n_row, aux , kInt, tmpColumn);
747  if (status == CDB_SUCCESS)
748  ndata = ToString(aux);
749  break;
750  }
751  case kBool:
752  {
753  short int aux;
754  CondDBColumnBool *tmpColumn = static_cast<CondDBColumnBool*>(m_conddbtable[n_column]);
755  status = __getCell(n_column, n_row, aux, kBool, tmpColumn);
756  if (status == CDB_SUCCESS)
757  ndata = ToString(aux);
758  break;
759  }
760 
761  case kLongLong:
762  {
763  long long aux;
764  CondDBColumnLong *tmpColumn = static_cast<CondDBColumnLong*>(m_conddbtable[n_column]);
765  status = __getCell(n_column,n_row, aux, kLongLong, tmpColumn);
766  if (status == CDB_SUCCESS)
767  ndata = ToString(aux);
768  break;
769  }
770  case kFloat:
771  {
772  float aux;
773 
774  CondDBColumnFloat *tmpColumn = static_cast<CondDBColumnFloat*>(m_conddbtable[n_column]);
775  status = __getCell(n_column,n_row, aux, kFloat, tmpColumn);
776  if (status == CDB_SUCCESS)
777  ndata = ToString(aux);
778  break;
779  }
780  case kDouble:
781  {
782  double aux;
783  CondDBColumnDouble *tmpColumn = static_cast<CondDBColumnDouble*>(m_conddbtable[n_column]);
784  status = __getCell(n_column,n_row,aux,kDouble, tmpColumn);
785  if (status == CDB_SUCCESS)
786  ndata = ToString(aux);
787  break;
788  }
789  //if the column is of the type array of *type* one should use the method with vector of strings
790  default:
791  return CDB_STRTOARRAY_ERROR;
792  }
793  }
794  }
795  else
796  return CDB_RANGE_ERROR;
797 
798  return status;
799 
800 }
801 
802 int GenericDbTable::getCell(unsigned n_column, unsigned n_row, double &ndata) const
803 {
804  CondDBColumnDouble *tmpColumn = static_cast<CondDBColumnDouble*>(m_conddbtable[n_column]);
805  return __getCell(n_column, n_row, ndata, kDouble, tmpColumn);
806 }
807 
808 int GenericDbTable::getCell(unsigned n_column, unsigned n_row, vector<long int> &ndata) const
809 {
810  CondDBColumnArrayInt *tmpColumn = static_cast<CondDBColumnArrayInt*>(m_conddbtable[n_column]);
811  return __getCell(n_column, n_row, ndata, kArrayInt, tmpColumn);
812 }
813 
814 int GenericDbTable::getCell(unsigned n_column, unsigned n_row, vector<short int> &ndata) const
815 {
816  CondDBColumnArrayBool *tmpColumn = static_cast<CondDBColumnArrayBool*>(m_conddbtable[n_column]);
817  return __getCell(n_column, n_row, ndata, kArrayBool, tmpColumn);
818 }
819 
820 int GenericDbTable::getCell(unsigned n_column, unsigned n_row, vector<int64> &ndata) const
821 {
822  CondDBColumnArrayLong *tmpColumn = static_cast<CondDBColumnArrayLong*>(m_conddbtable[n_column]);
823  return __getCell(n_column, n_row, ndata, kArrayLongLong, tmpColumn);
824 }
825 
826 int GenericDbTable::getCell(unsigned n_column, unsigned n_row, vector<float> &ndata) const
827 {
828  CondDBColumnArrayFloat *tmpColumn = static_cast<CondDBColumnArrayFloat*>(m_conddbtable[n_column]);
829  return __getCell(n_column, n_row, ndata, kArrayFloat, tmpColumn);
830 }
831 
832 int GenericDbTable::getCell(unsigned n_column, unsigned n_row, vector<string> &ndata) const
833 {
834  CondDBColumnArrayString *tmpColumn = static_cast<CondDBColumnArrayString*>(m_conddbtable[n_column]);
835  return __getCell(n_column, n_row, ndata, kArrayString, tmpColumn);
836 }
837 
838 int GenericDbTable::getCell(unsigned n_column, unsigned n_row, vector<double> &ndata) const
839 {
840  CondDBColumnArrayDouble *tmpColumn = static_cast<CondDBColumnArrayDouble*>(m_conddbtable[n_column]);
841  return __getCell(n_column, n_row, ndata, kArrayDouble, tmpColumn);
842 }
843 
845 // New access methods
847 
848 int GenericDbTable::getCell(const std::string& colName, unsigned int n_row, short int &data) const
849 {
850  return __getCellByName(colName,n_row,data);
851 }
852 
853 int GenericDbTable::getCell(const std::string& colName, unsigned int n_row, long int &data) const
854 {
855 return __getCellByName<long int>(colName, n_row, data);
856 }
857 int GenericDbTable::getCell(const std::string& colName, unsigned int n_row, int64 &data) const
858 {
859  return __getCellByName<int64>(colName, n_row, data);
860 }
861 int GenericDbTable::getCell(const std::string& colName, unsigned int n_row, float &data) const
862 {
863  return __getCellByName<float>(colName,n_row,data);
864 }
865 int GenericDbTable::getCell(const std::string& colName, unsigned int n_row, double &data) const
866 {
867  return __getCellByName<double>(colName, n_row, data);
868 }
869 int GenericDbTable::getCell(const std::string& colName, unsigned int n_row, std::string &data) const
870 {
871  return __getCellByName<std::string>(colName, n_row, data);
872 }
873 int GenericDbTable::getCell(const std::string& colName, unsigned int n_row, std::vector<short int> &data) const
874 {
875  return __getCellByName< std::vector<short int> >(colName, n_row, data);
876 }
877 int GenericDbTable::getCell(const std::string& colName, unsigned int n_row, std::vector<long int> &data) const
878 {
879  return __getCellByName<std::vector<long int> >(colName, n_row, data);
880 }
881 int GenericDbTable::getCell(const std::string& colName, unsigned int n_row, std::vector<int64> &data) const
882 {
883  return __getCellByName<std::vector<int64> >(colName, n_row, data);
884 }
885 int GenericDbTable::getCell(const std::string& colName, unsigned int n_row, std::vector<float> &data) const
886 {
887  return __getCellByName<std::vector<float> >(colName, n_row, data);
888 }
889 int GenericDbTable::getCell(const std::string& colName, unsigned int n_row, std::vector<double> &data) const
890 {
891  return __getCellByName<std::vector<double> >(colName, n_row, data);
892 }
893 int GenericDbTable::getCell(const std::string& colName, unsigned int n_row, std::vector<string> &data) const
894 {
895  return __getCellByName<std::vector<string> >(colName, n_row, data);
896 }
897 
899 // data insertion members
901 
902 // public members
903 int GenericDbTable::setCell(unsigned n_column, unsigned n_row, const long int ndata)
904 {
905  CondDBColumnInt *tmpColumn = static_cast<CondDBColumnInt*>(m_conddbtable[n_column]);
906  return __setCell(n_column, n_row, ndata, kInt, tmpColumn);
907 }
908 
909 int GenericDbTable::setCell(unsigned n_column, unsigned n_row, const short int ndata)
910 {
911  CondDBColumnBool *tmpColumn = static_cast<CondDBColumnBool*>(m_conddbtable[n_column]);
912  return __setCell(n_column, n_row, ndata, kBool, tmpColumn);
913 }
914 
915 int GenericDbTable::setCell(unsigned n_column, unsigned n_row, const int64 ndata)
916 {
917  CondDBColumnLong *tmpColumn = static_cast<CondDBColumnLong*>(m_conddbtable[n_column]);
918  return __setCell(n_column, n_row, ndata, kLongLong, tmpColumn);
919 }
920 
921 int GenericDbTable::setCell(unsigned n_column, unsigned n_row,const float ndata)
922 {
923  CondDBColumnFloat *tmpColumn = static_cast<CondDBColumnFloat*>(m_conddbtable[n_column]);
924  return __setCell(n_column, n_row, ndata, kFloat, tmpColumn);
925 }
926 
927 int GenericDbTable::setCell(unsigned n_column, unsigned n_row, const std::string& ndata)
928 {
929 
930  if (!m_isInitialized)
931  return CDB_NOT_INITIALIZED;
932 
933  if ((m_numRows > n_row) && (m_conddbtable.size() > n_column))
934  {
935  if (m_conddbtable[n_column]->type == kString)
936  {
937  CondDBColumnString *tmpColumn = static_cast<CondDBColumnString*>(m_conddbtable[n_column]);
938  __setCell(n_column, n_row, ndata, kString, tmpColumn);
939  }
940  else
941  {
942  switch(m_conddbtable[n_column]->type)
943  {
944  case kInt:
945  {
946  if (ndata=="NULL")
947  {
948  CondDBColumnInt *tmpColumn = static_cast<CondDBColumnInt*>(m_conddbtable[n_column]);
949  __setCell(n_column, n_row, tmpColumn->column[0], kInt, tmpColumn);
950  }
951  else
952  {
953  CondDBColumnInt *tmpColumn = static_cast<CondDBColumnInt*>(m_conddbtable[n_column]);
954  __setCell(n_column, n_row, atol(ndata.c_str()), kInt, tmpColumn);
955  }
956  break;
957  }
958  case kBool:
959  {
960  if (ndata=="NULL")
961  {
962  CondDBColumnBool *tmpColumn = static_cast<CondDBColumnBool*>(m_conddbtable[n_column]);
963  __setCell(n_column,n_row, tmpColumn->column[0], kBool, tmpColumn);
964 
965  }
966  else
967  {
968  CondDBColumnBool *tmpColumn = static_cast<CondDBColumnBool*>(m_conddbtable[n_column]);
969  __setCell(n_column, n_row, atoi(ndata.c_str()), kBool, tmpColumn);
970  }
971  break;
972  }
973  case kLongLong:
974  {
975  if (ndata=="NULL")
976  {
977  CondDBColumnLong *tmpColumn = static_cast<CondDBColumnLong*>(m_conddbtable[n_column]);
978  __setCell(n_column,n_row, tmpColumn->column[0], kLongLong, tmpColumn);
979  }
980  else
981  {
982  CondDBColumnLong *tmpColumn = static_cast<CondDBColumnLong*>(m_conddbtable[n_column]);
983  __setCell(n_column,n_row, atoi64(ndata.c_str()), kLongLong, tmpColumn);
984  }
985  break;
986  }
987  case kFloat:
988  {
989  if (ndata=="NULL")
990  {
991  CondDBColumnFloat *tmpColumn = static_cast<CondDBColumnFloat*>(m_conddbtable[n_column]);
992  __setCell(n_column,n_row, tmpColumn->column[0], kFloat, tmpColumn);
993  }
994  else
995  {
996  CondDBColumnFloat *tmpColumn = static_cast<CondDBColumnFloat*>(m_conddbtable[n_column]);
997  __setCell(n_column,n_row, strtod(ndata.c_str(), (char **)NULL), kFloat, tmpColumn);
998  }
999  break;
1000  }
1001  case kDouble:
1002  {
1003  if (ndata=="NULL")
1004  {
1005  CondDBColumnDouble *tmpColumn = static_cast<CondDBColumnDouble*>(m_conddbtable[n_column]);
1006  __setCell(n_column,n_row, tmpColumn->column[0],kDouble, tmpColumn);
1007  }
1008  else
1009  {
1010  CondDBColumnDouble *tmpColumn = static_cast<CondDBColumnDouble*>(m_conddbtable[n_column]);
1011  __setCell(n_column,n_row,strtod(ndata.c_str(), (char **)NULL),kDouble, tmpColumn);
1012  }
1013  break;
1014  }
1015  //if the column is of the type array of *type* one should use the method with vector of strings
1016  default:
1017  return CDB_STRTOARRAY_ERROR;
1018  }
1019  }
1020  }
1021  else
1022  return CDB_RANGE_ERROR;
1023  return CDB_SUCCESS;
1024 }
1025 
1026 int GenericDbTable::setCell(unsigned n_column, unsigned n_row, const double ndata)
1027 {
1028  CondDBColumnDouble *tmpColumn = static_cast<CondDBColumnDouble*>(m_conddbtable[n_column]);
1029  return __setCell(n_column, n_row, ndata, kDouble, tmpColumn);
1030 }
1031 
1032 int GenericDbTable::setCell(unsigned n_column, unsigned n_row, const vector<short int> &ndata)
1033 {
1034  CondDBColumnArrayBool *tmpColumn = static_cast<CondDBColumnArrayBool*>(m_conddbtable[n_column]);
1035  return __setCell(n_column, n_row, ndata, kArrayBool, tmpColumn);
1036 }
1037 
1038 int GenericDbTable::setCell(unsigned n_column, unsigned n_row, const vector<long int> &ndata)
1039 {
1040  CondDBColumnArrayInt *tmpColumn = static_cast<CondDBColumnArrayInt*>(m_conddbtable[n_column]);
1041  return __setCell(n_column, n_row, ndata, kArrayInt, tmpColumn);
1042 }
1043 
1044 int GenericDbTable::setCell(unsigned n_column, unsigned n_row, const vector<int64> &ndata)
1045 {
1046  CondDBColumnArrayLong *tmpColumn = static_cast<CondDBColumnArrayLong*>(m_conddbtable[n_column]);
1047  return __setCell(n_column, n_row, ndata, kArrayLongLong, tmpColumn);
1048 }
1049 
1050 int GenericDbTable::setCell(unsigned n_column, unsigned n_row, const vector<float> &ndata)
1051 {
1052  CondDBColumnArrayFloat *tmpColumn = static_cast<CondDBColumnArrayFloat*>(m_conddbtable[n_column]);
1053  return __setCell(n_column, n_row, ndata, kArrayFloat, tmpColumn);
1054 }
1055 
1056 int GenericDbTable::setCell(unsigned n_column, unsigned n_row, const vector<double> &ndata)
1057 {
1058  CondDBColumnArrayDouble *tmpColumn = static_cast<CondDBColumnArrayDouble*>(m_conddbtable[n_column]);
1059  return __setCell(n_column, n_row, ndata, kArrayDouble, tmpColumn);
1060 }
1061 
1062 
1063 // nbarros: necessario refazer!!!
1064 int GenericDbTable::setCell(unsigned n_column, unsigned n_row, const vector<string> &ndata)
1065 {
1066 
1067  if (!m_isInitialized)
1068  return CDB_NOT_INITIALIZED;
1069 
1070  if ((m_numRows > n_row) && (m_conddbtable.size() > n_column))
1071  {
1072  if (m_conddbtable[n_column]->type == kArrayString)
1073  {
1074  CondDBColumnArrayString *tmpColumn = static_cast<CondDBColumnArrayString*>(m_conddbtable[n_column]);
1075  return __setCell(n_column, n_row, ndata, kArrayString, tmpColumn);
1076 // static_cast<CondDBColumnArrayString*>(m_conddbtable[n_column])->column[n_row+1] = ndata;
1077  }
1078  else
1079  {
1080  switch(m_conddbtable[n_column]->type)
1081  {
1082  case kArrayInt:
1083  {
1084  vector<long int> tmp;
1085  for (unsigned i=0; i<ndata.size(); i++)
1086  {
1087  if (ndata[i]=="NULL")
1088  {
1089  long int null;
1090  getNull(n_column, null);
1091  tmp.push_back(null);
1092  }
1093  else
1094  tmp.push_back(atol(ndata[i].c_str()));
1095  }
1096  CondDBColumnArrayInt *tmpColumn = static_cast<CondDBColumnArrayInt*>(m_conddbtable[n_column]);
1097  return __setCell(n_column, n_row, tmp, kArrayInt, tmpColumn);
1098  break;
1099  }
1100  case kArrayBool:
1101  {
1102  vector<short int> tmp;
1103  for (unsigned i=0; i<ndata.size(); i++)
1104  {
1105  if (ndata[i]=="NULL")
1106  {
1107  tmp.push_back(-1);
1108  }
1109  else
1110  tmp.push_back(atoi(ndata[i].c_str()));
1111  }
1112  CondDBColumnArrayBool *tmpColumn = static_cast<CondDBColumnArrayBool*>(m_conddbtable[n_column]);
1113  return __setCell(n_column, n_row, tmp, kArrayBool, tmpColumn);
1114  break;
1115  }
1116  case kArrayLongLong:
1117  {
1118  vector<int64> tmp;
1119  for (unsigned i=0; i<ndata.size(); i++)
1120  {
1121  if (ndata[i]=="NULL")
1122  {
1123  int64 null;
1124  getNull(n_column, null);
1125  tmp.push_back(null);
1126  }
1127  else
1128 
1129  tmp.push_back(atoi64(ndata[i].c_str()));
1130  }
1131  CondDBColumnArrayLong *tmpColumn = static_cast<CondDBColumnArrayLong*>(m_conddbtable[n_column]);
1132  return __setCell(n_column, n_row, tmp, kArrayLongLong, tmpColumn);
1133  break;
1134  }
1135  case kArrayFloat:
1136  {
1138  for (unsigned i=0; i<ndata.size(); i++)
1139  {
1140  if (ndata[i]=="NULL")
1141  {
1142  float null;
1143  getNull(n_column, null);
1144  tmp.push_back(null);
1145  }
1146  else
1147  tmp.push_back(atof(ndata[i].c_str()));
1148  }
1149  CondDBColumnArrayFloat *tmpColumn = static_cast<CondDBColumnArrayFloat*>(m_conddbtable[n_column]);
1150  return __setCell(n_column, n_row, tmp, kArrayFloat, tmpColumn);
1151  break;
1152  }
1153  case kArrayDouble:
1154  {
1156  for (unsigned i=0; i<ndata.size(); i++)
1157  {
1158  if (ndata[i]=="NULL")
1159  {
1160  double null;
1161  getNull(n_column, null);
1162  tmp.push_back(null);
1163  }
1164  else
1165  tmp.push_back(strtod(ndata[i].c_str(), (char**)NULL));
1166  }
1167  CondDBColumnArrayDouble *tmpColumn = static_cast<CondDBColumnArrayDouble*>(m_conddbtable[n_column]);
1168  return __setCell(n_column, n_row, tmp, kArrayDouble, tmpColumn);
1169  break;
1170  }
1171  //if the column is of the type array of *type* one should use the method with vector of strings
1172  default:
1173  return CDB_STRTOARRAY_ERROR;
1174  }
1175  }
1176  }
1177  else
1178  return CDB_RANGE_ERROR;
1179  return CDB_SUCCESS;
1180 }
1181 
1183 // setData members - append data to columns.
1184 //
1185 // Return the number of elements of the vector passed that have been appended to the column
1186 // or an error code.
1188 
1189 
1190 // data type specific members (public)
1191 int GenericDbTable::setColumndata(unsigned n_column,const vector<long int> &data)
1192 {
1193  CondDBColumnInt *tmpColumn = static_cast<CondDBColumnInt*>(m_conddbtable[n_column]);
1194  return __setColumnData(n_column, data, kInt, tmpColumn);
1195 }
1196 
1197 int GenericDbTable::setColumndata(unsigned n_column, const vector<int64> &data)
1198 {
1199  CondDBColumnLong *tmpColumn = static_cast<CondDBColumnLong*>(m_conddbtable[n_column]);
1200  return __setColumnData(n_column, data, kLongLong, tmpColumn);
1201 }
1202 
1203 int GenericDbTable::setColumndata(unsigned n_column, const vector<short int> &data)
1204 {
1205  CondDBColumnBool *tmpColumn = static_cast<CondDBColumnBool*>(m_conddbtable[n_column]);
1206  return __setColumnData(n_column, data, kBool, tmpColumn);
1207 }
1208 
1209 int GenericDbTable::setColumndata(unsigned n_column, const vector<float> &data)
1210 {
1211  CondDBColumnFloat *tmpColumn = static_cast<CondDBColumnFloat*>(m_conddbtable[n_column]);
1212  return __setColumnData(n_column, data, kFloat, tmpColumn);
1213 }
1214 
1215 int GenericDbTable::setColumndata(unsigned n_column, const vector<string> &data)
1216 {
1217 
1218  if (!m_isInitialized)
1219  return CDB_NOT_INITIALIZED;
1220 
1221  unsigned index = 0;
1222  if (n_column < m_conddbtable.size())
1223  {
1224  if (m_conddbtable[n_column]->type == kString)
1225  {
1226  CondDBColumnString* tmpColumn = static_cast<CondDBColumnString*>(m_conddbtable[n_column]);
1227  while((tmpColumn->column.size() < m_numRows+1) && (index < data.size()))
1228  {
1229  tmpColumn->column.push_back(data[index]);
1230  index++;
1231  }
1232  return index;
1233  }
1234  else
1235  {
1236 // If the data type is not string we can convert the string to the corresponding type
1237  switch(m_conddbtable[n_column]->type)
1238  {
1239 //if the column data type is some kind of array it will be assumed that all values belong to a single cell thus returning 1(cell)
1240  case kArrayInt:
1241  {
1242  vector<long int> tmp;
1243  for (unsigned i=0; i<data.size(); i++)
1244  {
1245  if (data[i]=="NULL")
1246  {
1247  long int null;
1248  getNull(n_column, null);
1249  tmp.push_back(null);
1250  }
1251  else
1252  tmp.push_back(atol(data[i].c_str()));
1253  }
1254  index= setColumndata(n_column, tmp);
1255  break;
1256  }
1257  case kArrayBool:
1258  {
1259  vector<short int> tmp;
1260  for (unsigned i=0; i<data.size(); i++)
1261  {
1262  if (data[i]=="NULL")
1263  {
1264  short int null = -1;
1265  tmp.push_back(null);
1266  }
1267  else
1268  tmp.push_back(atoi(data[i].c_str()));
1269  }
1270  index = setColumndata(n_column, tmp);
1271  break;
1272  }
1273  case kArrayLongLong:
1274  {
1275  vector<int64> tmp;
1276  for (unsigned i=0; i<data.size(); i++)
1277  {
1278  if (data[i]=="NULL")
1279  {
1280  int64 null;
1281  getNull(n_column, null);
1282  tmp.push_back(null);
1283  }
1284  else
1285  tmp.push_back(atoi64(data[i].c_str()));
1286  }
1287  index = setColumndata(n_column, tmp);
1288  break;
1289  }
1290  case kArrayFloat:
1291  {
1293  for (unsigned i=0; i<data.size(); i++)
1294  {
1295  if (data[i]=="NULL")
1296  {
1297  float null;
1298  getNull(n_column, null);
1299  tmp.push_back(null);
1300  }
1301  else
1302  tmp.push_back(atof(data[i].c_str()));
1303  }
1304  index = setColumndata(n_column, tmp);
1305  break;
1306  }
1307  case kArrayDouble:
1308  {
1310  for (unsigned i=0; i<data.size(); i++)
1311  {
1312  if (data[i]=="NULL")
1313  {
1314  double null;
1315  getNull(n_column, null);
1316  tmp.push_back(null);
1317  }
1318  else
1319  tmp.push_back(strtod(data[i].c_str(), (char**)NULL));
1320  }
1321  index = setColumndata(n_column, tmp);
1322  break;
1323  }
1324 //If the column data type is not any array it will be inserted a value in each row!
1325  case kInt:
1326  {
1327  vector<long int> tmp;
1328  for (unsigned i=0; i<data.size(); i++)
1329  {
1330  if (data[i]=="NULL")
1331  {
1332  long int null;
1333  getNull(n_column, null);
1334  tmp.push_back(null);
1335  }
1336  else
1337  tmp.push_back(atol(data[i].c_str()));
1338  }
1339  index = setColumndata(n_column, tmp);
1340  break;
1341  }
1342  case kBool:
1343  {
1344  vector<short int> tmp;
1345  for (unsigned i=0; i<data.size(); i++)
1346  {
1347  if (data[i]=="NULL")
1348  {
1349  // for bool the null value is -1 (not editable by user)
1350  short int null = -1;
1351  tmp.push_back(null);
1352  }
1353  else
1354  tmp.push_back(atoi(data[i].c_str()));
1355  }
1356  index = setColumndata(n_column, tmp);
1357  break;
1358  }
1359  case kLongLong:
1360  {
1361  vector<int64> tmp;
1362  for (unsigned i=0; i<data.size(); i++)
1363  {
1364  if (data[i]=="NULL")
1365  {
1366  int64 null;
1367  getNull(n_column, null);
1368  tmp.push_back(null);
1369  }
1370  else
1371  tmp.push_back(atoi64(data[i].c_str()));
1372  }
1373  index = setColumndata(n_column, tmp);
1374  break;
1375  }
1376  case kFloat:
1377  {
1379  for (unsigned i=0; i<data.size(); i++)
1380  {
1381  if (data[i]=="NULL")
1382  {
1383  float null;
1384  getNull(n_column, null);
1385  tmp.push_back(null);
1386  }
1387  else
1388  tmp.push_back(atof(data[i].c_str()));
1389  }
1390  index = setColumndata(n_column, tmp);
1391  break;
1392  }
1393  case kDouble:
1394  {
1396  for (unsigned i=0; i<data.size(); i++)
1397  {
1398  if (data[i]=="NULL")
1399  {
1400  double null;
1401  getNull(n_column, null);
1402  tmp.push_back(null);
1403  }
1404  else
1405  tmp.push_back(strtod(data[i].c_str(), (char**)NULL));
1406  }
1407  index = setColumndata(n_column, tmp);
1408  break;
1409  }
1410  default:
1411  return CDB_STRTOARRAY_ERROR;
1412  }
1413 
1414  return index;
1415  }
1416  }
1417  else
1418  return CDB_RANGE_ERROR;
1419 }
1420 
1421 int GenericDbTable::setColumndata(unsigned n_column, const vector<double> &data)
1422 {
1423  CondDBColumnDouble *tmpColumn = static_cast<CondDBColumnDouble*>(m_conddbtable[n_column]);
1424  return __setColumnData(n_column, data, kDouble, tmpColumn);
1425 }
1426 
1427 int GenericDbTable::setColumndata(unsigned n_column, const vector<vector<long int> > &data)
1428 {
1429  CondDBColumnArrayInt *tmpColumn = static_cast<CondDBColumnArrayInt*>(m_conddbtable[n_column]);
1430  return __setColumnData(n_column, data, kArrayInt, tmpColumn);
1431 }
1432 
1433 int GenericDbTable::setColumndata(unsigned n_column, const vector<vector<int64> > &data)
1434 {
1435  CondDBColumnArrayLong *tmpColumn = static_cast<CondDBColumnArrayLong*>(m_conddbtable[n_column]);
1436  return __setColumnData(n_column, data, kArrayLongLong, tmpColumn);
1437 }
1438 
1439 int GenericDbTable::setColumndata(unsigned n_column, const vector<vector<short int> > &data)
1440 {
1441  CondDBColumnArrayBool *tmpColumn = static_cast<CondDBColumnArrayBool*>(m_conddbtable[n_column]);
1442  return __setColumnData(n_column, data, kArrayBool, tmpColumn);
1443 }
1444 
1445 int GenericDbTable::setColumndata(unsigned n_column, const vector<vector<float> > &data)
1446 {
1447  CondDBColumnArrayFloat *tmpColumn = static_cast<CondDBColumnArrayFloat*>(m_conddbtable[n_column]);
1448  return __setColumnData(n_column, data, kArrayFloat, tmpColumn);
1449 }
1450 
1451 int GenericDbTable::setColumndata(unsigned n_column, const vector<vector<double> > &data)
1452 {
1453  CondDBColumnArrayDouble *tmpColumn = static_cast<CondDBColumnArrayDouble*>(m_conddbtable[n_column]);
1454  return __setColumnData(n_column, data, kArrayDouble, tmpColumn);
1455 }
1456 
1457 int GenericDbTable::setColumndata(unsigned n_column, const vector<vector<string> > &data)
1458 {
1459  if (!m_isInitialized)
1460  return CDB_NOT_INITIALIZED;
1461 
1462  unsigned index = 0;
1463  if (n_column < m_conddbtable.size())
1464  {
1465  if (m_conddbtable[n_column]->type == kArrayString)
1466  {
1467  CondDBColumnArrayString* tmpColumn = static_cast<CondDBColumnArrayString*>(m_conddbtable[n_column]);
1468  while((tmpColumn->column.size() < m_numRows+1) && (index < data.size()))
1469  {
1470  tmpColumn->column.push_back(data[index]);
1471  index++;
1472  }
1473  return index;
1474  }
1475  else
1476  {
1477 // If the data type is not string we can convert the string to the corresponding type
1478  switch(m_conddbtable[n_column]->type)
1479  {
1480 //if the column data type is an array of any type each inner vector refers to a vector on a cell
1481  case kArrayInt:
1482  {
1483  vector<vector<long int> > aux;
1484  for (unsigned j=0; j<data.size(); j++)
1485  {
1486  vector<long int> tmp;
1487  for (unsigned i=0; i<data[j].size(); i++)
1488  {
1489  if (data[j][i]=="NULL")
1490  {
1491  long int null;
1492  getNull(n_column, null);
1493  tmp.push_back(null);
1494  }
1495  else
1496  tmp.push_back(atol(data[j][i].c_str()));
1497  }
1498  aux.push_back(tmp);
1499  }
1500  index = setColumndata(n_column, aux);
1501  break;
1502  }
1503  case kArrayLongLong:
1504  {
1505  vector<vector<int64> > aux;
1506  for (unsigned j=0; j<data.size(); j++)
1507  {
1508  vector<int64> tmp;
1509  for (unsigned i=0; i<data[j].size(); i++)
1510  {
1511  if (data[j][i]=="NULL")
1512  {
1513  int64 null;
1514  getNull(n_column, null);
1515  tmp.push_back(null);
1516  }
1517  else
1518  tmp.push_back(atoi64(data[j][i].c_str()));
1519  }
1520  aux.push_back(tmp);
1521  }
1522  index = setColumndata(n_column, aux);
1523  break;
1524  }
1525  case kArrayBool:
1526  {
1527  vector<vector<short int> > aux;
1528  for (unsigned j=0; j<data.size(); j++)
1529  {
1530  vector<short int> tmp;
1531  for (unsigned i=0; i<data[j].size(); i++)
1532  {
1533  if (data[j][i]=="NULL")
1534  {
1535  tmp.push_back(-1);
1536  }
1537  else
1538  tmp.push_back(atoi(data[j][i].c_str()));
1539  }
1540  aux.push_back(tmp);
1541  }
1542  index = setColumndata(n_column, aux);
1543  break;
1544  }
1545  case kArrayFloat:
1546  {
1547  vector<vector<float> > aux;
1548  for (unsigned j=0; j<data.size(); j++)
1549  {
1551  for (unsigned i=0; i<data[j].size(); i++)
1552  {
1553  if (data[j][i]=="NULL")
1554  {
1555  float null;
1556  getNull(n_column, null);
1557  tmp.push_back(null);
1558  }
1559  else
1560  tmp.push_back(atof(data[j][i].c_str()));
1561  }
1562  aux.push_back(tmp);
1563  }
1564  index = setColumndata(n_column, aux);
1565  break;
1566  }
1567  case kArrayDouble:
1568  {
1569  vector<vector<double> > aux;
1570  for (unsigned j=0; j<data.size(); j++)
1571  {
1573  for (unsigned i=0; i<data[j].size(); i++)
1574  {
1575  if (data[j][i]=="NULL")
1576  {
1577  double null;
1578  getNull(n_column, null);
1579  tmp.push_back(null);
1580  }
1581  else
1582  tmp.push_back(strtod(data[j][i].c_str(), (char**)NULL));
1583  }
1584  aux.push_back(tmp);
1585  }
1586  index = setColumndata(n_column, aux);
1587  break;
1588  }
1589  default:
1590  return CDB_STRTOARRAY_ERROR;
1591  }
1592  return index;
1593  }
1594  }
1595  else
1596  return CDB_RANGE_ERROR;
1597 
1598 }
1599 
1601 // resize() - realocates space for table.
1602 //
1603 // The number of rows is the number of new rows to allocate
1605 
1606 void GenericDbTable::resize(int num_rows)
1607 {
1608  m_numRows += num_rows;
1609 }
1610 
1612 // getRow() - return a vector of strings with the values of a row
1613 //
1614 // it returns an error code *TO BE IMPLEMENTED*
1616 int GenericDbTable::getRow(unsigned n_row, vector<string> &values) const
1617 {
1618  if (n_row < m_numRows)
1619  {
1620  for (unsigned i =0; i<m_conddbtable.size(); i++)
1621  {
1622  switch(m_conddbtable[i]->type)
1623  {
1624  case kInt:
1625  {
1626  long int tmp;
1627  getCell(i,n_row, tmp);
1628  values.push_back(ToString<long int>(tmp));
1629  break;
1630  }
1631  case kBool:
1632  {
1633  short int tmp;
1634  getCell(i,n_row, tmp);
1635  values.push_back(ToString<short int>(tmp));
1636  break;
1637  }
1638  case kLongLong:
1639  {
1640  int64 tmp;
1641  getCell(i,n_row, tmp);
1642  values.push_back(ToString<int64>(tmp));
1643  break;
1644  }
1645  case kFloat:
1646  {
1647  float tmp;
1648  getCell(i,n_row, tmp);
1649  values.push_back(ToString<float>(tmp));
1650  break;
1651 
1652  }
1653  case kString:
1654  {
1655  string tmp;
1656  getCell(i,n_row, tmp);
1657  values.push_back(ToString<string>(tmp));
1658  break;
1659 
1660  }
1661  case kDouble:
1662  {
1663  double tmp;
1664  getCell(i,n_row, tmp);
1665  values.push_back(ToString<double>(tmp));
1666  break;
1667 
1668  }
1669  case kArrayInt:
1670  {
1671  vector<long int> tmp;
1672  getCell(i,n_row, tmp);
1673  int size = tmp.size();
1674  values.push_back(ToString<int>(size));
1675  while(size)
1676  {
1677  values.push_back(ToString<long int>(tmp[size-1]));
1678  size--;
1679  }
1680  break;
1681 
1682  }
1683  case kArrayBool:
1684  {
1685  vector<short int> tmp;
1686  getCell(i,n_row, tmp);
1687  int size = tmp.size();
1688  values.push_back(ToString<int>(size));
1689  while(size)
1690  {
1691  values.push_back(ToString<short int>(tmp[size-1]));
1692  size--;
1693  }
1694  break;
1695 
1696  }
1697  case kArrayLongLong:
1698  {
1699  vector<int64> tmp;
1700  getCell(i,n_row, tmp);
1701  int size = tmp.size();
1702  values.push_back(ToString<int>(size));
1703  while(size)
1704  {
1705  values.push_back(ToString<int64>(tmp[size-1]));
1706  size--;
1707  }
1708  break;
1709 
1710  }
1711  case kArrayFloat:
1712  {
1714  getCell(i,n_row, tmp);
1715  int size = tmp.size();
1716  values.push_back(ToString<int>(size));
1717  while(size)
1718  {
1719  values.push_back(ToString<float>(tmp[size-1]));
1720  size--;
1721  }
1722  break;
1723 
1724  }
1725  case kArrayString:
1726  {
1728  getCell(i,n_row, tmp);
1729  int size = tmp.size();
1730  values.push_back(ToString<int>(size));
1731  while(size)
1732  {
1733  values.push_back(tmp[size-1]);
1734  size--;
1735  }
1736  break;
1737  }
1738  case kArrayDouble:
1739  {
1741  getCell(i,n_row, tmp);
1742  int size = tmp.size();
1743  values.push_back(ToString<int>(size));
1744  while(size)
1745  {
1746  values.push_back(ToString<double>(tmp[size-1]));
1747  size--;
1748  }
1749  break;
1750  }
1751  default: return CDB_TYPE_ERROR;
1752  }
1753  }
1754 
1755  }
1756  else
1757  return CDB_RANGE_ERROR;
1758 // sucess!
1759  return CDB_SUCCESS;
1760 }
1761 
1762 // verifies if all columns are intialized
1764 {
1765  bool aux = true;
1766 
1767  for (unsigned i=0; i< m_conddbtable.size(); i++)
1768  {
1769  if (!(m_conddbtable[i]->initialized))
1770  {
1771  aux = false;
1772  break;
1773  }
1774  }
1775 
1776  if (aux)
1777  m_isInitialized = true;
1778 }
1779 
1780 template <typename T, typename COLUMN>
1781  int GenericDbTable::__getCell(unsigned n_column, unsigned n_row, T &ndata, dataTypes type, COLUMN *tmpColumn) const
1782 {
1783 
1784  if (!m_isInitialized)
1785  return CDB_NOT_INITIALIZED;
1786 
1787  if ((m_numRows > n_row) && (m_conddbtable.size() > n_column))
1788  {
1789  if (m_conddbtable[n_column]->type == type)
1790  {
1791  if (tmpColumn->column.size() <= n_row)
1792  ndata = tmpColumn->column.back();
1793  else
1794  ndata = tmpColumn->column[n_row+1];
1795  }
1796 
1797  else
1798  return CDB_TYPE_ERROR;
1799  }
1800  else
1801  return CDB_RANGE_ERROR;
1802 
1803  return CDB_SUCCESS;
1804 }
1805 
1806 template <typename T, typename COLUMN>
1807  int GenericDbTable::__setCell(unsigned n_column, unsigned n_row, const T &ndata, dataTypes type, COLUMN *tmpColumn)
1808  {
1809  if (!m_isInitialized)
1810  return CDB_NOT_INITIALIZED;
1811 
1812  if ((m_numRows > n_row) && (m_conddbtable.size() > n_column))
1813  {
1814  if (m_conddbtable[n_column]->type == type)
1815  {
1816  // static_cast<COLUMN*>(m_conddbtable[n_column])->column[n_row+1] = ndata;
1817  if (tmpColumn->column.size() == (n_row+1))
1818  tmpColumn->column.push_back(ndata);
1819  else
1820  if (tmpColumn->column.size() < (n_row+1))
1821  {
1822  T tmp = tmpColumn->column.back();
1823 
1824  while((n_row)-tmpColumn->column.size())
1825  {
1826  tmpColumn->column.push_back(tmp);
1827  }
1828  tmpColumn->column.push_back(ndata);
1829  }
1830  else
1831  // if the cell already has a value
1832  tmpColumn->column[n_row+1] = ndata;
1833 
1834  return CDB_SUCCESS;
1835  }
1836  else
1837  return CDB_TYPE_ERROR;
1838  }
1839  else
1840  return CDB_RANGE_ERROR;
1841  }
1842 
1843 template <typename T, typename COLUMN>
1844 int GenericDbTable::__setColumnData(unsigned n_column, T &data, dataTypes type, COLUMN *tmpColumn)
1845 {
1846  if (!m_isInitialized)
1847  return CDB_NOT_INITIALIZED;
1848 
1849  unsigned index = 0;
1850  if (n_column < m_conddbtable.size())
1851  {
1852  if (m_conddbtable[n_column]->type == type)
1853  {
1854  while((tmpColumn->column.size() < m_numRows+1) && (index < data.size()))
1855  {
1856  tmpColumn->column.push_back(data[index]);
1857  index++;
1858  }
1859  return index;
1860 
1861  }
1862  else
1863  return CDB_TYPE_ERROR;
1864  }
1865  else
1866  return CDB_RANGE_ERROR;
1867 }
1868 
1869 template <typename T>
1870 int GenericDbTable::__getCellByName(const std::string& colName, unsigned int n_row, T &data) const
1871 {
1872  for (unsigned int i=0; i< m_conddbtable.size(); i++) {
1873  if (m_conddbtable[i]->name == colName)
1874  {
1875  return getCell(i,n_row,data);
1876  }
1877  }
1878  //if there's no column with this name return error
1879  return CDB_RANGE_ERROR;
1880 }
1881 
GenericDbTable::CondDBColumn
Definition of the columns.
Definition: GenericDbTable.h:663
GenericDbTable::CondDBColumn::type
dataTypes type
Definition: GenericDbTable.h:667
data
char data[hepevt_bytes_allocation_ATLAS]
Definition: HepEvt.cxx:11
GenericDbTable::CondDBColumnArrayString::column
std::vector< std::vector< std::string > > column
Definition: GenericDbTable.h:724
GenericDbTable::__getCell
int __getCell(unsigned n_column, unsigned n_row, T &ndata, dataTypes type, COLUMN *tmpColumn) const
Templated method that get's the data from a specified cell This is the method that does the real work...
Definition: GenericDbTable.cxx:1781
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
NULLLONG
#define NULLLONG
Definition: GenericDbTable.cxx:18
GenericDbTable::~GenericDbTable
~GenericDbTable()
Object destructor.
Definition: GenericDbTable.cxx:53
GenericDbTable::CondDBColumnFloat
Definition: GenericDbTable.h:688
GenericDbTable::CondDBColumnArrayFloat
Definition: GenericDbTable.h:718
GenericDbTable::CondDBColumnArrayBool
Definition: GenericDbTable.h:703
GenericDbTable::__setCell
int __setCell(unsigned n_column, unsigned n_row, const T &ndata, dataTypes type, COLUMN *tmpColumn)
Templated method that set's the data in a specified cell This is the method that does the real work.
Definition: GenericDbTable.cxx:1807
GenericDbTable::CondDBColumnLong::column
std::vector< int64 > column
Definition: GenericDbTable.h:678
GenericDbTable::__getCellByName
int __getCellByName(const std::string &colName, unsigned int n_row, T &data) const
Templated method that get's column data using the column name This method get's the desired column nu...
Definition: GenericDbTable.cxx:1870
GenericDbTable::kArrayBool
@ kArrayBool
Definition: GenericDbTable.h:32
index
Definition: index.py:1
GenericDbTable::CondDBColumnBool
Definition: GenericDbTable.h:672
GenericDbTable::CondDBColumnArrayDouble::column
std::vector< std::vector< double > > column
Definition: GenericDbTable.h:729
GenericDbTable::CondDBColumnBool::column
std::vector< short int > column
Definition: GenericDbTable.h:673
GenericDbTable::__getNull
int __getNull(T &data, COLUMN *tmpColumn) const
Templated method for handling the null values.
Definition: GenericDbTable.h:595
int64
long long int64
Definition: GenericDbTable.h:17
NULLINT
#define NULLINT
Definition: GenericDbTable.cxx:11
GenericDbTable::CondDBColumnFloat::column
std::vector< float > column
Definition: GenericDbTable.h:689
DeMoUpdate.column
dictionary column
Definition: DeMoUpdate.py:1110
atoi64
#define atoi64(x)
Definition: GenericDbTable.cxx:20
GenericDbTable::ToString
std::string ToString(const TYPE &t) const
Auxiliary function to convert any value to string.
Definition: GenericDbTable.h:651
GenericDbTable::kLongLong
@ kLongLong
Definition: GenericDbTable.h:31
GenericDbTable::CondDBColumnString::column
std::vector< std::string > column
Definition: GenericDbTable.h:694
GenericDbTable::CondDBColumnArrayDouble
Definition: GenericDbTable.h:728
GenericDbTable::setNull
int setNull(unsigned n_column, const float &null)
Set Null value for column.
Definition: GenericDbTable.cxx:651
NULLFLOAT
#define NULLFLOAT
Definition: GenericDbTable.cxx:12
GenericDbTable::kArrayInt
@ kArrayInt
Definition: GenericDbTable.h:34
GenericDbTable::m_conddbtable
std::vector< CondDBColumn * > m_conddbtable
Definition: GenericDbTable.h:734
GenericDbTable::getNames
int getNames(std::vector< std::string > &names) const
This method gets a vector containing the names of all columns in the table.
Definition: GenericDbTable.cxx:85
GenericDbTable::CondDBColumnInt::column
std::vector< long int > column
Definition: GenericDbTable.h:684
python.Bindings.values
values
Definition: Control/AthenaPython/python/Bindings.py:805
GenericDbTable::Initialize
void Initialize(unsigned n_columns, int n_rows=0)
This method initializes a table created by the default constructor If the table had the number of col...
Definition: GenericDbTable.cxx:61
GenericDbTable::kArrayLongLong
@ kArrayLongLong
Definition: GenericDbTable.h:37
GenericDbTable::kArrayFloat
@ kArrayFloat
Definition: GenericDbTable.h:33
GenericDbTable::setName
int setName(unsigned n_column, const std::string &name)
This method defines the name for a specified column.
Definition: GenericDbTable.cxx:337
GenericDbTable::resize
void resize(int num_rows)
Reserves more rows on the table.
Definition: GenericDbTable.cxx:1606
GenericDbTable::m_numRows
unsigned m_numRows
Definition: GenericDbTable.h:735
python.setupRTTAlg.size
int size
Definition: setupRTTAlg.py:39
NULLDOUBLE
#define NULLDOUBLE
Definition: GenericDbTable.cxx:13
GenericDbTable::getRow
int getRow(unsigned rowNumber, std::vector< std::string > &values) const
This method returns a vector of strings with allelements in a row In case the cell has an array the f...
Definition: GenericDbTable.cxx:1616
GenericDbTable::CondDBColumnArrayLong::column
std::vector< std::vector< int64 > > column
Definition: GenericDbTable.h:709
lumiFormat.i
int i
Definition: lumiFormat.py:85
GenericDbTable::CondDBColumnArrayFloat::column
std::vector< std::vector< float > > column
Definition: GenericDbTable.h:719
vector< string >
python.subdetectors.mmg.names
names
Definition: mmg.py:8
GenericDbTable::setType
int setType(unsigned n_column, dataTypes type)
This method defines the data type for a specified column.
Definition: GenericDbTable.cxx:356
GenericDbTable::getRowID
int getRowID(std::string &pID) const
This method returns, for a given ID, the row number.
Definition: GenericDbTable.cxx:111
GenericDbTable::CDB_SUCCESS
@ CDB_SUCCESS
Definition: GenericDbTable.h:45
GenericDbTable::kString
@ kString
Definition: GenericDbTable.h:29
GenericDbTable::__setColumnData
int __setColumnData(unsigned n_column, T &data, dataTypes type, COLUMN *tmpColumn)
Templated method that set's portions of data in a specified column This method is deprecated and henc...
Definition: GenericDbTable.cxx:1844
GenericDbTable::getTypes
int getTypes(std::vector< dataTypes > &types) const
This method gets a vector containing the data types of all columns in the table.
Definition: GenericDbTable.cxx:98
GenericDbTable::kArrayDouble
@ kArrayDouble
Definition: GenericDbTable.h:36
GenericDbTable::setCell
int setCell(unsigned n_column, unsigned n_row, const short int ndata)
set data methods
Definition: GenericDbTable.cxx:909
GenericDbTable::m_isInitialized
bool m_isInitialized
Definition: GenericDbTable.h:733
GenericDbTable::CondDBColumnLong
Definition: GenericDbTable.h:677
DeMoUpdate.tmp
string tmp
Definition: DeMoUpdate.py:1167
GenericDbTable::CondDBColumnDouble::column
std::vector< double > column
Definition: GenericDbTable.h:699
CxxUtils::atof
double atof(std::string_view str)
Converts a string into a double / float.
Definition: Control/CxxUtils/Root/StringUtils.cxx:91
GenericDbTable::CondDBColumnArrayLong
Definition: GenericDbTable.h:708
GenericDbTable::CondDBColumn::name
std::string name
Definition: GenericDbTable.h:666
GenericDbTable::kFloat
@ kFloat
Definition: GenericDbTable.h:28
GenericDbTable::getCell
int getCell(unsigned n_column, unsigned n_row, short int &ndata) const
This method gets a value from a cell in a column of long ints (int in MySQL)
Definition: GenericDbTable.cxx:706
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
GenericDbTable.h
GenericDbTable::kInt
@ kInt
Definition: GenericDbTable.h:27
GenericDbTable::CondDBColumnString
Definition: GenericDbTable.h:693
GenericDbTable::CDB_RANGE_ERROR
@ CDB_RANGE_ERROR
Definition: GenericDbTable.h:43
GenericDbTable::CDB_TYPE_ERROR
@ CDB_TYPE_ERROR
Definition: GenericDbTable.h:44
GenericDbTable::dataTypes
dataTypes
Definition: GenericDbTable.h:25
GenericDbTable::kDouble
@ kDouble
Definition: GenericDbTable.h:30
DeMoScan.index
string index
Definition: DeMoScan.py:364
GenericDbTable::verifyInitialization
void verifyInitialization()
Verifies if all columns are initialized.
Definition: GenericDbTable.cxx:1763
GenericDbTable::getNull
int getNull(unsigned n_column, float &null) const
Get Null value for column.
Definition: GenericDbTable.cxx:237
GenericDbTable::CondDBColumnArrayBool::column
std::vector< std::vector< short int > > column
Definition: GenericDbTable.h:704
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
GenericDbTable::CDB_NOT_INITIALIZED
@ CDB_NOT_INITIALIZED
Definition: GenericDbTable.h:42
GenericDbTable::setColumndata
int setColumndata(unsigned n_column, const std::vector< short int > &data)
The following methods allow to insert in the columns a group of values.
Definition: GenericDbTable.cxx:1203
GenericDbTable::CondDBColumnInt
Definition: GenericDbTable.h:683
GenericDbTable::kArrayString
@ kArrayString
Definition: GenericDbTable.h:35
GenericDbTable::GenericDbTable
GenericDbTable()
Default constructor.
Definition: GenericDbTable.h:55
CxxUtils::atoi
int atoi(std::string_view str)
Helper functions to unpack numbers decoded in string into integers and doubles The strings are requir...
Definition: Control/CxxUtils/Root/StringUtils.cxx:85
merge.status
status
Definition: merge.py:17
GenericDbTable::kBool
@ kBool
Definition: GenericDbTable.h:26
python.CaloScaleNoiseConfig.default
default
Definition: CaloScaleNoiseConfig.py:79
GenericDbTable::kNull
@ kNull
Definition: GenericDbTable.h:25
GenericDbTable::CondDBColumnArrayInt
Definition: GenericDbTable.h:713
GenericDbTable::CDB_STRTOARRAY_ERROR
@ CDB_STRTOARRAY_ERROR
Definition: GenericDbTable.h:47
GenericDbTable::CondDBColumnArrayString
Definition: GenericDbTable.h:723
TSU::T
unsigned long long T
Definition: L1TopoDataTypes.h:35
GenericDbTable::CondDBColumnArrayInt::column
std::vector< std::vector< long int > > column
Definition: GenericDbTable.h:714
GenericDbTable::CondDBColumnDouble
Definition: GenericDbTable.h:698