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

Simple iterator-like object for writing to the container. More...

#include <CaloCompactCellContainer.h>

Collaboration diagram for CaloCompactCellContainer::compact_output_iterator:

Public Member Functions

 compact_output_iterator ()
 Default constructor.
 compact_output_iterator (std::vector< value_type >::iterator it)
 Constructor.
void set (CaloCompactCell::value_type x)
 Set the next value, and advance the iterator.
compact_output_iteratoroperator++ ()
 Advance the iterator.
int used () const
 Return the number of underlying value_type words used.

Private Attributes

std::vector< value_type >::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.

Detailed Description

Simple iterator-like object for writing to the container.

This allows writing one CaloCompactCell::value_type object at a time to the container. There is a set method which writes one value to the container (and advances the iterator).

Definition at line 210 of file CaloCompactCellContainer.h.

Constructor & Destructor Documentation

◆ compact_output_iterator() [1/2]

CaloCompactCellContainer::compact_output_iterator::compact_output_iterator ( )
inline

Default constructor.

This makes an invalid iterator.

Definition at line 349 of file CaloCompactCellContainer.h.

350{
351}

◆ compact_output_iterator() [2/2]

CaloCompactCellContainer::compact_output_iterator::compact_output_iterator ( std::vector< value_type >::iterator it)
inline

Constructor.

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

Definition at line 355 of file CaloCompactCellContainer.h.

357 : m_it (it),
358 m_count (0)
359{
360}
std::vector< value_type >::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

◆ operator++()

CaloCompactCellContainer::compact_output_iterator & CaloCompactCellContainer::compact_output_iterator::operator++ ( )
inline

Advance the iterator.

Definition at line 383 of file CaloCompactCellContainer.h.

384{
385 const int ratio =
386 sizeof(value_type) / sizeof(CaloCompactCell::value_type);
387 if (((++m_count)%ratio) == 0)
388 ++m_it;
389 return *this;
390}
int value_type
value type for the internal data
unsigned short value_type
value type for the compact CaloCell data

◆ set()

void CaloCompactCellContainer::compact_output_iterator::set ( CaloCompactCell::value_type x)
inline

Set the next value, and advance the iterator.

Parameters
xThe value to copy to the container.

Definition at line 363 of file CaloCompactCellContainer.h.

365{
366 // Constants.
367 const int mask = static_cast<CaloCompactCell::value_type>(-1);
368 const int ratio =
369 sizeof(value_type) / sizeof(CaloCompactCell::value_type);
370 const int shift = 8*sizeof (CaloCompactCell::value_type) * (m_count%ratio);
371
372 // Mask the value into the current word.
373 *m_it = (*m_it & ~(mask<<shift)) | (x << shift);
374
375 // Advance the iterator.
376 if (((++m_count)%ratio) == 0)
377 ++m_it;
378}
#define x

◆ used()

int CaloCompactCellContainer::compact_output_iterator::used ( ) const
inline

Return the number of underlying value_type words used.

Definition at line 394 of file CaloCompactCellContainer.h.

395{
396 const int ratio =
397 sizeof(value_type) / sizeof(CaloCompactCell::value_type);
398 return (m_count + ratio - 1) / ratio;
399}

Member Data Documentation

◆ m_count

int CaloCompactCellContainer::compact_output_iterator::m_count
private

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

Definition at line 253 of file CaloCompactCellContainer.h.

◆ m_it

std::vector<value_type>::iterator CaloCompactCellContainer::compact_output_iterator::m_it
private

The iterator in the underlying container type.

Definition at line 250 of file CaloCompactCellContainer.h.


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