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 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164
#include "CaloOnlineTools/HcalOnlineDb/interface/ConfigurationDatabaseImpl.hh"

#ifndef HAVE_XDAQ
#include "CaloOnlineTools/HcalOnlineDb/interface/xdaq_compat.h"  // Includes typedef for log4cplus::Logger
#endif

#include <iostream>  // std::cout

namespace hcal {

  ConfigurationDatabaseImpl::ConfigurationDatabaseImpl() : m_logger(&std::cout) {}

  void ConfigurationDatabaseImpl::parseAccessor(const std::string& accessor,
                                                std::string& method,
                                                std::string& host,
                                                std::string& port,
                                                std::string& user,
                                                std::string& db,
                                                std::map<std::string, std::string>& params) {
    std::string::size_type start, end;

    method.clear();
    host.clear();
    port.clear();
    user.clear();
    db.clear();
    params.clear();

    if (accessor.empty())
      return;

    // method
    start = 0;
    end = accessor.find("://");
    if (end == std::string::npos)
      return;

    method = accessor.substr(start, end - start);
    start = end + 3;  // skip past ://

    end = accessor.find('@', start);  // user?
    if (end != std::string::npos) {
      user = accessor.substr(start, end - start);
      start = end + 1;
    }

    end = accessor.find(':', start);  // port?
    if (end != std::string::npos) {
      host = accessor.substr(start, end - start);  // host is here, port is next
      start = end + 1;
    }

    end = accessor.find('/', start);  // port or host
    if (end == std::string::npos)
      return;  // problems...
    if (host.empty())
      host = accessor.substr(start, end - start);
    else
      port = accessor.substr(start, end - start);
    start = end + 1;

    end = accessor.find('?', start);  // database
    if (end == std::string::npos) {
      db = accessor.substr(start);
      return;
    } else
      db = accessor.substr(start, end - start);
    start = end;  //  beginning of the parameters

    // parameters
    std::string pname, pvalue;
    while (start != std::string::npos) {
      start += 1;
      end = accessor.find('=', start);
      if (end == std::string::npos)
        break;  // no equals
      pname = accessor.substr(start, end - start);
      start = end + 1;
      end = accessor.find_first_of(",&", start);
      if (end == std::string::npos) {
        pvalue = accessor.substr(start);
      } else {
        pvalue = accessor.substr(start, end - start);
      }
      params[pname] = pvalue;
      start = end;
    }
  }

  std::vector<std::string> ConfigurationDatabaseImpl::getValidTags() noexcept(false) {
    XCEPT_RAISE(hcal::exception::ConfigurationDatabaseException, "Not implemented");
  }
  ConfigurationDatabase::ApplicationConfig ConfigurationDatabaseImpl::getApplicationConfig(
      const std::string& tag, const std::string& classname, int instance) noexcept(false) {
    XCEPT_RAISE(hcal::exception::ConfigurationDatabaseException, "Not implemented");
  }

  std::string ConfigurationDatabaseImpl::getConfigurationDocument(const std::string& tag) noexcept(false) {
    XCEPT_RAISE(hcal::exception::ConfigurationDatabaseException, "Not implemented");
  }

  unsigned int ConfigurationDatabaseImpl::getFirmwareChecksum(const std::string& board,
                                                              unsigned int version) noexcept(false) {
    XCEPT_RAISE(hcal::exception::ConfigurationDatabaseException, "Not implemented");
  }

  void ConfigurationDatabaseImpl::getFirmwareMCS(const std::string& board,
                                                 unsigned int version,
                                                 std::vector<std::string>& mcsLines) noexcept(false) {
    XCEPT_RAISE(hcal::exception::ConfigurationDatabaseException, "Not implemented");
  }
  void ConfigurationDatabaseImpl::getLUTs(
      const std::string& tag,
      int crate,
      int slot,
      std::map<ConfigurationDatabase::LUTId, ConfigurationDatabase::LUT>& LUTs) noexcept(false) {
    XCEPT_RAISE(hcal::exception::ConfigurationDatabaseException, "Not implemented");
  }
  void ConfigurationDatabaseImpl::getLUTChecksums(
      const std::string& tag,
      std::map<ConfigurationDatabase::LUTId, ConfigurationDatabase::MD5Fingerprint>& checksums) noexcept(false) {
    XCEPT_RAISE(hcal::exception::ConfigurationDatabaseException, "Not implemented");
  }
  void ConfigurationDatabaseImpl::getPatterns(
      const std::string& tag,
      int crate,
      int slot,
      std::map<ConfigurationDatabase::PatternId, ConfigurationDatabase::HTRPattern>& patterns) noexcept(false) {
    XCEPT_RAISE(hcal::exception::ConfigurationDatabaseException, "Not implemented");
  }
  void ConfigurationDatabaseImpl::getZSThresholds(
      const std::string& tag,
      int crate,
      int slot,
      std::map<ConfigurationDatabase::ZSChannelId, int>& thresholds) noexcept(false) {
    XCEPT_RAISE(hcal::exception::ConfigurationDatabaseException, "Not implemented");
  }
  void ConfigurationDatabaseImpl::getHLXMasks(
      const std::string& tag,
      int crate,
      int slot,
      std::map<ConfigurationDatabase::FPGAId, ConfigurationDatabase::HLXMasks>& masks) noexcept(false) {
    XCEPT_RAISE(hcal::exception::ConfigurationDatabaseException, "Not implemented");
  }
  void ConfigurationDatabaseImpl::getRBXdata(
      const std::string& tag,
      const std::string& rbx,
      ConfigurationDatabase::RBXdatumType dtype,
      std::map<ConfigurationDatabase::RBXdatumId, ConfigurationDatabase::RBXdatum>& RBXdata) noexcept(false) {
    XCEPT_RAISE(hcal::exception::ConfigurationDatabaseException, "Not implemented");
  }
  void ConfigurationDatabaseImpl::getRBXpatterns(
      const std::string& tag,
      const std::string& rbx,
      std::map<ConfigurationDatabase::RBXdatumId, ConfigurationDatabase::RBXpattern>& patterns) noexcept(false) {
    XCEPT_RAISE(hcal::exception::ConfigurationDatabaseException, "Not implemented");
  }

  // added by Gena Kukartsev
  oracle::occi::Connection* ConfigurationDatabaseImpl::getConnection(void) { return nullptr; }

  oracle::occi::Environment* ConfigurationDatabaseImpl::getEnvironment(void) { return nullptr; }

}  // namespace hcal