CMS 3D CMS Logo

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,
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
start
Definition: start.py:1
funct::false
false
Definition: Factorize.h:29
particleFlowZeroSuppressionECAL_cff.thresholds
thresholds
Definition: particleFlowZeroSuppressionECAL_cff.py:31
CalibrationSummaryClient_cfi.params
params
Definition: CalibrationSummaryClient_cfi.py:14
hcal
Definition: ConfigurationDatabase.cc:13
gather_cfg.cout
cout
Definition: gather_cfg.py:144
AlcaSiPixelAliHarvester0T_cff.method
method
Definition: AlcaSiPixelAliHarvester0T_cff.py:41
query.host
string host
Definition: query.py:115
data-class-funcs.classname
classname
Definition: data-class-funcs.py:33
dqmiodatasetharvest.db
db
Definition: dqmiodatasetharvest.py:119
trigger::size_type
uint16_t size_type
Definition: TriggerTypeDefs.h:18
GlobalPosition_Frontier_DevDB_cff.tag
tag
Definition: GlobalPosition_Frontier_DevDB_cff.py:11
mps_fire.end
end
Definition: mps_fire.py:242
unpackData-CaloStage2.pname
pname
Definition: unpackData-CaloStage2.py:76
xdaq_compat.h
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
query.port
int port
Definition: query.py:116
runTauDisplay.dtype
dtype
Definition: runTauDisplay.py:121
instance
static PFTauRenderPlugin instance
Definition: PFTauRenderPlugin.cc:70
EnviromentSettings.user
user
Definition: EnviromentSettings.py:30
std
Definition: JetResolutionObject.h:76
command_line.start
start
Definition: command_line.py:167
BeamSplash_cfg.version
version
Definition: BeamSplash_cfg.py:45