Belle II Software  release-08-01-10
DBRecord.h
1 /**************************************************************************
2  * basf2 (Belle II Analysis Software Framework) *
3  * Author: The Belle II Collaboration *
4  * *
5  * See git log for contributors and copyright holders. *
6  * This file is licensed under LGPL-3.0, see LICENSE.md. *
7  **************************************************************************/
8 #ifndef _Belle2_DBRecord_h
9 #define _Belle2_DBRecord_h
10 
11 #include <string>
12 #include <vector>
13 #include <map>
14 
15 namespace Belle2 {
21  typedef std::map<std::string, std::string> DBFieldList;
22 
23  class DBRecord {
24 
25  public:
26  DBRecord() {};
27  ~DBRecord() {};
28 
29  public:
30  std::vector<std::string>& getFieldNames() { return m_name_v; }
31  DBFieldList& getFieldValues() { return m_value_m; }
32  bool hasField(const std::string& name)
33  {
34  return m_value_m.find(name) != m_value_m.end();
35  }
36  size_t getNFields() const { return m_name_v.size(); }
37  const std::string get(const std::string& name) const;
38  const std::string get(int i) const;
39  unsigned long long int getULLInt(const std::string& name) const;
40  int getInt(const std::string& name) const;
41  int getInt(int i) const;
42  bool getBool(const std::string& name) const;
43  bool getBool(int i) const;
44  float getFloat(const std::string& name) const;
45  float getFloat(int i) const;
46  std::vector<std::string> getArray(const std::string& name) const;
47  std::vector<std::string> getArray(int i) const;
48  std::vector<int> getIntArray(const std::string& name) const;
49  std::vector<int> getIntArray(int i) const;
50  std::vector<float> getFloatArray(const std::string& name) const;
51  std::vector<float> getFloatArray(int i) const;
52  const std::string getFieldName(int i) const;
53  void reset();
54  void add(std::string name, std::string value);
55 
56  private:
57  std::vector<std::string> m_name_v;
58  mutable DBFieldList m_value_m;
59 
60  };
61 
62  typedef std::vector<DBRecord> DBRecordList;
63 
65 }
66 
67 #endif
Abstract base class for different kinds of events.