File indexing completed on 2024-04-06 12:00:05
0001 #ifndef _ConfigurationDatabaseImplOracle_hh_included
0002 #define _ConfigurationDatabaseImplOracle_hh_included 1
0003
0004 #include "CaloOnlineTools/HcalOnlineDb/interface/PluginManager.hh"
0005 #include "CaloOnlineTools/HcalOnlineDb/interface/ConfigurationDatabaseImpl.hh"
0006 #include "CaloOnlineTools/HcalOnlineDb/interface/ConfigurationDatabaseStandardXMLParser.hh"
0007
0008 #ifdef HAVE_XDAQ
0009 #include "xgi/Method.h"
0010 #include "xdata/xdata.h"
0011 #else
0012 #include <string>
0013 #endif
0014
0015
0016 #include "OnlineDB/Oracle/interface/Oracle.h"
0017
0018 #include "ConfigurationDatabaseStandardXMLParser.hh"
0019
0020 class ConfigurationDatabaseImplOracle : public hcal::ConfigurationDatabaseImpl {
0021 public:
0022 ConfigurationDatabaseImplOracle();
0023 ~ConfigurationDatabaseImplOracle() override;
0024 bool canHandleMethod(const std::string& method) const override;
0025 void connect(const std::string& accessor) noexcept(false) override;
0026 void disconnect() override;
0027
0028 void getLUTs(
0029 const std::string& tag,
0030 int crate,
0031 int slot,
0032 std::map<hcal::ConfigurationDatabase::LUTId, hcal::ConfigurationDatabase::LUT>& LUTs) noexcept(false) override;
0033
0034 void getLUTChecksums(const std::string& tag,
0035 std::map<hcal::ConfigurationDatabase::LUTId, hcal::ConfigurationDatabase::MD5Fingerprint>&
0036 checksums) noexcept(false) override;
0037
0038 void getPatterns(const std::string& tag,
0039 int crate,
0040 int slot,
0041 std::map<hcal::ConfigurationDatabase::PatternId, hcal::ConfigurationDatabase::HTRPattern>&
0042 patterns) noexcept(false) override;
0043
0044 void getRBXdata(const std::string& tag,
0045 const std::string& rbx,
0046 hcal::ConfigurationDatabase::RBXdatumType dtype,
0047 std::map<hcal::ConfigurationDatabase::RBXdatumId, hcal::ConfigurationDatabase::RBXdatum>&
0048 RBXdata) noexcept(false) override;
0049
0050 void getZSThresholds(const std::string& tag,
0051 int crate,
0052 int slot,
0053 std::map<hcal::ConfigurationDatabase::ZSChannelId, int>& thresholds) noexcept(false) override;
0054
0055 void getHLXMasks(const std::string& tag,
0056 int crate,
0057 int slot,
0058 std::map<hcal::ConfigurationDatabase::FPGAId, hcal::ConfigurationDatabase::HLXMasks>&
0059 masks) noexcept(false) override;
0060
0061
0062 oracle::occi::Connection* getConnection(void) override;
0063 oracle::occi::Environment* getEnvironment(void) override;
0064
0065 private:
0066
0067 oracle::occi::Environment* env_;
0068 oracle::occi::Connection* conn_;
0069
0070
0071
0072 ConfigurationDatabaseStandardXMLParser m_parser;
0073
0074 #ifdef HAVE_XDAQ
0075 xdata::String username_;
0076 xdata::String password_;
0077 xdata::String database_;
0078 #else
0079 std::string username_;
0080 std::string password_;
0081 std::string database_;
0082 #endif
0083
0084
0085 std::string lhwm_version;
0086
0087
0088 std::string clobToString(const oracle::occi::Clob&);
0089
0090 #ifdef HAVE_XDAQ
0091 std::string getParameter(cgicc::Cgicc& cgi, const std::string& name);
0092 #endif
0093
0094 void getLUTs_real(
0095 const std::string& tag,
0096 int crate,
0097 std::map<hcal::ConfigurationDatabase::LUTId, hcal::ConfigurationDatabase::LUT>& LUTs) noexcept(false);
0098 void getPatterns_real(const std::string& tag,
0099 int crate,
0100 std::map<hcal::ConfigurationDatabase::PatternId, hcal::ConfigurationDatabase::HTRPattern>&
0101 patterns) noexcept(false);
0102 void getHLXMasks_real(
0103 const std::string& tag,
0104 int crate,
0105 std::map<hcal::ConfigurationDatabase::FPGAId, hcal::ConfigurationDatabase::HLXMasks>& masks) noexcept(false);
0106
0107 struct LUTCache {
0108 void clear() {
0109 luts.clear();
0110 crate = -1;
0111 tag.clear();
0112 }
0113 std::map<hcal::ConfigurationDatabase::LUTId, hcal::ConfigurationDatabase::LUT> luts;
0114 int crate;
0115 std::string tag;
0116 } m_lutCache;
0117
0118 struct PatternCache {
0119 void clear() {
0120 patterns.clear();
0121 crate = -1;
0122 tag.clear();
0123 }
0124 std::map<hcal::ConfigurationDatabase::PatternId, hcal::ConfigurationDatabase::HTRPattern> patterns;
0125 int crate;
0126 std::string tag;
0127 } m_patternCache;
0128
0129 struct HLXMaskCache {
0130 void clear() {
0131 masks.clear();
0132 crate = -1;
0133 tag.clear();
0134 }
0135 std::map<hcal::ConfigurationDatabase::FPGAId, hcal::ConfigurationDatabase::HLXMasks> masks;
0136 int crate;
0137 std::string tag;
0138 } m_hlxMaskCache;
0139 };
0140
0141 #endif