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)
36 msg().setLevel( m_outputLevel.value() );
38 if (!
sc.isSuccess()) {
39 warning () <<
"Base class could not be initialized" <<
endmsg;
40 return StatusCode::FAILURE;
45 return StatusCode::SUCCESS;
49 return StatusCode::FAILURE;
52 std::ostringstream
ost;
53 ost <<
" Printing CondDB registry";
55 ost << std::endl <<
" - id: " <<
e.first <<
" r:";
56 for (
auto r :
e.second) {
57 ost <<
" " <<
r.range() <<
" :: " << *
r.objPtr();
63 return StatusCode::SUCCESS;
75 std::ifstream ifs (
fname);
79 typedef boost::tokenizer<boost::char_separator<char> > tokenizer;
80 boost::char_separator<char>
sep(
" ");
84 while( getline (ifs,
line) ) {
87 size_t fh =
line.find(
"#");
88 if(
fh != std::string::npos)
90 if (
line.length() == 0)
continue;
95 std::string dbKey = *
it;
103 error() <<
"while reading " <<
fname <<
" problem parsing " << *
it
105 sc = StatusCode::FAILURE;
113 sc = StatusCode::FAILURE;
124 std::ostringstream
ost;
137 std::lock_guard<std::mutex> lock(
m_lock);
139 ost <<
"ASCIICondDbSvc::dump()";
153 std::ostringstream
ost;
160 for (
auto ie :
e.second ) {
167 return StatusCode::SUCCESS;
177 boost::regex_match(
s,
m,
rr);
183 if (
m.size() != 5) {
return false; }
186 EventIDBase
start(std::stoi(
m[1]), EventIDBase::UNDEFEVT, std::stoi(
m[2]));
187 EventIDBase
end(std::stoi(
m[3]), EventIDBase::UNDEFEVT, std::stoi(
m[4]));
204 boost::regex_match(
s,
m,
ref);
206 if (
m.size() != 6) {
return false; }
215 EventIDBase
start(0, EventIDBase::UNDEFEVT,
217 EventIDBase
end(EventIDBase::UNDEFNUM, EventIDBase::UNDEFEVT,
219 start.set_lumi_block(std::stoi(
m[1]));
220 end.set_lumi_block(std::stoi(
m[3]));
243 std::lock_guard<std::mutex> lock(
m_lock);
245 registry_t::const_iterator itr =
m_registry.find(dbKey);
248 error() <<
"getRange: no dbKey " << dbKey <<
" found in registry"
250 return StatusCode::FAILURE;
253 for (
auto e : itr->second) {
254 debug() <<
"compare " <<
e.range() <<
" with " << ctx.eventID()
256 if (
e.range().isInRange(EventIDBase(ctx.eventID()))) {
259 return StatusCode::SUCCESS;
263 error() <<
"getRange: no range for Time " << ctx.eventID()
264 <<
" found for dbKey " << dbKey <<
endmsg;
266 return StatusCode::FAILURE;