8 #include "GaudiKernel/MsgStream.h"
20 std::string::size_type iofs=0;
21 std::string::size_type len=
input.size();
22 while (iofs!=std::string::npos && iofs<len) {
24 std::string::size_type iofs1=
input.find(
'<',iofs);
25 if (iofs1>iofs && iofs1!=std::string::npos) {
29 if (iofs1!=std::string::npos) {
32 std::string::size_type iofs2=
input.find(
'>',iofs1);
33 std::string::size_type iofs3=
input.find(
"/>",iofs1);
34 bool noClosingTag = (iofs2 == std::string::npos);
37 "Badly formed XML string, no closing tag in " <<
input <<
endmsg;
39 iofs=std::string::npos;
42 if (iofs2!=std::string::npos && iofs2<iofs3) {
46 std::string::size_type iofs4=
input.find(
"</"+
tag,iofs2+1);
47 if (iofs4!=std::string::npos) {
51 iofs=
input.find(
'>',iofs4);
52 if (iofs == std::string::npos) {
54 "Badly formed XML string, no closing tag in " <<
input <<
endmsg;
56 iofs=std::string::npos;
63 "Badly formed XML string, no closing tag in " <<
input <<
endmsg;
65 iofs=std::string::npos;
68 }
else if (iofs3!=std::string::npos) {
71 std::string::size_type iofs4=
input.find(
' ',iofs1+1);
73 if (iofs4!=std::string::npos && iofs4<iofs3) {
77 tag=
input.substr(iofs1+1,iofs3-iofs1-1);
85 log <<
MSG::FATAL <<
"Badly formed XML string, no closing > in input " <<
87 iofs=std::string::npos;
100 for (KeyValMap::const_iterator itr=
m_keys.begin();itr!=
m_keys.end();++itr) {
109 std::string&
value)
const {
117 const auto [theValue,
found] =
at(
key,defvalue);
122 std::pair<std::string, bool>
123 IOVDbParser::at(
const std::string & searchKey,
const std::string &defaultValue)
const{
124 KeyValMap::const_iterator
it =
m_keys.find(searchKey);
129 return std::pair<std::string, bool> (defaultValue,
false);
144 return at(
"key").second;
149 return at(
"tag").first;
154 return at(
"eventStoreName",
"StoreGateSvc").first;
159 return (
at(
"timeStamp").
first==
"time");
164 return at(
"cache").first;
169 auto valuePair=
at(
"cachehint");
170 return valuePair.second ? std::stoi(valuePair.first) : 0;
175 return at(
"named").second;
180 return at(
"metaOnly").second;
185 return at(
"extensible").second;
192 auto [addrHeader,foundHeader]=
at(
"addrHeader");
197 if (
auto addrPair=addrH.
at(
"address_header");addrPair.second) {
207 return at(
"addrHeader").first;
210 std::vector<std::string>
212 const auto & symLinkString =
at(
"symlinks").first;
218 return at(
"noover").second;
223 auto it=
m_keys.find(
"dbConnection");
225 std::string connection=std::move(
it->second);
227 m_keys[
"db"]=std::move(connection);
234 unsigned keyCounter=0;
235 for (
const auto& otherKeyValue :
other.m_keys) {
236 const std::string& otherKey=otherKeyValue.first;
237 const std::string& otherValue=otherKeyValue.second;
238 if (otherKey.empty())
continue;
239 if (otherKey==
"prefix")
continue;
242 log << MSG::INFO <<
"Folder " <<
m_keys[
""] <<
", adding new key " << otherKey
243 <<
" with value " << otherValue <<
endmsg;
244 m_keys[otherKey]=otherValue;
247 log << MSG::INFO <<
"Folder " <<
m_keys[
""] <<
", Key: " << otherKey
248 <<
"Overriding existing value " <<
m_keys[otherKey] <<
" to new value " << otherValue <<
endmsg;
249 it->second=otherValue;
275 bool overrideIs_nsEpochIov{
true};
276 const bool overridingTimestamp=(
m_keys.find(
"forceTimestamp")!=
m_keys.end());
277 const bool overridingRun=(
m_keys.find(
"forceRunNumber")!=
m_keys.end());
278 const bool overridingLumi=(
m_keys.find(
"forceLumiblockNumber")!=
m_keys.end());
281 if (overridingLumi and not overridingRun){
282 msg << MSG::WARNING<<
"Trying to override lumi block without specifying the run"<<
endmsg;
286 if (overridingRun and overridingTimestamp){
287 msg << MSG::WARNING<<
"Trying to override using both run-lumi and ns timestamp"<<
endmsg;
291 if (overridingRun) overrideIs_nsEpochIov=
false;
293 if (performFolderCheck and (overrideIs_nsEpochIov != folderIs_nsOfEpoch)){
294 msg << MSG::WARNING<<
"Trying to override run-lumi for a ns folder, or ns for a run-lumi folder"<<
endmsg;
297 return (overridingTimestamp or overridingRun);
302 unsigned long long value{};
304 auto pTsPair =
m_keys.find(
"forceTimestamp");
305 if (pTsPair!=
m_keys.end()){
309 auto pRunPair =
m_keys.find(
"forceRunNumber");
310 auto pLumiPair =
m_keys.find(
"forceLumiblockNumber");
311 const auto & runString = (pRunPair!=
m_keys.end()) ? pRunPair->second :
"";
312 const auto & lumiString = (pLumiPair!=
m_keys.end()) ? pLumiPair->second :
"";
324 retval <<
", Attributes: ";
327 for (;
it!=it_e;++
it) {
328 if (
it->first.empty())
continue;
329 retval <<
"[" <<
it->first <<
":" <<
it->second <<
"] ";