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 const & 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
cond::IOVRange::const_iterator m_begin
cond::IOVRange::const_iterator m_end
tuple db
Definition: EcalCondDB.py:151
const_iterator begin() const
Definition: IOVProxy.h:128
IOVRange range(cond::Time_t since, cond::Time_t till) const
Definition: IOVProxy.cc:239
#define min(a, b)
Definition: mlp_lapack.h:161
cond::CondDB db
unsigned int getStartTime() const
cond::IOVProxy iov
accept
Definition: HLTenums.h:22
tuple iov
Definition: o2o.py:307
const T & max(const T &a, const T &b)
tuple rdbms
Definition: EcalCondDB.py:150
#define end
Definition: vmac.h:38
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:31
std::string const & getToken() const
void setRange(unsigned int min, unsigned int max)
cond::RDBMS rdbms
unsigned int getTime() const