ATLAS Offline Software
RDBRecord.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
15 #ifndef RDBACCESSSVC_RDBRECORD_H
16 #define RDBACCESSSVC_RDBRECORD_H
17 
18 #include "CoralBase/AttributeList.h"
21 #include <map>
22 #include <iosfwd>
23 
24 namespace coral
25 {
26  class ICursor;
27 }
28 
34 class RDBRecord final : public IRDBRecord
35 {
36  friend class RDBRecordset;
37 
38  public:
39 
40  RDBRecord (const RDBRecord&) = delete;
41  RDBRecord& operator= (const RDBRecord&) = delete;
42 
44  ~RDBRecord() override;
45 
49  bool isFieldNull(const std::string& fieldName) const override;
50 
54  int getInt(const std::string& fieldName) const override;
55 
59  long getLong(const std::string& fieldName) const override;
60 
64  double getDouble(const std::string& fieldName) const override;
65 
69  float getFloat(const std::string& fieldName) const override;
70 
74  virtual const std::string& getString(const std::string& fieldName) const override;
75 
76  // Access array values by index
77  // arrays are implemented using the field with names like NAME_0, NAME_1 etc.
78 
83  int getInt(const std::string& fieldName, unsigned int index) const override;
84 
89  long getLong(const std::string& fieldName, unsigned int index) const override;
90 
95  double getDouble(const std::string& fieldName, unsigned int index) const override;
96 
101  float getFloat(const std::string& fieldName, unsigned int index) const override;
102 
107  virtual const std::string& getString(const std::string& fieldName, unsigned int index) const override;
108 
109  // Comparison operator
110  bool operator!=(const RDBRecord& rhs) const;
111 
112  // Dump record to output stream
113  std::ostream& toOutputStream(std::ostream& os) const;
114 
115  protected:
120  RDBRecord(const coral::AttributeList& attList, const std::string& tableName);
121 
122  private:
123  typedef std::map<std::string, unsigned int, std::less<std::string> > FieldName2ListIndex;
124 
127 
130 
131  std::string m_tableName;
132 
133 };
134 
135 inline std::ostream& operator << (std::ostream& os, const RDBRecord& x)
136 {
137  x.toOutputStream(os);
138  return os;
139 }
140 
141 
142 #endif
143 
RDBRecord::m_tableName
std::string m_tableName
Definition: RDBRecord.h:131
index
Definition: index.py:1
RDBRecord::m_name2Index
FieldName2ListIndex m_name2Index
Definition: RDBRecord.h:128
RDBRecord::operator!=
bool operator!=(const RDBRecord &rhs) const
Definition: RDBRecord.cxx:233
RDBRecord
RDBRecord is one record in the RDBRecordset object.
Definition: RDBRecord.h:35
operator<<
std::ostream & operator<<(std::ostream &os, const RDBRecord &x)
Definition: RDBRecord.h:135
python.PyKernel.AttributeList
AttributeList
Definition: PyKernel.py:36
RDBRecord::FieldName2ListIndex
std::map< std::string, unsigned int, std::less< std::string > > FieldName2ListIndex
Definition: RDBRecord.h:123
x
#define x
RDBRecord::operator=
RDBRecord & operator=(const RDBRecord &)=delete
coral
Definition: ISecondaryEventSelector.h:19
RDBRecord::ATLAS_THREAD_SAFE
coral::AttributeList *m_values ATLAS_THREAD_SAFE
Definition: RDBRecord.h:129
taskman.fieldName
fieldName
Definition: taskman.py:492
ReadFromCoolCompare.os
os
Definition: ReadFromCoolCompare.py:231
RDBRecord::RDBRecord
RDBRecord()
Empty private constructor.
Definition: RDBRecord.h:126
RDBRecord::getInt
int getInt(const std::string &fieldName) const override
Get int field value.
Definition: RDBRecord.cxx:58
RDBRecord::getFloat
float getFloat(const std::string &fieldName) const override
Get float field value.
Definition: RDBRecord.cxx:115
RDBRecord::getLong
long getLong(const std::string &fieldName) const override
Get long field value.
Definition: RDBRecord.cxx:77
IRDBRecord.h
Definition of the abstract IRDBRecord interface.
IRDBRecord
IRDBRecord is one record in the IRDBRecordset object.
Definition: IRDBRecord.h:27
RDBRecord::getDouble
double getDouble(const std::string &fieldName) const override
Get double field value.
Definition: RDBRecord.cxx:99
RDBRecord::RDBRecord
RDBRecord(const RDBRecord &)=delete
RDBRecord::getString
virtual const std::string & getString(const std::string &fieldName) const override
Get string field value.
Definition: RDBRecord.cxx:131
checker_macros.h
Define macros for attributes used to control the static checker.
RDBRecord::toOutputStream
std::ostream & toOutputStream(std::ostream &os) const
Definition: RDBRecord.cxx:260
RDBRecord::isFieldNull
bool isFieldNull(const std::string &fieldName) const override
Check if the field value is NULL.
Definition: RDBRecord.cxx:47
RDBRecord::~RDBRecord
~RDBRecord() override
Destructor.
Definition: RDBRecord.cxx:42
RDBRecordset
RDBRecordset is an implementation of IRDBRecordset interface.
Definition: RDBRecordset.h:39