ATLAS Offline Software
Loading...
Searching...
No Matches
CaloCompactCellContainer::compact_input_iterator Class Reference

store the compact cell with index iCell 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

store the compact cell with index iCell

Parameters
theCompactCellthe compact CaloCell data
iCellthe index in the CaloCompactCellContainer
headerLengththe space reserved for the header information

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 127 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 239 of file CaloCompactCellContainer.h.

241 : m_it (it),
242 m_word(0),
243 m_count (0)
244{
245}
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 281 of file CaloCompactCellContainer.h.

282{
283 return m_it;
284}

◆ next()

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

Return the current value and advance to the next one.

Definition at line 250 of file CaloCompactCellContainer.h.

251{
252 // Constants.
253 const int mask = static_cast<CaloCompactCell::value_type>(-1);
254 const int shift = 8*sizeof (CaloCompactCell::value_type);
255 const int ratio =
256 sizeof(value_type) / sizeof(CaloCompactCell::value_type);
257
258 // Fetch the next @c value_type, if needed.
259 if (m_count % ratio == 0)
260 m_word = *m_it;
261
262 // Mask off the current value.
264
265 // Bump the count.
266 if (((++m_count)%ratio) == 0) {
267 // We wrapped to a new @c value_type. Bump the underlying iterator.
268 ++m_it;
269 }
270 else {
271 // Same @c value_type --- shift the word over.
272 m_word >>= shift;
273 }
274
275 return ret;
276}
int value_type
value type for the internal data
virtual void shift(size_t pos, ptrdiff_t offs) override
Shift the elements of the container.

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 159 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 152 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 156 of file CaloCompactCellContainer.h.


The documentation for this class was generated from the following file: