Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141
#ifndef _ConfigurationDatabaseImplOracle_hh_included
#define _ConfigurationDatabaseImplOracle_hh_included 1

#include "CaloOnlineTools/HcalOnlineDb/interface/PluginManager.hh"
#include "CaloOnlineTools/HcalOnlineDb/interface/ConfigurationDatabaseImpl.hh"
#include "CaloOnlineTools/HcalOnlineDb/interface/ConfigurationDatabaseStandardXMLParser.hh"

#ifdef HAVE_XDAQ
#include "xgi/Method.h"
#include "xdata/xdata.h"
#else
#include <string>
#endif

//OCCI include
#include "OnlineDB/Oracle/interface/Oracle.h"

#include "ConfigurationDatabaseStandardXMLParser.hh"

class ConfigurationDatabaseImplOracle : public hcal::ConfigurationDatabaseImpl {
public:
  ConfigurationDatabaseImplOracle();
  ~ConfigurationDatabaseImplOracle() override;
  bool canHandleMethod(const std::string& method) const override;
  void connect(const std::string& accessor) noexcept(false) override;
  void disconnect() override;

  void getLUTs(
      const std::string& tag,
      int crate,
      int slot,
      std::map<hcal::ConfigurationDatabase::LUTId, hcal::ConfigurationDatabase::LUT>& LUTs) noexcept(false) override;

  void getLUTChecksums(const std::string& tag,
                       std::map<hcal::ConfigurationDatabase::LUTId, hcal::ConfigurationDatabase::MD5Fingerprint>&
                           checksums) noexcept(false) override;

  void getPatterns(const std::string& tag,
                   int crate,
                   int slot,
                   std::map<hcal::ConfigurationDatabase::PatternId, hcal::ConfigurationDatabase::HTRPattern>&
                       patterns) noexcept(false) override;

  void getRBXdata(const std::string& tag,
                  const std::string& rbx,
                  hcal::ConfigurationDatabase::RBXdatumType dtype,
                  std::map<hcal::ConfigurationDatabase::RBXdatumId, hcal::ConfigurationDatabase::RBXdatum>&
                      RBXdata) noexcept(false) override;

  void getZSThresholds(const std::string& tag,
                       int crate,
                       int slot,
                       std::map<hcal::ConfigurationDatabase::ZSChannelId, int>& thresholds) noexcept(false) override;

  void getHLXMasks(const std::string& tag,
                   int crate,
                   int slot,
                   std::map<hcal::ConfigurationDatabase::FPGAId, hcal::ConfigurationDatabase::HLXMasks>&
                       masks) noexcept(false) override;

  // added by Gena Kukartsev
  oracle::occi::Connection* getConnection(void) override;
  oracle::occi::Environment* getEnvironment(void) override;

private:
  //OCCI Env, Conn
  oracle::occi::Environment* env_;
  oracle::occi::Connection* conn_;

  //oracle::occi::Connection* getConnection() throw (xgi::exception::Exception);

  ConfigurationDatabaseStandardXMLParser m_parser;

#ifdef HAVE_XDAQ
  xdata::String username_;
  xdata::String password_;
  xdata::String database_;
#else
  std::string username_;
  std::string password_;
  std::string database_;
#endif

  //Used by getZSThresholds
  std::string lhwm_version;

  //Utility methods
  std::string clobToString(const oracle::occi::Clob&);

#ifdef HAVE_XDAQ
  std::string getParameter(cgicc::Cgicc& cgi, const std::string& name);
#endif

  void getLUTs_real(
      const std::string& tag,
      int crate,
      std::map<hcal::ConfigurationDatabase::LUTId, hcal::ConfigurationDatabase::LUT>& LUTs) noexcept(false);
  void getPatterns_real(const std::string& tag,
                        int crate,
                        std::map<hcal::ConfigurationDatabase::PatternId, hcal::ConfigurationDatabase::HTRPattern>&
                            patterns) noexcept(false);
  void getHLXMasks_real(
      const std::string& tag,
      int crate,
      std::map<hcal::ConfigurationDatabase::FPGAId, hcal::ConfigurationDatabase::HLXMasks>& masks) noexcept(false);

  struct LUTCache {
    void clear() {
      luts.clear();
      crate = -1;
      tag.clear();
    }
    std::map<hcal::ConfigurationDatabase::LUTId, hcal::ConfigurationDatabase::LUT> luts;
    int crate;
    std::string tag;
  } m_lutCache;

  struct PatternCache {
    void clear() {
      patterns.clear();
      crate = -1;
      tag.clear();
    }
    std::map<hcal::ConfigurationDatabase::PatternId, hcal::ConfigurationDatabase::HTRPattern> patterns;
    int crate;
    std::string tag;
  } m_patternCache;

  struct HLXMaskCache {
    void clear() {
      masks.clear();
      crate = -1;
      tag.clear();
    }
    std::map<hcal::ConfigurationDatabase::FPGAId, hcal::ConfigurationDatabase::HLXMasks> masks;
    int crate;
    std::string tag;
  } m_hlxMaskCache;
};

#endif