CMS 3D CMS Logo

Public Member Functions | Protected Attributes | Private Attributes

CondBasicIter Class Reference

#include <CondBasicIter.h>

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

List of all members.

Public Member Functions

virtual void clear ()=0
 CondBasicIter ()
 CondBasicIter (const std::string &NameDB, const std::string &Tag, const std::string &auth="")
 CondBasicIter (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 &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::iov_range_iterator m_begin
cond::iov_range_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.

{}
CondBasicIter::~CondBasicIter ( )

Definition at line 4 of file CondBasicIter.cc.

{}
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.

                                                         :
  rdbms(User,Pass), 
  db(rdbms.getDB(NameDB)), 
  iov(db.iov(Tag)),
  m_begin( iov.begin() ),
  m_end( iov.end() ){
}
CondBasicIter::CondBasicIter ( const std::string &  NameDB,
const std::string &  Tag,
const std::string &  auth = "" 
)

Definition at line 19 of file CondBasicIter.cc.

               :
  rdbms(auth), 
  db(rdbms.getDB(NameDB)), 
  iov(db.iov(Tag)),
  m_begin( iov.begin() ),
  m_end( iov.end() ){
}

Member Function Documentation

virtual void CondBasicIter::clear ( ) [pure virtual]
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.

                             {
  rdbms = cond::RDBMS(auth);
  db = rdbms.getDB(NameDB);
  iov = db.iov(Tag);
  clear();
}
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.

                                                       {
  rdbms = cond::RDBMS(User,Pass);
  db = rdbms.getDB(NameDB);
  iov = db.iov(Tag);
  clear();
}
bool CondBasicIter::forward ( )

Definition at line 88 of file CondBasicIter.cc.

References iter, and m_end.

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

                           {
  ++iter;
  return iter!=m_end;
}
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().

{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().

{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().

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

Get the token correpsonding to the Interval of Validity.

Definition at line 80 of file CondBasicIter.cc.

{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().

                         {
  iter = m_begin;
  return iter!=m_end;

}
virtual bool CondBasicIter::load ( cond::DbSession sess,
std::string const &  token 
) [pure virtual]

Implemented in CondIter< DataT >, CondIter< HDQMSummary >, and CondIter< T >.

Referenced by make().

bool CondBasicIter::make ( )

Definition at line 94 of file CondBasicIter.cc.

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

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

                        {
  return load(db.session(),(*iter).token());
}
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().

                                          {
  cond::IOVRange rg = iov.range( 1, max );
  m_begin = rg.begin();
  m_end = rg.end();
  clear();
}
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().

                                          {
  cond::IOVRange rg = iov.range( min, 0 );
  m_begin = rg.begin();
  m_end = rg.end();
  clear();
}
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().

                                                             {
  cond::IOVRange rg = iov.range( min, max );
  m_begin = rg.begin();
  m_end = rg.end();
  clear();
}

Member Data Documentation

Definition at line 101 of file CondBasicIter.h.

Referenced by create(), and make().

Definition at line 102 of file CondBasicIter.h.

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

Definition at line 103 of file CondBasicIter.h.

Referenced by forward(), and init().

Definition at line 106 of file CondBasicIter.h.

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

Definition at line 107 of file CondBasicIter.h.

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

Definition at line 100 of file CondBasicIter.h.

Referenced by create().