CMS 3D CMS Logo

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   class IOV {
00012   public:
00013     typedef std::pair<cond::Time_t, std::string> Item;
00014     typedef std::vector<Item> Container;
00015     typedef Container::iterator iterator;
00016     typedef Container::const_iterator const_iterator;
00017 
00018     IOV(){}
00019     IOV(int type, cond::Time_t since) :
00020       timetype(type), firstsince(since){}
00021     
00022     virtual ~IOV(){}
00023 
00024 
00025     size_t add(cond::Time_t time, std::string const & token) {
00026       iov.push_back(Item(time, token));
00027       return iov.size()-1;
00028     }
00029 
00030     iterator find(cond::Time_t time) {
00031       return std::lower_bound(iov.begin(),iov.end(),Item(time,""),
00032                               boost::bind(std::less<cond::Time_t>(),
00033                                           boost::bind(&Item::first,_1),
00034                                           boost::bind(&Item::first,_2)
00035                                           )
00036                               );
00037     }
00038 
00039     const_iterator find(cond::Time_t time) const {
00040       return std::lower_bound(iov.begin(),iov.end(),Item(time,""),
00041                               boost::bind(std::less<cond::Time_t>(),
00042                                           boost::bind(&Item::first,_1),
00043                                           boost::bind(&Item::first,_2)
00044                                           )
00045                               );
00046     }
00047 
00048 
00049     cond::TimeType timeType() const { return cond::timeTypeSpecs[timetype].type;}
00050 
00051     //std::map<unsigned long long,std::string> iov;
00052     Container iov;
00053     int timetype;
00054     cond::Time_t firstsince;
00055   };
00056 
00057 }//ns cond
00058 #endif

Generated on Tue Jun 9 17:26:08 2009 for CMSSW by  doxygen 1.5.4