ATLAS Offline Software
Loading...
Searching...
No Matches
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
14
15#ifndef RDBACCESSSVC_RDBRECORD_H
16#define RDBACCESSSVC_RDBRECORD_H
17
18#include "CoralBase/AttributeList.h"
21#include <map>
22#include <iosfwd>
23
24namespace coral
25{
26 class ICursor;
27}
28
34class 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
129 coral::AttributeList* m_values ATLAS_THREAD_SAFE;
130
131 std::string m_tableName;
132
133};
134
135inline std::ostream& operator << (std::ostream& os, const RDBRecord& x)
136{
137 x.toOutputStream(os);
138 return os;
139}
140
141
142#endif
143
Definition of the abstract IRDBRecord interface.
std::ostream & operator<<(std::ostream &os, const RDBRecord &x)
Definition RDBRecord.h:135
#define x
Define macros for attributes used to control the static checker.
IRDBRecord is one record in the IRDBRecordset object.
Definition IRDBRecord.h:27
RDBRecord is one record in the RDBRecordset object.
Definition RDBRecord.h:35
bool isFieldNull(const std::string &fieldName) const override
Check if the field value is NULL.
Definition RDBRecord.cxx:47
bool operator!=(const RDBRecord &rhs) const
RDBRecord(const RDBRecord &)=delete
RDBRecord & operator=(const RDBRecord &)=delete
std::ostream & toOutputStream(std::ostream &os) const
friend class RDBRecordset
Definition RDBRecord.h:36
RDBRecord()
Empty private constructor.
Definition RDBRecord.h:126
virtual const std::string & getString(const std::string &fieldName) const override
Get string field value.
~RDBRecord() override
Destructor.
Definition RDBRecord.cxx:42
coral::AttributeList *m_values ATLAS_THREAD_SAFE
Definition RDBRecord.h:129
std::string m_tableName
Definition RDBRecord.h:131
std::map< std::string, unsigned int, std::less< std::string > > FieldName2ListIndex
Definition RDBRecord.h:123
double getDouble(const std::string &fieldName) const override
Get double field value.
Definition RDBRecord.cxx:99
long getLong(const std::string &fieldName) const override
Get long field value.
Definition RDBRecord.cxx:77
float getFloat(const std::string &fieldName) const override
Get float field value.
int getInt(const std::string &fieldName) const override
Get int field value.
Definition RDBRecord.cxx:58
FieldName2ListIndex m_name2Index
Definition RDBRecord.h:128
Definition index.py:1