ATLAS Offline Software
Public Member Functions | Private Attributes | List of all members
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. More...
 
 compact_output_iterator (std::vector< value_type >::iterator it)
 Constructor. More...
 
void set (CaloCompactCell::value_type x)
 Set the next value, and advance the iterator. More...
 
compact_output_iteratoroperator++ ()
 Advance the iterator. More...
 
int used () const
 Return the number of underlying value_type words used. More...
 

Private Attributes

std::vector< value_type >::iterator m_it
 The iterator in the underlying container type. 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 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 }

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 }

◆ 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 }

◆ 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:
CaloCompactCellContainer::compact_output_iterator::m_it
std::vector< value_type >::iterator m_it
The iterator in the underlying container type.
Definition: CaloCompactCellContainer.h:250
CaloCompactCellContainer::value_type
int value_type
value type for the internal data
Definition: CaloCompactCellContainer.h:40
skel.it
it
Definition: skel.GENtoEVGEN.py:423
x
#define x
python.utils.AtlRunQueryLookup.mask
string mask
Definition: AtlRunQueryLookup.py:460
CaloCompactCellContainer::compact_output_iterator::m_count
int m_count
Count; used to tell how many more times we need to shift m_word.
Definition: CaloCompactCellContainer.h:253
CaloCompactCell::value_type
unsigned short value_type
value type for the compact CaloCell data
Definition: CaloCompactCell.h:34
python.compareTCTs.ratio
ratio
Definition: compareTCTs.py:295