CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
CondBasicIter.cc
Go to the documentation of this file.
2 
5 
7  const std::string & NameDB,
8  const std::string & Tag,
9  const std::string & User,
10  const std::string & Pass,
11  const std::string & nameBlob) :
12  rdbms(User,Pass),
13  db(rdbms.getDB(NameDB)),
14  iov(db.iov(Tag)),
15  m_begin( iov.begin() ),
16  m_end( iov.end() ){
17 }
18 
20  const std::string & Tag,
21  const std::string & auth
22  ):
23  rdbms(auth),
24  db(rdbms.getDB(NameDB)),
25  iov(db.iov(Tag)),
26  m_begin( iov.begin() ),
27  m_end( iov.end() ){
28 }
29 
31  const std::string & NameDB,
32  const std::string & Tag,
33  const std::string & User,
34  const std::string & Pass,
35  const std::string & nameBlob) {
36  rdbms = cond::RDBMS(User,Pass);
37  db = rdbms.getDB(NameDB);
38  iov = db.iov(Tag);
39  clear();
40 }
41 
42 void CondBasicIter::create(const std::string & NameDB,
43  const std::string & Tag,
44  const std::string & auth
45  ) {
46  rdbms = cond::RDBMS(auth);
47  db = rdbms.getDB(NameDB);
48  iov = db.iov(Tag);
49  clear();
50 }
51 
52 
53 void CondBasicIter::setRange(unsigned int min,unsigned int max){
54  cond::IOVRange rg = iov.range( min, max );
55  m_begin = rg.begin();
56  m_end = rg.end();
57  clear();
58 }
59 
60 void CondBasicIter::setMin(unsigned int min){
61  cond::IOVRange rg = iov.range( min, 0 );
62  m_begin = rg.begin();
63  m_end = rg.end();
64  clear();
65 }
66 
67 void CondBasicIter::setMax(unsigned int max){
68  cond::IOVRange rg = iov.range( 1, max );
69  m_begin = rg.begin();
70  m_end = rg.end();
71  clear();
72 }
73 
74 unsigned int CondBasicIter::getTime() const {return (getStartTime()+getStopTime())/2;}
75 
76 unsigned int CondBasicIter::getStartTime() const {return (*iter).since();}
77 
78 unsigned int CondBasicIter::getStopTime() const {return (*iter).till();}
79 
80 std::string CondBasicIter::getToken() const {return (*iter).token();}
81 
83  iter = m_begin;
84  return iter!=m_end;
85 
86 }
87 
89  ++iter;
90  return iter!=m_end;
91 }
92 
93 
95  return load(db.session(),(*iter).token());
96 }
97 
virtual void clear()=0
CondDB getDB(std::string const &db)
IOVProxy iov(std::string const &tag) const
IOVRange range(cond::Time_t since, cond::Time_t till) const
Definition: IOVProxy.cc:239
cond::IOVRange::const_iterator m_begin
Definition: hltDiff.cc:316
cond::IOVRange::const_iterator m_end
tuple db
Definition: EcalCondDB.py:151
const_iterator begin() const
Definition: IOVProxy.h:128
cond::CondDB db
unsigned int getStartTime() const
cond::IOVProxy iov
virtual ~CondBasicIter()
Definition: CondBasicIter.cc:4
tuple iov
Definition: o2o.py:307
tuple rdbms
Definition: EcalCondDB.py:150
#define end
Definition: vmac.h:37
T min(T a, T b)
Definition: MathUtil.h:58
virtual bool load(cond::DbSession &sess, std::string const &token)=0
DbSession & session() const
const_iterator end() const
Definition: IOVProxy.h:133
void create(const std::string &NameDB, const std::string &Tag, const std::string &User, const std::string &Pass, const std::string &nameBlob="")
void setMin(unsigned int min)
void setMax(unsigned int max)
cond::IOVProxy::const_iterator iter
unsigned int getStopTime() const
#define begin
Definition: vmac.h:30
void setRange(unsigned int min, unsigned int max)
std::string getToken() const
cond::RDBMS rdbms
unsigned int getTime() const