CMS 3D CMS Logo

Public Member Functions | Private Attributes

cond::IOVElementProxy Class Reference

#include <IOVProxy.h>

List of all members.

Public Member Functions

 IOVElementProxy ()
 IOVElementProxy (cond::Time_t is, cond::Time_t it, std::string const &itoken)
void set (IOVSequence const &v, int i)
void set (cond::Time_t is, cond::Time_t it, std::string const &itoken)
cond::Time_t since () const
cond::Time_t till () const
std::string const & token () const

Private Attributes

cond::Time_t m_since
cond::Time_t m_till
std::string m_token

Detailed Description

Definition at line 47 of file IOVProxy.h.


Constructor & Destructor Documentation

cond::IOVElementProxy::IOVElementProxy ( ) [inline]

Definition at line 49 of file IOVProxy.h.

cond::IOVElementProxy::IOVElementProxy ( cond::Time_t  is,
cond::Time_t  it,
std::string const &  itoken 
) [inline]

Definition at line 54 of file IOVProxy.h.

                                                                          :
      m_since(is), 
      m_till(it), 
      m_token(itoken) {}

Member Function Documentation

void cond::IOVElementProxy::set ( cond::Time_t  is,
cond::Time_t  it,
std::string const &  itoken 
) [inline]

Definition at line 59 of file IOVProxy.h.

References m_since, m_till, and m_token.

Referenced by cond::BasePayloadProxy::loadFor(), cond::BasePayloadProxy::make(), and cond::IterHelp::operator()().

                                                                    {
      m_since=is; 
      m_till=it; 
      m_token=itoken;
    }
void cond::IOVElementProxy::set ( IOVSequence const &  v,
int  i 
)

Definition at line 36 of file IOVProxy.cc.

References i, cond::invalidTime(), cond::IOVSequence::iovs(), cond::IOVSequence::lastTill(), timeUnitHelper::pack(), cond::timestamp, cond::IOVSequence::timeType(), and timeUnitHelper::unpack().

                                                           {
  if (ii>=(int)v.iovs().size() || ii<0) {
    set(cond::invalidTime, cond::invalidTime,"");
    return;
  }
  size_t i =ii;
  m_token = v.iovs()[i].token();
  m_since =  v.iovs()[i].sinceTime();
  if(i+1==v.iovs().size()) {
    m_till = v.lastTill();
    return;
  }
  cond::UnpackedTime unpackedTime;
  cond::Time_t totalNanoseconds;
  cond::Time_t totalSecondsInNanoseconds;
  switch (v.timeType()) {
  case timestamp:
    //unpacking
    unpackedTime = cond::time::unpack(v.iovs()[i+1].sinceTime());
    //number of seconds in nanoseconds (avoid multiply and divide by 1e09)
    totalSecondsInNanoseconds = ((cond::Time_t)unpackedTime.first)*1000000000;
    //total number of nanoseconds
    totalNanoseconds = totalSecondsInNanoseconds + ((cond::Time_t)(unpackedTime.second));
    //now decrementing of 1 nanosecond
    totalNanoseconds--;
    //now repacking (just change the value of the previous pair)
    unpackedTime.first = (unsigned int) (totalNanoseconds/1000000000);
    unpackedTime.second = (unsigned int)(totalNanoseconds - (cond::Time_t)unpackedTime.first*1000000000);
    m_till = cond::time::pack(unpackedTime);
    break;
  default:
    m_till = v.iovs()[i+1].sinceTime()-1;
  }
}
cond::Time_t cond::IOVElementProxy::since ( ) const [inline]
cond::Time_t cond::IOVElementProxy::till ( ) const [inline]
std::string const& cond::IOVElementProxy::token ( ) const [inline]

Member Data Documentation

Definition at line 80 of file IOVProxy.h.

Referenced by set(), and since().

Definition at line 81 of file IOVProxy.h.

Referenced by set(), and till().

std::string cond::IOVElementProxy::m_token [private]

Definition at line 82 of file IOVProxy.h.

Referenced by set(), and token().