CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
ConfigurationDatabaseImpl.cc
Go to the documentation of this file.
1 #include "CaloOnlineTools/HcalOnlineDb/interface/ConfigurationDatabaseImpl.hh"
2 
3 #ifndef HAVE_XDAQ
4 #include "CaloOnlineTools/HcalOnlineDb/interface/xdaq_compat.h" // Includes typedef for log4cplus::Logger
5 #endif
6 
7 #include <iostream> // std::cout
8 
9 namespace hcal {
10 
11  ConfigurationDatabaseImpl::ConfigurationDatabaseImpl() : m_logger(&std::cout) {}
12 
13  void ConfigurationDatabaseImpl::parseAccessor(const std::string& accessor,
14  std::string& method,
18  std::string& db,
19  std::map<std::string, std::string>& params) {
21 
22  method.clear();
23  host.clear();
24  port.clear();
25  user.clear();
26  db.clear();
27  params.clear();
28 
29  if (accessor.empty())
30  return;
31 
32  // method
33  start = 0;
34  end = accessor.find("://");
35  if (end == std::string::npos)
36  return;
37 
38  method = accessor.substr(start, end - start);
39  start = end + 3; // skip past ://
40 
41  end = accessor.find('@', start); // user?
42  if (end != std::string::npos) {
43  user = accessor.substr(start, end - start);
44  start = end + 1;
45  }
46 
47  end = accessor.find(':', start); // port?
48  if (end != std::string::npos) {
49  host = accessor.substr(start, end - start); // host is here, port is next
50  start = end + 1;
51  }
52 
53  end = accessor.find('/', start); // port or host
54  if (end == std::string::npos)
55  return; // problems...
56  if (host.empty())
57  host = accessor.substr(start, end - start);
58  else
59  port = accessor.substr(start, end - start);
60  start = end + 1;
61 
62  end = accessor.find('?', start); // database
63  if (end == std::string::npos) {
64  db = accessor.substr(start);
65  return;
66  } else
67  db = accessor.substr(start, end - start);
68  start = end; // beginning of the parameters
69 
70  // parameters
71  std::string pname, pvalue;
72  while (start != std::string::npos) {
73  start += 1;
74  end = accessor.find('=', start);
75  if (end == std::string::npos)
76  break; // no equals
77  pname = accessor.substr(start, end - start);
78  start = end + 1;
79  end = accessor.find_first_of(",&", start);
80  if (end == std::string::npos) {
81  pvalue = accessor.substr(start);
82  } else {
83  pvalue = accessor.substr(start, end - start);
84  }
85  params[pname] = pvalue;
86  start = end;
87  }
88  }
89 
90  std::vector<std::string> ConfigurationDatabaseImpl::getValidTags() noexcept(false) {
91  XCEPT_RAISE(hcal::exception::ConfigurationDatabaseException, "Not implemented");
92  }
93  ConfigurationDatabase::ApplicationConfig ConfigurationDatabaseImpl::getApplicationConfig(
94  const std::string& tag, const std::string& classname, int instance) noexcept(false) {
95  XCEPT_RAISE(hcal::exception::ConfigurationDatabaseException, "Not implemented");
96  }
97 
98  std::string ConfigurationDatabaseImpl::getConfigurationDocument(const std::string& tag) noexcept(false) {
99  XCEPT_RAISE(hcal::exception::ConfigurationDatabaseException, "Not implemented");
100  }
101 
102  unsigned int ConfigurationDatabaseImpl::getFirmwareChecksum(const std::string& board,
103  unsigned int version) noexcept(false) {
104  XCEPT_RAISE(hcal::exception::ConfigurationDatabaseException, "Not implemented");
105  }
106 
107  void ConfigurationDatabaseImpl::getFirmwareMCS(const std::string& board,
108  unsigned int version,
109  std::vector<std::string>& mcsLines) noexcept(false) {
110  XCEPT_RAISE(hcal::exception::ConfigurationDatabaseException, "Not implemented");
111  }
112  void ConfigurationDatabaseImpl::getLUTs(
113  const std::string& tag,
114  int crate,
115  int slot,
116  std::map<ConfigurationDatabase::LUTId, ConfigurationDatabase::LUT>& LUTs) noexcept(false) {
117  XCEPT_RAISE(hcal::exception::ConfigurationDatabaseException, "Not implemented");
118  }
119  void ConfigurationDatabaseImpl::getLUTChecksums(
120  const std::string& tag,
121  std::map<ConfigurationDatabase::LUTId, ConfigurationDatabase::MD5Fingerprint>& checksums) noexcept(false) {
122  XCEPT_RAISE(hcal::exception::ConfigurationDatabaseException, "Not implemented");
123  }
124  void ConfigurationDatabaseImpl::getPatterns(
125  const std::string& tag,
126  int crate,
127  int slot,
128  std::map<ConfigurationDatabase::PatternId, ConfigurationDatabase::HTRPattern>& patterns) noexcept(false) {
129  XCEPT_RAISE(hcal::exception::ConfigurationDatabaseException, "Not implemented");
130  }
131  void ConfigurationDatabaseImpl::getZSThresholds(
132  const std::string& tag,
133  int crate,
134  int slot,
135  std::map<ConfigurationDatabase::ZSChannelId, int>& thresholds) noexcept(false) {
136  XCEPT_RAISE(hcal::exception::ConfigurationDatabaseException, "Not implemented");
137  }
138  void ConfigurationDatabaseImpl::getHLXMasks(
139  const std::string& tag,
140  int crate,
141  int slot,
142  std::map<ConfigurationDatabase::FPGAId, ConfigurationDatabase::HLXMasks>& masks) noexcept(false) {
143  XCEPT_RAISE(hcal::exception::ConfigurationDatabaseException, "Not implemented");
144  }
145  void ConfigurationDatabaseImpl::getRBXdata(
146  const std::string& tag,
147  const std::string& rbx,
148  ConfigurationDatabase::RBXdatumType dtype,
149  std::map<ConfigurationDatabase::RBXdatumId, ConfigurationDatabase::RBXdatum>& RBXdata) noexcept(false) {
150  XCEPT_RAISE(hcal::exception::ConfigurationDatabaseException, "Not implemented");
151  }
152  void ConfigurationDatabaseImpl::getRBXpatterns(
153  const std::string& tag,
154  const std::string& rbx,
155  std::map<ConfigurationDatabase::RBXdatumId, ConfigurationDatabase::RBXpattern>& patterns) noexcept(false) {
156  XCEPT_RAISE(hcal::exception::ConfigurationDatabaseException, "Not implemented");
157  }
158 
159  // added by Gena Kukartsev
160  oracle::occi::Connection* ConfigurationDatabaseImpl::getConnection(void) { return nullptr; }
161 
162  oracle::occi::Environment* ConfigurationDatabaseImpl::getEnvironment(void) { return nullptr; }
163 
164 } // namespace hcal
static PFTauRenderPlugin instance
tuple db
Definition: EcalCondDB.py:153
uint16_t size_type
int port
Definition: query.py:116
string host
Definition: query.py:115
string end
Definition: dataset.py:937
tuple cout
Definition: gather_cfg.py:144