CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Protected Attributes | Private Attributes
CondBasicIter Class Referenceabstract

#include <CondBasicIter.h>

Inheritance diagram for CondBasicIter:
CondIter< DataT > CondIter< HDQMSummary > CondIter< T > CondCachedIter< HDQMSummary > CondCachedIter< T >

Public Member Functions

virtual void clear ()=0
 
 CondBasicIter ()
 
 CondBasicIter (const std::string &NameDB, const std::string &Tag, const std::string &User, const std::string &Pass, const std::string &nameBlob="")
 
 CondBasicIter (const std::string &NameDB, const std::string &Tag, const std::string &auth="")
 
void create (const std::string &NameDB, const std::string &Tag, const std::string &User, const std::string &Pass, const std::string &nameBlob="")
 
void create (const std::string &NameDB, const std::string &Tag, const std::string &auth="")
 
bool forward ()
 
unsigned int getStartTime () const
 
unsigned int getStopTime () const
 
unsigned int getTime () const
 
std::string const & getToken () const
 
bool init ()
 
virtual bool load (cond::DbSession &sess, std::string const &token)=0
 
bool make ()
 
void setMax (unsigned int max)
 
void setMin (unsigned int min)
 
void setRange (unsigned int min, unsigned int max)
 
 ~CondBasicIter ()
 

Protected Attributes

cond::CondDB db
 
cond::IOVProxy iov
 
cond::IOVProxy::const_iterator iter
 
cond::RDBMS rdbms
 

Private Attributes

cond::IOVRange::const_iterator m_begin
 
cond::IOVRange::const_iterator m_end
 

Detailed Description

Definition at line 10 of file CondBasicIter.h.

Constructor & Destructor Documentation

CondBasicIter::CondBasicIter ( )

Definition at line 3 of file CondBasicIter.cc.

3 {}
CondBasicIter::~CondBasicIter ( )

Definition at line 4 of file CondBasicIter.cc.

4 {}
CondBasicIter::CondBasicIter ( const std::string &  NameDB,
const std::string &  Tag,
const std::string &  User,
const std::string &  Pass,
const std::string &  nameBlob = "" 
)

tell Iter to point to a database. After this call Iter can be used. Direct Access to database through frontier It needs:

  • NameDB -> name of the database (connection string)
  • Tag -> Tag human-readable of the content of the database
  • User -> name of the User (if you don't need to authenticate don't write anything here)
  • Pass -> Password to access database (if you don't need to authenticate don't write anything here)
  • nameBlob -> to handle blob type of data (if it is not needed this field has to be left empty)

Definition at line 6 of file CondBasicIter.cc.

11  :
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 }
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
const_iterator begin() const
Definition: IOVProxy.h:188
cond::CondDB db
const_iterator end() const
Definition: IOVProxy.h:193
cond::IOVProxy iov
accept
Definition: HLTenums.h:22
cond::RDBMS rdbms
CondBasicIter::CondBasicIter ( const std::string &  NameDB,
const std::string &  Tag,
const std::string &  auth = "" 
)

Definition at line 19 of file CondBasicIter.cc.

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 }
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
const_iterator begin() const
Definition: IOVProxy.h:188
cond::CondDB db
const_iterator end() const
Definition: IOVProxy.h:193
cond::IOVProxy iov
cond::RDBMS rdbms

Member Function Documentation

virtual void CondBasicIter::clear ( )
pure virtual
void CondBasicIter::create ( const std::string &  NameDB,
const std::string &  Tag,
const std::string &  User,
const std::string &  Pass,
const std::string &  nameBlob = "" 
)

Definition at line 30 of file CondBasicIter.cc.

References clear(), db, cond::RDBMS::getDB(), cond::CondDB::iov(), iov, and rdbms.

35  {
36  rdbms = cond::RDBMS(User,Pass);
37  db = rdbms.getDB(NameDB);
38  iov = db.iov(Tag);
39  clear();
40 }
virtual void clear()=0
CondDB getDB(std::string const &db)
IOVProxy iov(std::string const &tag) const
cond::CondDB db
cond::IOVProxy iov
accept
Definition: HLTenums.h:22
cond::RDBMS rdbms
void CondBasicIter::create ( const std::string &  NameDB,
const std::string &  Tag,
const std::string &  auth = "" 
)

Definition at line 42 of file CondBasicIter.cc.

References clear(), db, cond::RDBMS::getDB(), cond::CondDB::iov(), iov, and rdbms.

45  {
47  db = rdbms.getDB(NameDB);
48  iov = db.iov(Tag);
49  clear();
50 }
virtual void clear()=0
CondDB getDB(std::string const &db)
IOVProxy iov(std::string const &tag) const
cond::CondDB db
cond::IOVProxy iov
cond::RDBMS rdbms
bool CondBasicIter::forward ( )

Definition at line 88 of file CondBasicIter.cc.

References iter, and m_end.

Referenced by CondIter< T >::next().

88  {
89  ++iter;
90  return iter!=m_end;
91 }
cond::IOVRange::const_iterator m_end
cond::IOVProxy::const_iterator iter
unsigned int CondBasicIter::getStartTime ( ) const

