CMS 3D CMS Logo

/data/doxygen/doxygen-1.7.3/gen/CMSSW_4_2_8/src/CondCore/IOVService/src/IOV.h

Go to the documentation of this file.
00001 #ifndef IOVService_IOV_h
00002 #define IOVService_IOV_h
00003 #include "CondCore/DBCommon/interface/Time.h"
00004 #include <vector>
00005 #include <string>
00006 #include <algorithm>
00007 #include <boost/bind.hpp>
00008 
00009 namespace cond {
00010 
00011   // old IOV (till cmssw 3.0.X)
00012   class IOV {
00013   public:
00014     typedef std::pair<cond::Time_t, std::string> Item;
00015     typedef std::vector<Item> Container;
00016     typedef Container::iterator iterator;
00017     typedef Container::const_iterator const_iterator;
00018 
00019     IOV(){}
00020     IOV(int type, cond::Time_t since) :
00021       timetype(type), firstsince(since){}
00022     
00023     virtual ~IOV(){}
00024 
00025 
00026     size_t add(cond::Time_t time, std::string const & token) {
00027       iov.push_back(Item(time, token));
00028       return iov.size()-1;
00029     }
00030 
00031     iterator find(cond::Time_t time) {
00032       return std::lower_bound(iov.begin(),iov.end(),Item(time,""),
00033                               boost::bind(std::less<cond::Time_t>(),
00034                                           boost::bind(&Item::first,_1),
00035                                           boost::bind(&Item::first,_2)
00036                                           )
00037                               );
00038     }
00039 
00040     const_iterator find(cond::Time_t time) const {
00041       return std::lower_bound(iov.begin(),iov.end(),Item(time,""),
00042                               boost::bind(std::less<cond::Time_t>(),
00043                                           boost::bind(&Item::first,_1),
00044                                           boost::bind(&Item::first,_2)
00045                                           )
00046                               );
00047     }
00048 
00049 
00050     cond::TimeType timeType() const { return cond::timeTypeSpecs[timetype].type;}
00051 
00052     //std::map<unsigned long long,std::string> iov;
00053     Container iov;
00054     int timetype;
00055     cond::Time_t firstsince;
00056   };
00057 
00058 }//ns cond
00059 #endif