8 #include <boost/tokenizer.hpp>
9 #include <boost/algorithm/string.hpp>
10 #include <boost/regex.hpp>
14 const std::string
r_t(
"\\[([0-9]+),([0-9]+)\\]");
15 const std::string
r_r =
"\\s*\\{" +
r_t +
"-" +
r_t +
"\\}\\s*";
16 const std::string
r_e =
"\\s*\\{" +
r_t +
"-" +
r_t +
"\\}=([0-9]+)\\s*";
17 const std::string
r_ef =
"\\s*\\{" +
r_t +
"-" +
r_t +
"\\}=(-*[0-9]*\\.*[0-9]*)\\s*";
26 base_class(
name,svcLoc)
42 msg().setLevel( m_outputLevel.value() );
44 if (!
sc.isSuccess()) {
45 warning () <<
"Base class could not be initialized" <<
endmsg;
46 return StatusCode::FAILURE;
51 return StatusCode::SUCCESS;
55 return StatusCode::FAILURE;
58 std::ostringstream
ost;
59 ost <<
" Printing CondDB registry";
61 ost << std::endl <<
" - id: " <<
e.first <<
" r:";
62 for (
auto r :
e.second) {
63 ost <<
" " <<
r.range() <<
" :: " << *
r.objPtr();
69 return StatusCode::SUCCESS;
81 std::ifstream ifs (
fname);
85 typedef boost::tokenizer<boost::char_separator<char> > tokenizer;
86 boost::char_separator<char>
sep(
" ");
90 while( getline (ifs,
line) ) {
93 size_t fh =
line.find(
"#");
94 if(
fh != std::string::npos)
96 if (
line.length() == 0)
continue;
101 std::string dbKey = *
it;
109 error() <<
"while reading " <<
fname <<
" problem parsing " << *
it
111 sc = StatusCode::FAILURE;
119 sc = StatusCode::FAILURE;
130 std::ostringstream
ost;
143 std::lock_guard<std::mutex> lock(
m_lock);
145 ost <<
"ASCIICondDbSvc::dump()";
159 std::ostringstream
ost;
166 for (
auto ie :
e.second ) {
173 return StatusCode::SUCCESS;
183 boost::regex_match(
s,
m,
rr);
189 if (
m.size() != 5) {
return false; }
192 EventIDBase
start(std::stoi(
m[1]), EventIDBase::UNDEFEVT, std::stoi(
m[2]));
193 EventIDBase
end(std::stoi(
m[3]), EventIDBase::UNDEFEVT, std::stoi(
m[4]));
210 boost::regex_match(
s,
m,
ref);
212 if (
m.size() != 6) {
return false; }
221 EventIDBase
start(0, EventIDBase::UNDEFEVT,
223 EventIDBase
end(EventIDBase::UNDEFNUM, EventIDBase::UNDEFEVT,
225 start.set_lumi_block(std::stoi(
m[1]));
226 end.set_lumi_block(std::stoi(
m[3]));
249 std::lock_guard<std::mutex> lock(
m_lock);
251 registry_t::const_iterator itr =
m_registry.find(dbKey);
254 error() <<
"getRange: no dbKey " << dbKey <<
" found in registry"
256 return StatusCode::FAILURE;
259 for (
auto e : itr->second) {
260 debug() <<
"compare " <<
e.range() <<
" with " << ctx.eventID()
262 if (
e.range().isInRange(EventIDBase(ctx.eventID()))) {
265 return StatusCode::SUCCESS;
269 error() <<
"getRange: no range for Time " << ctx.eventID()
270 <<
" found for dbKey " << dbKey <<
endmsg;
272 return StatusCode::FAILURE;