RDBRecord is one record in the RDBRecordset object.
More...
#include <RDBRecord.h>
|
| | RDBRecord () |
| | Empty private constructor.
|
| template<typename T> |
| const T & | getGeneric (std::string_view fieldName) const |
| FieldName2ListIndex::const_iterator | getItr (std::string_view fieldName) const |
| FieldName2ListIndex::const_iterator | getItr (std::string_view fieldName, int) const |
RDBRecord is one record in the RDBRecordset object.
Definition at line 36 of file RDBRecord.h.
◆ FieldName2ListIndex
◆ RDBRecord() [1/3]
◆ ~RDBRecord()
| RDBRecord::~RDBRecord |
( |
| ) |
|
|
override |
Destructor.
Definition at line 41 of file RDBRecord.cxx.
42{
43 delete m_values;
44}
◆ RDBRecord() [2/3]
| RDBRecord::RDBRecord |
( |
const coral::AttributeList & | attList, |
|
|
const std::string & | tableName ) |
|
protected |
Constructor used by RDBRecordset class.
- Parameters
-
| attList | [IN] pointer to the attribute list, source of the Record object |
| cursor | [IN] need to check if the field values are NULL |
| tableName | [IN] data table name in the database |
Definition at line 26 of file RDBRecord.cxx.
28 : m_values(0)
30{
31
32 m_values = new coral::AttributeList(attList.specification(), false);
33 m_values->fastCopyData (attList);
34
35 for(
unsigned int i=0;
i<m_values->size();
i++) {
36 std::string
key = (*m_values)[
i].specification().name();
38 }
39}
FieldName2ListIndex m_name2Index
◆ RDBRecord() [3/3]
Empty private constructor.
Definition at line 128 of file RDBRecord.h.
◆ getDouble() [1/2]
| double RDBRecord::getDouble |
( |
std::string_view | fieldName | ) |
const |
|
overridevirtual |
Get double field value.
- Parameters
-
- Returns
- field value
Implements IRDBRecord.
Definition at line 128 of file RDBRecord.cxx.
129{
131}
const T & getGeneric(std::string_view fieldName) const
◆ getDouble() [2/2]
| double RDBRecord::getDouble |
( |
std::string_view | fieldName, |
|
|
unsigned int | index ) const |
|
overridevirtual |
Get array double field value.
- Parameters
-
| fieldName | [IN] field name |
| index | [IN] index in the array |
- Returns
- field value
Implements IRDBRecord.
Definition at line 175 of file RDBRecord.cxx.
176{
178 const coral::AttributeList&
values = *m_values;
179 const auto &item =
values[
it->second];
180 if(item.specification().type()==typeid(double)) {
181 return item.data<double>();
182 }
183 else {
184 throw std::runtime_error( std::format("Field {} is NOT of double type",fieldName));
185 }
186}
FieldName2ListIndex::const_iterator getItr(std::string_view fieldName) const
◆ getFloat() [1/2]
| float RDBRecord::getFloat |
( |
std::string_view | fieldName | ) |
const |
|
overridevirtual |
◆ getFloat() [2/2]
| float RDBRecord::getFloat |
( |
std::string_view | fieldName, |
|
|
unsigned int | index ) const |
|
overridevirtual |
Get array float field value.
- Parameters
-
| fieldName | [IN] field name |
| index | [IN] index in the array |
- Returns
- field value
Implements IRDBRecord.
Definition at line 188 of file RDBRecord.cxx.
189{
191 const coral::AttributeList&
values = *m_values;
192 const auto &item =
values[
it->second];
193 if(item.specification().type()==typeid(float)) {
194 return item.data<float>();
195 }
196 else {
197 throw std::runtime_error( std::format("Field {} is NOT of float type", fieldName));
198 }
199}
◆ getGeneric()
template<typename T>
| const T & RDBRecord::getGeneric |
( |
std::string_view | fieldName | ) |
const |
|
private |
Definition at line 47 of file RDBRecord.cxx.
48{
52 throw std::runtime_error(std::format("Wrong name for the field {}", name));
53 }
54
55 const coral::AttributeList&
values = *m_values;
56 const auto &itr =
values[
it->second];
57 if(itr.specification().type()==typeid(T)) {
59 } else {
60 throw std::runtime_error(std::format(
"Field {} is NOT a type of {}", fieldName,
typeid(T).
name()));
61 }
62}
◆ getInt() [1/2]
| int RDBRecord::getInt |
( |
std::string_view | fieldName | ) |
const |
|
overridevirtual |
Get int field value.
- Parameters
-
- Returns
- field value
Implements IRDBRecord.
Definition at line 93 of file RDBRecord.cxx.
94{
96 const coral::AttributeList&
values = *m_values;
97 const auto& item =
values[
it->second];
98 if(item.specification().type()==typeid(int)) {
99 return item.data<int>();
100 }
101 else if(item.specification().type()==typeid(long)) {
102 return (int)item.data<long>();
103 }
104 else {
105 throw std::runtime_error( std::format("Field {} is NOT of integer type", fieldName));
106 }
107}
◆ getInt() [2/2]
| int RDBRecord::getInt |
( |
std::string_view | fieldName, |
|
|
unsigned int | index ) const |
|
overridevirtual |
Get array int field value.
- Parameters
-
| fieldName | [IN] field name |
| index | [IN] index in the array |
- Returns
- field value
Implements IRDBRecord.
Definition at line 143 of file RDBRecord.cxx.
144{
146 const coral::AttributeList&
values = *m_values;
147 const auto &item =
values[
it->second];
148 if(item.specification().type()==typeid(int)) {
149 return item.data<int>();
150 }
151 else if(item.specification().type()==typeid(long)) {
152 return (int)item.data<long>();
153 }
154 else {
155 throw std::runtime_error( std::format("Field {} is NOT of integer type", fieldName));
156 }
157}
◆ getItr() [1/2]
| RDBRecord::FieldName2ListIndex::const_iterator RDBRecord::getItr |
( |
std::string_view | fieldName | ) |
const |
|
private |
Definition at line 64 of file RDBRecord.cxx.
65{
69 throw std::runtime_error( "Wrong name for the field " + name);
70 }
72}
◆ getItr() [2/2]
| RDBRecord::FieldName2ListIndex::const_iterator RDBRecord::getItr |
( |
std::string_view | fieldName, |
|
|
int | index ) const |
|
private |
Definition at line 74 of file RDBRecord.cxx.
75{
76 const std::string
name =std::format(
"{}.{}_{}",
m_tableName, fieldName, index);
79 throw std::runtime_error(std::format(
"Wrong name for the array field {}.{} or index={} is out of range.",
m_tableName,fieldName,index));
80 }
82}
◆ getLong() [1/2]
| long RDBRecord::getLong |
( |
std::string_view | fieldName | ) |
const |
|
overridevirtual |
Get long field value.
- Parameters
-
- Returns
- field value
Implements IRDBRecord.
Definition at line 109 of file RDBRecord.cxx.
110{
112 const coral::AttributeList&
values = *m_values;
113 const auto& item =
values[
it->second];
114 if(item.specification().type()==typeid(long)) {
115 return item.data<long>();
116 }
117 else if(item.specification().type()==typeid(int)) {
118 return (long)item.data<int>();
119 }
120 else if(item.specification().type()==typeid(long long)) {
121 return (long)item.data<long long>();
122 }
123 else {
124 throw std::runtime_error( std::format("Field {} is NOT of long type",fieldName));
125 }
126}
◆ getLong() [2/2]
| long RDBRecord::getLong |
( |
std::string_view | fieldName, |
|
|
unsigned int | index ) const |
|
overridevirtual |
Get array long field value.
- Parameters
-
| fieldName | [IN] field name |
| index | [IN] index in the array |
- Returns
- field value
Implements IRDBRecord.
Definition at line 159 of file RDBRecord.cxx.
160{
162 const coral::AttributeList&
values = *m_values;
163 const auto &item =
values[
it->second];
164 if(item.specification().type()==typeid(long)) {
165 return item.data<long>();
166 }
167 else if(item.specification().type()==typeid(int)) {
168 return (long)item.data<int>();
169 }
170 else {
171 throw std::runtime_error( std::format("Field {} is NOT of long type", fieldName));
172 }
173}
◆ getString() [1/2]
| const std::string & RDBRecord::getString |
( |
std::string_view | fieldName, |
|
|
unsigned int | index ) const |
|
overridevirtual |
Get array string field value.
- Parameters
-
| fieldName | [IN] field name |
| index | [IN] index in the array |
- Returns
- field value
Implements IRDBRecord.
Definition at line 201 of file RDBRecord.cxx.
202{
204 const coral::AttributeList&
values = *m_values;
205 const auto &item =
values[
it->second];
206 if(item.specification().type()==typeid(std::string)) {
207 return item.data<std::string>();
208 }
209 else {
210 throw std::runtime_error( std::format("Field {} is NOT of string type", fieldName));
211 }
212}
◆ getString() [2/2]
| const std::string & RDBRecord::getString |
( |
std::string_view | string_view | ) |
const |
|
overridevirtual |
◆ isFieldNull()
| bool RDBRecord::isFieldNull |
( |
std::string_view | fieldName | ) |
const |
|
overridevirtual |
Check if the field value is NULL.
- Parameters
-
| fieldName | [IN] field name @retun TRUE if the field is NULL, FALSE otherwise |
Implements IRDBRecord.
Definition at line 85 of file RDBRecord.cxx.
86{
88
89 const coral::AttributeList&
values = *m_values;
91}
◆ operator!=()
Definition at line 214 of file RDBRecord.cxx.
215{
216 const coral::AttributeList& myAttList = *m_values;
217 const coral::AttributeList& rhsAttList = *rhs.m_values;
218
219 if(myAttList.size()!=rhsAttList.size()) return true;
220
221 for(
size_t i(0);
i<myAttList.size(); ++
i) {
222 const coral::Attribute& myAtt = myAttList[
i];
223 const std::string
name = myAtt.specification().name();
225 for(
size_t j(0);
j<rhsAttList.size(); ++
j) {
226 const coral::Attribute& rhsAtt = rhsAttList[
j];
227 if(rhsAtt.specification().name()==name) {
228 if(myAtt!=rhsAtt) {
229 return true;
230 }
232 break;
233 }
234 }
236 return true;
237 }
238 return false;
239}
bool exists(const std::string &filename)
does a file exist
float j(const xAOD::IParticle &, const xAOD::TrackMeasurementValidation &hit, const Eigen::Matrix3d &jab_inv)
◆ operator=()
◆ toOutputStream()
| std::ostream & RDBRecord::toOutputStream |
( |
std::ostream & | os | ) |
const |
Definition at line 241 of file RDBRecord.cxx.
242{
243 m_values->toOutputStream(os);
245}
◆ RDBRecordset
◆ ATLAS_THREAD_SAFE
| coral::AttributeList* m_values RDBRecord::ATLAS_THREAD_SAFE |
|
private |
◆ m_name2Index
◆ m_tableName
| std::string RDBRecord::m_tableName |
|
private |
The documentation for this class was generated from the following files: