CMS 3D CMS Logo

Public Member Functions | Protected 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

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))
{
}
CondBasicIter::CondBasicIter ( const std::string &  NameDB,
const std::string &  Tag,
const std::string &  auth = "" 
)

Definition at line 16 of file CondBasicIter.cc.

               :
  rdbms(auth), db(rdbms.getDB(NameDB)), iov(db.iov(Tag))
{
}

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 36 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 24 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 79 of file CondBasicIter.cc.

References cond::IOVProxy::end(), iov, and iter.

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

                           {
  ++iter;
  return iter!=iov.end();
}
unsigned int CondBasicIter::getStartTime ( ) const

Get the SINCE TIME of the Interval of Validity.

Definition at line 66 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 68 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 64 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 70 of file CondBasicIter.cc.

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

Definition at line 73 of file CondBasicIter.cc.

References cond::IOVProxy::begin(), cond::IOVProxy::end(), iov, and iter.

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

                         {
  iter=iov.begin();
  return iter!=iov.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 85 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 57 of file CondBasicIter.cc.

References clear(), iov, and cond::IOVProxy::setRange().

                                          {
  iov.setRange(1,max);
  clear();
}
void CondBasicIter::setMin ( unsigned int  min)

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

Definition at line 52 of file CondBasicIter.cc.

References clear(), iov, and cond::IOVProxy::setRange().

                                          {
  iov.setRange(min,0);
  clear();
}
void CondBasicIter::setRange ( unsigned int  min,
unsigned int  max 
)

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

Definition at line 47 of file CondBasicIter.cc.

References clear(), iov, and cond::IOVProxy::setRange().

                                                             {
  iov.setRange(min,max);
  clear();
}

Member Data Documentation

Definition at line 14 of file CondBasicIter.h.

Referenced by create(), and make().

Definition at line 15 of file CondBasicIter.h.

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

Definition at line 16 of file CondBasicIter.h.

Referenced by forward(), and init().

Definition at line 13 of file CondBasicIter.h.

Referenced by create().