ATLAS Offline Software
RDBRecordset.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
16 #ifndef RDBACCESSSVC_RDBRECORDSET_H
17 #define RDBACCESSSVC_RDBRECORDSET_H
18 
20 #include "RDBVersionAccessor.h"
21 #include <string>
22 
23 class RDBAccessSvc;
24 class IRDBQuery;
25 
26 namespace coral
27 {
28  class ISessionProxy;
29 }
30 
38 class RDBRecordset final: public IRDBRecordset
39 {
40  public:
43  : m_accessSvc(accessSvc) {}
44 
48  void getData(coral::ISessionProxy* session
49  , const std::string& nodeName
50  , const std::string& tagName
51  , const std::string& tagId);
52 
54  unsigned int size() const override;
55 
57  std::string nodeName() const override;
58 
60  std::string tagName() const override;
61 
64  const IRDBRecord* operator[](unsigned int index) const override;
65 
67  IRDBRecordset::const_iterator begin() const override;
68 
70  IRDBRecordset::const_iterator end() const override;
71 
72  // Comparison operator
73  bool operator!=(const RDBRecordset& rhs) const;
74 
75  // Comparison results with other recordset
76  void compare(const RDBRecordset& rec, std::ostream& os) const;
77 
78  // Set table name only when retrieval of data has failed and
79  // an empty recordset needs to be returned to the client
80  void setNodeName(const std::string& nodeName);
81 
82  private:
83  std::string m_tableName{};
84  std::string m_tagName{};
87 };
88 
89 #endif
RDBRecordset::RDBRecordset
RDBRecordset(RDBAccessSvc *accessSvc)
Construct empty recordset.
Definition: RDBRecordset.h:42
RDBRecordset::tagName
std::string tagName() const override
Definition: RDBRecordset.cxx:131
RDBRecordset::m_accessSvc
RDBAccessSvc * m_accessSvc
Definition: RDBRecordset.h:86
index
Definition: index.py:1
RDBRecordset::end
IRDBRecordset::const_iterator end() const override
Definition: RDBRecordset.cxx:145
IRDBRecordset
IRDBRecordset is an abstract interface to the RDB Recordsets, which represent a snapshot of HVS-tagge...
Definition: IRDBRecordset.h:35
coral
Definition: ISecondaryEventSelector.h:19
RDBVersionAccessor.h
Definition of RDBVersionAccessor class.
RDBAccessSvc
RDBAccessSvc is the implementation of IRDBAccessSvc interface.
Definition: RDBAccessSvc.h:58
IRDBQuery
Definition: IRDBQuery.h:13
RDBRecordset::operator!=
bool operator!=(const RDBRecordset &rhs) const
Definition: RDBRecordset.cxx:150
RecordsVector
std::vector< IRDBRecord_ptr > RecordsVector
Definition: IRDBRecordset.h:24
RDBRecordset::nodeName
std::string nodeName() const override
Definition: RDBRecordset.cxx:126
RDBRecordset::size
unsigned int size() const override
Definition: RDBRecordset.cxx:121
ReadFromCoolCompare.os
os
Definition: ReadFromCoolCompare.py:231
RDBRecordset::m_tagName
std::string m_tagName
Definition: RDBRecordset.h:84
RDBRecordset::m_records
RecordsVector m_records
Definition: RDBRecordset.h:85
RDBRecordset::begin
IRDBRecordset::const_iterator begin() const override
Definition: RDBRecordset.cxx:140
RDBRecordset::m_tableName
std::string m_tableName
Definition: RDBRecordset.h:83
RDBRecordset::getData
void getData(coral::ISessionProxy *session, const std::string &nodeName, const std::string &tagName, const std::string &tagId)
Constructs SQL query and retrieves the data from DB.
Definition: RDBRecordset.cxx:39
IRDBRecord
IRDBRecord is one record in the IRDBRecordset object.
Definition: IRDBRecord.h:27
RDBRecordset::setNodeName
void setNodeName(const std::string &nodeName)
Definition: RDBRecordset.cxx:263
RDBRecordset::operator[]
const IRDBRecord * operator[](unsigned int index) const override
Definition: RDBRecordset.cxx:136
IRDBRecordset.h
Definition of the abstract IRDBRecordset interface.
IRDBRecordset::const_iterator
RecordsVector::const_iterator const_iterator
Definition: IRDBRecordset.h:52
RDBRecordset
RDBRecordset is an implementation of IRDBRecordset interface.
Definition: RDBRecordset.h:39
RDBRecordset::compare
void compare(const RDBRecordset &rec, std::ostream &os) const
Definition: RDBRecordset.cxx:165