ATLAS Offline Software
Public Member Functions | Private Attributes | List of all members
CaloCompactCellContainer::compact_input_iterator Class Reference

Simple iterator-like object for reading from the container. More...

#include <CaloCompactCellContainer.h>

Collaboration diagram for CaloCompactCellContainer::compact_input_iterator:

Public Member Functions

 compact_input_iterator (std::vector< value_type >::const_iterator it)
 Constructor. More...
 
CaloCompactCell::value_type next ()
 Return the current value and advance to the next one. More...
 
std::vector< value_type >::const_iterator base () const
 Return the underlying container iterator. More...
 

Private Attributes

std::vector< value_type >::const_iterator m_it
 The iterator in the underlying container type. More...
 
value_type m_word
 The current word. More...
 
int m_count
 Count; used to tell how many more times we need to shift m_word. More...
 

Detailed Description

Simple iterator-like object for reading from the container.

This allows reading one CaloCompactCell::value_type object at a time from the container. There is only one method, next(), which returns the next value (and advances the iterator).

Definition at line 155 of file CaloCompactCellContainer.h.

Constructor & Destructor Documentation

◆ compact_input_iterator()

CaloCompactCellContainer::compact_input_iterator::compact_input_iterator ( std::vector< value_type >::const_iterator  it)
inline

Constructor.

Parameters
itvalue_type iterator at the start of the data (after the header).

Definition at line 287 of file CaloCompactCellContainer.h.

289  : m_it (it),
290  m_word(0),
291  m_count (0)
292 {
293 }

Member Function Documentation

◆ base()

std::vector< CaloCompactCellContainer::value_type >::const_iterator CaloCompactCellContainer::compact_input_iterator::base ( ) const
inline

Return the underlying container iterator.

Definition at line 329 of file CaloCompactCellContainer.h.

330 {
331  return m_it;
332 }

◆ next()

CaloCompactCell::value_type CaloCompactCellContainer::compact_input_iterator::next ( )
inline

Return the current value and advance to the next one.

Definition at line 298 of file CaloCompactCellContainer.h.

299 {
300  // Constants.
301  const int mask = static_cast<CaloCompactCell::value_type>(-1);
302  const int shift = 8*sizeof (CaloCompactCell::value_type);
303  const int ratio =
304  sizeof(value_type) / sizeof(CaloCompactCell::value_type);
305 
306  // Fetch the next @c value_type, if needed.
307  if (m_count % ratio == 0)
308  m_word = *m_it;
309 
310  // Mask off the current value.
312 
313  // Bump the count.
314  if (((++m_count)%ratio) == 0) {
315  // We wrapped to a new @c value_type. Bump the underlying iterator.
316  ++m_it;
317  }
318  else {
319  // Same @c value_type --- shift the word over.
320  m_word >>= shift;
321  }
322 
323  return ret;
324 }

Member Data Documentation

◆ m_count

int CaloCompactCellContainer::compact_input_iterator::m_count
private

Count; used to tell how many more times we need to shift m_word.

Definition at line 187 of file CaloCompactCellContainer.h.

◆ m_it

std::vector<value_type>::const_iterator CaloCompactCellContainer::compact_input_iterator::m_it
private

The iterator in the underlying container type.

Definition at line 180 of file CaloCompactCellContainer.h.

◆ m_word

value_type CaloCompactCellContainer::compact_input_iterator::m_word
private

The current word.

This gets shifted to the right as we consume values from it.

Definition at line 184 of file CaloCompactCellContainer.h.


The documentation for this class was generated from the following file:
CaloCompactCellContainer::value_type
int value_type
value type for the internal data
Definition: CaloCompactCellContainer.h:40
skel.it
it
Definition: skel.GENtoEVGEN.py:423
python.utils.AtlRunQueryLookup.mask
string mask
Definition: AtlRunQueryLookup.py:460
ret
T ret(T t)
Definition: rootspy.cxx:260
CaloCompactCellContainer::compact_input_iterator::m_it
std::vector< value_type >::const_iterator m_it
The iterator in the underlying container type.
Definition: CaloCompactCellContainer.h:180
CaloCompactCellContainer::compact_input_iterator::m_word
value_type m_word
The current word.
Definition: CaloCompactCellContainer.h:184
CaloCompactCell::value_type
unsigned short value_type
value type for the compact CaloCell data
Definition: CaloCompactCell.h:34
CaloCompactCellContainer::compact_input_iterator::m_count
int m_count
Count; used to tell how many more times we need to shift m_word.
Definition: CaloCompactCellContainer.h:187
python.compareTCTs.ratio
ratio
Definition: compareTCTs.py:295