CMS 3D CMS Logo

Public Types | Public Member Functions | Private Attributes

cond::IOVRange Class Reference

#include <IOVProxy.h>

List of all members.

Public Types

typedef iov_range_iterator const_iterator

Public Member Functions

IOVElementProxy back () const
const_iterator begin () const
const_iterator end () const
const_iterator find (cond::Time_t time) const
IOVElementProxy front () const
 IOVRange ()
 IOVRange (const IOVRange &rhs)
 IOVRange (const boost::shared_ptr< IOVProxyData > &iov, cond::Time_t since, cond::Time_t till, int selection=0)
 IOVRange (const boost::shared_ptr< IOVProxyData > &iov, int selection)
IOVRangeoperator= (const IOVRange &rhs)
size_t size () const

Private Attributes

int m_high
boost::shared_ptr< IOVProxyDatam_iov
int m_low
cond::Time_t m_lowBound

Detailed Description

Definition at line 111 of file IOVProxy.h.


Member Typedef Documentation

Definition at line 114 of file IOVProxy.h.


Constructor & Destructor Documentation

cond::IOVRange::IOVRange ( )

Definition at line 82 of file IOVProxy.cc.

                      :
  m_iov(),
  m_low(-1),
  m_high(-1),
  m_lowBound(0){
}
cond::IOVRange::IOVRange ( const boost::shared_ptr< IOVProxyData > &  iov,
cond::Time_t  since,
cond::Time_t  till,
int  selection = 0 
)

Definition at line 89 of file IOVProxy.cc.

References m_high, m_iov, m_low, m_lowBound, max(), and min.

                                         :
  m_iov( iov ),
  m_low( -1 ),
  m_high( -1 ),
  m_lowBound(0){
  std::pair<int,int> rg = m_iov->range( since, till );
  m_low = rg.first;
  m_high = rg.second;
  if( selection > 0 ){
    m_low = rg.first;
    m_high = std::min( rg.first-selection-1, rg.second );
  } else if( selection < 0 ){
    m_low = std::max( rg.second-selection+1,rg.first);
    m_high = rg.second;
  }
  cond::Time_t tlow = m_iov->data->iovs()[m_low].sinceTime();
  if( since < tlow ) since = tlow;
  m_lowBound = since;
}
cond::IOVRange::IOVRange ( const boost::shared_ptr< IOVProxyData > &  iov,
int  selection 
)

Definition at line 112 of file IOVProxy.cc.

References m_high, m_low, min, and corrVsCorr::selection.

                                         :
  m_iov(iov),
  m_low(-1),
  m_high(-1),
  m_lowBound(0){
  int sz  =  iov->data->iovs().size();
  m_low = 0;
  m_high = sz-1;
  if( selection > 0 ){
    m_high = std::min( selection, sz-1 );
  } else if( selection < 0 ){
    m_low = sz+selection;
    if(m_low < 0) m_low = 0;
  }
}
cond::IOVRange::IOVRange ( const IOVRange rhs)

Definition at line 129 of file IOVProxy.cc.

                                           :
  m_iov( rhs.m_iov ),
  m_low( rhs.m_low ),
  m_high( rhs.m_high ),
  m_lowBound( rhs.m_lowBound){
}

Member Function Documentation

cond::IOVElementProxy cond::IOVRange::back ( ) const

Definition at line 157 of file IOVProxy.cc.

Referenced by BOOST_PYTHON_MODULE().

                                             {
  IterHelp helper(*m_iov, m_lowBound);
  return helper( m_high );
}
const_iterator cond::IOVRange::begin ( void  ) const [inline]

Definition at line 128 of file IOVProxy.h.

References m_iov, m_low, and m_lowBound.

Referenced by BOOST_PYTHON_MODULE(), CondBasicIter::setMax(), CondBasicIter::setMin(), and CondBasicIter::setRange().

                                 {
      return  boost::make_transform_iterator(boost::counting_iterator<int>(m_low),
                                             IterHelp(*m_iov, m_lowBound));
    }
const_iterator cond::IOVRange::end ( void  ) const [inline]

Definition at line 133 of file IOVProxy.h.

References getHLTprescales::index, m_high, m_iov, and m_lowBound.

Referenced by BOOST_PYTHON_MODULE(), CondBasicIter::setMax(), CondBasicIter::setMin(), and CondBasicIter::setRange().

                               {
      // returns: 0 if not inizialized (m_low=m_high=-1)
      //          m_high + 1 = m_low + size elsewhere (since size = m_high - m_low + 1)
      int index = m_high + 1;
      return  boost::make_transform_iterator(boost::counting_iterator<int>(index),
                                             IterHelp(*m_iov, m_lowBound));
    }
cond::IOVRange::const_iterator cond::IOVRange::find ( cond::Time_t  time) const

Definition at line 144 of file IOVProxy.cc.

References end, and n.

                                                                   {
  int n = m_iov->data->find(time)-m_iov->data->iovs().begin();
  return (n<m_low || m_high<n ) ? 
    end() :  
    boost::make_transform_iterator(boost::counting_iterator<int>(n),
                                   IterHelp(*m_iov, m_lowBound));
}
cond::IOVElementProxy cond::IOVRange::front ( ) const

Definition at line 152 of file IOVProxy.cc.

Referenced by BOOST_PYTHON_MODULE().

                                              {
  IterHelp helper(*m_iov, m_lowBound);
  return helper( m_low );
}
cond::IOVRange & cond::IOVRange::operator= ( const IOVRange rhs)

Definition at line 136 of file IOVProxy.cc.

References m_high, m_iov, m_low, and m_lowBound.

                                                          {
  m_iov = rhs.m_iov;
  m_low = rhs.m_low;
  m_high = rhs.m_high;
  m_lowBound = rhs.m_lowBound;
  return *this;
}
size_t cond::IOVRange::size ( void  ) const

Definition at line 162 of file IOVProxy.cc.

Referenced by BOOST_PYTHON_MODULE().

                                {
  size_t sz = 0;
  if( m_high>=0 && m_low>=0 ) sz = m_high-m_low+1;
  return sz;
}

Member Data Documentation

int cond::IOVRange::m_high [private]

Definition at line 152 of file IOVProxy.h.

Referenced by end(), IOVRange(), and operator=().

boost::shared_ptr<IOVProxyData> cond::IOVRange::m_iov [private]

Definition at line 150 of file IOVProxy.h.

Referenced by begin(), end(), IOVRange(), and operator=().

int cond::IOVRange::m_low [private]

Definition at line 151 of file IOVProxy.h.

Referenced by begin(), IOVRange(), and operator=().

Definition at line 153 of file IOVProxy.h.

Referenced by begin(), end(), IOVRange(), and operator=().