CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch9/src/CondCore/Utilities/src/CondBasicIter.cc

Go to the documentation of this file.
00001 #include "CondCore/Utilities/interface/CondBasicIter.h"
00002 
00003 CondBasicIter::CondBasicIter(){}
00004 CondBasicIter::~CondBasicIter(){}
00005 
00006 CondBasicIter::CondBasicIter(
00007                              const std::string & NameDB,
00008                              const std::string & Tag,
00009                              const std::string & User,
00010                              const std::string & Pass,
00011                              const std::string & nameBlob) :
00012   rdbms(User,Pass), db(rdbms.getDB(NameDB)), iov(db.iov(Tag))
00013 {
00014 }
00015 
00016 CondBasicIter::CondBasicIter(const std::string & NameDB,
00017               const std::string & Tag,
00018               const std::string & auth
00019               ):
00020   rdbms(auth), db(rdbms.getDB(NameDB)), iov(db.iov(Tag))
00021 {
00022 }
00023 
00024 void CondBasicIter::create(
00025                            const std::string & NameDB,
00026                            const std::string & Tag,
00027                            const std::string & User,
00028                            const std::string & Pass,
00029                            const std::string & nameBlob) {
00030   rdbms = cond::RDBMS(User,Pass);
00031   db = rdbms.getDB(NameDB);
00032   iov = db.iov(Tag);
00033   clear();
00034 }
00035 
00036 void CondBasicIter::create(const std::string & NameDB,
00037                            const std::string & Tag,
00038                            const std::string & auth
00039                            ) {
00040   rdbms = cond::RDBMS(auth);
00041   db = rdbms.getDB(NameDB);
00042   iov = db.iov(Tag);
00043   clear();
00044 }
00045 
00046 
00047 void CondBasicIter::setRange(unsigned int min,unsigned int max){
00048   iov.setRange(min,max);
00049   clear();
00050 }
00051 
00052 void CondBasicIter::setMin(unsigned int min){
00053   iov.setRange(min,0);
00054   clear();
00055 }
00056 
00057 void CondBasicIter::setMax(unsigned int max){
00058   iov.setRange(1,max);
00059   clear();
00060 }
00061 
00062 
00063 
00064 unsigned int CondBasicIter::getTime()  const {return (getStartTime()+getStopTime())/2;}
00065 
00066 unsigned int CondBasicIter::getStartTime()  const {return (*iter).since();}
00067 
00068 unsigned int CondBasicIter::getStopTime() const {return (*iter).till();}
00069 
00070 std::string const & CondBasicIter::getToken() const  {return (*iter).token();}
00071 
00072 
00073 bool CondBasicIter::init() {
00074   iter=iov.begin();
00075   return iter!=iov.end();
00076 
00077 }
00078 
00079 bool CondBasicIter::forward(){
00080   ++iter;
00081   return iter!=iov.end();
00082 }
00083 
00084 bool CondBasicIter::make(){
00085   return load((*iter).db(),(*iter).token());
00086 }
00087