ATLAS Offline Software
Loading...
Searching...
No Matches
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.
CaloCompactCell::value_type next ()
 Return the current value and advance to the next one.
std::vector< value_type >::const_iterator base () const
 Return the underlying container iterator.

Private Attributes

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

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}
std::vector< value_type >::const_iterator m_it
The iterator in the underlying container type.
int m_count
Count; used to tell how many more times we need to shift m_word.

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}
int value_type
value type for the internal data
unsigned short value_type
value type for the compact CaloCell data

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: