Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:01:55

0001 #include<iostream>
0002 #include<fstream>
0003 #include<string>
0004 #include<vector>
0005 #include<iterator>
0006 #include<utility>
0007 #include<algorithm>
0008 
0009 typedef std::pair<unsigned long long ,std::string> Item;
0010 
0011 void print(Item const & item) {
0012   std::cout << item.first << " " << item.second <<"\n";
0013 }
0014 
0015 int main() {
0016 
0017   std::string file("iovdump.txt");
0018 
0019   // parse iov dump for version 180
0020   std::ifstream in(file.c_str());
0021 
0022   std::string dummy;
0023   std::string tag;
0024   std::string contName;
0025 
0026   unsigned long long since, till;
0027   std::string token;
0028   std::vector<Item> values;
0029 
0030   in >> dummy >> tag;
0031   in >> dummy >> contName;
0032   char buff[1024];
0033   in.getline(buff,1024);
0034   in.getline(buff,1024);
0035   std::cout << buff << std::endl;
0036   char p;
0037   bool first=true;
0038   unsigned long long firstSince;
0039   while(in) {
0040     in.get(p); if (p=='T') break;
0041     in.putback(p);
0042     in >> since >> till >> token;  in.getline(buff,1024);
0043     values.push_back(Item(till,token));
0044     if (first) {
0045       first=false;
0046       firstSince=since;
0047     }
0048   }
0049 
0050   std::cout << tag << " " << contName 
0051         << " " << firstSince << std::endl;
0052   std::for_each(values.begin(),values.end(),&print);
0053   std::cout << std::endl;
0054   return 0;
0055 
0056 }