Get the SINCE TIME of the Interval of Validity.

Definition at line 76 of file CondBasicIter.cc.

Referenced by getTime().

76 {return (*iter).since();}
unsigned int CondBasicIter::getStopTime ( ) const

Get the TILL TIME of the Interval of Validity.

Definition at line 78 of file CondBasicIter.cc.

Referenced by getTime().

78 {return (*iter).till();}
unsigned int CondBasicIter::getTime ( void  ) const

Get the mean time of the Iterval of Validity.

Definition at line 74 of file CondBasicIter.cc.

References getStartTime(), and getStopTime().

74 {return (getStartTime()+getStopTime())/2;}
unsigned int getStartTime() const
unsigned int getStopTime() const
std::string const & CondBasicIter::getToken ( ) const

Get the token correpsonding to the Interval of Validity.

Definition at line 80 of file CondBasicIter.cc.

80 {return (*iter).token();}
bool CondBasicIter::init ( void  )

Definition at line 82 of file CondBasicIter.cc.

References iter, m_begin, and m_end.

Referenced by CondIter< T >::next().

82  {
83  iter = m_begin;
84  return iter!=m_end;
85 
86 }
cond::IOVRange::const_iterator m_begin
cond::IOVRange::const_iterator m_end
cond::IOVProxy::const_iterator iter
virtual bool CondBasicIter::load ( cond::DbSession sess,
std::string const &  token 
)
pure virtual
bool CondBasicIter::make ( )

Definition at line 94 of file CondBasicIter.cc.

References db, load(), and cond::CondDB::session().

Referenced by CondIter< T >::next().

94  {
95  return load(db.session(),(*iter).token());
96 }
cond::CondDB db
virtual bool load(cond::DbSession &sess, std::string const &token)=0
DbSession & session() const
void CondBasicIter::setMax ( unsigned int  max)

Set the maximum of the range of interest of the Iterator of the IOVs.

Definition at line 67 of file CondBasicIter.cc.

References cond::IOVRange::begin(), clear(), cond::IOVRange::end(), iov, m_begin, m_end, and cond::IOVProxy::range().

67  {
68  cond::IOVRange rg = iov.range( 1, max );
69  m_begin = rg.begin();
70  m_end = rg.end();
71  clear();
72 }
virtual void clear()=0
cond::IOVRange::const_iterator m_begin
cond::IOVRange::const_iterator m_end
const_iterator begin() const
Definition: IOVProxy.h:128
IOVRange range(cond::Time_t since, cond::Time_t till) const
Definition: IOVProxy.cc:239
cond::IOVProxy iov
const T & max(const T &a, const T &b)
const_iterator end() const
Definition: IOVProxy.h:133
void CondBasicIter::setMin ( unsigned int  min)

Set the minimum of the range of interest of the Iterator of the IOVs.

Definition at line 60 of file CondBasicIter.cc.

References cond::IOVRange::begin(), clear(), cond::IOVRange::end(), iov, m_begin, m_end, and cond::IOVProxy::range().

60  {
61  cond::IOVRange rg = iov.range( min, 0 );
62  m_begin = rg.begin();
63  m_end = rg.end();
64  clear();
65 }
virtual void clear()=0
cond::IOVRange::const_iterator m_begin
cond::IOVRange::const_iterator m_end
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::IOVProxy iov
const_iterator end() const
Definition: IOVProxy.h:133
void CondBasicIter::setRange ( unsigned int  min,
unsigned int  max 
)

Set the range of interest of the Iterator of the IOVs.

Definition at line 53 of file CondBasicIter.cc.

References cond::IOVRange::begin(), clear(), cond::IOVRange::end(), iov, m_begin, m_end, and cond::IOVProxy::range().

53  {
54  cond::IOVRange rg = iov.range( min, max );
55  m_begin = rg.begin();
56  m_end = rg.end();
57  clear();
58 }
virtual void clear()=0
cond::IOVRange::const_iterator m_begin
cond::IOVRange::const_iterator m_end
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::IOVProxy iov
const T & max(const T &a, const T &b)
const_iterator end() const
Definition: IOVProxy.h:133

Member Data Documentation

cond::CondDB CondBasicIter::db
protected

Definition at line 101 of file CondBasicIter.h.

Referenced by create(), and make().

cond::IOVProxy CondBasicIter::iov
protected

Definition at line 102 of file CondBasicIter.h.

Referenced by create(), setMax(), setMin(), and setRange().

cond::IOVProxy::const_iterator CondBasicIter::iter
protected

Definition at line 103 of file CondBasicIter.h.

Referenced by forward(), and init().

cond::IOVRange::const_iterator CondBasicIter::m_begin
private

Definition at line 106 of file CondBasicIter.h.

Referenced by init(), setMax(), setMin(), and setRange().

cond::IOVRange::const_iterator CondBasicIter::m_end
private

Definition at line 107 of file CondBasicIter.h.

Referenced by forward(), init(), setMax(), setMin(), and setRange().

cond::RDBMS CondBasicIter::rdbms
protected

Definition at line 100 of file CondBasicIter.h.

Referenced by create().