AliPhysics  b43479f (b43479f)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliEmcalIterableContainer::iterator Class Reference

bidirectional stl iterator over the EMCAL iterable container More...

#include <AliEmcalIterableContainer.h>

Inheritance diagram for AliEmcalIterableContainer::iterator:

Public Member Functions

 iterator (const AliEmcalIterableContainer *cont, int currentpos, bool forward=true)
 Content of class AliEmcalIterableContainer::Iterator ///. More...
 
 iterator (const iterator &ref)
 
iteratoroperator= (const iterator &ref)
 
virtual ~iterator ()
 
bool operator!= (const iterator &ref) const
 
iteratoroperator++ ()
 
iterator operator++ (int)
 
iteratoroperator-- ()
 
iterator operator-- (int)
 
TObject * operator* () const
 

Private Member Functions

 iterator ()
 

Private Attributes

const AliEmcalIterableContainerfkData
 container with data More...
 
int fCurrent
 current index in the container More...
 
bool fForward
 use forward or backward direction More...
 

Detailed Description

bidirectional stl iterator over the EMCAL iterable container

Author
Markus Fasel marku.nosp@m.s.fa.nosp@m.sel@c.nosp@m.ern..nosp@m.ch, Lawrence Berkeley National Laboratory
Date
March 23rd, 2016

stl iterator corresponding to the EMCAL iterable container. The iterator iterates over all object in the EMCAL iterable container as specified in its constructor (all or accepted). It can be both forward or backward iterator.

As stl iterator it implements the operators required for an iterator

  • operator!= to determine the end of the iteration
  • prefix and postfix operator++ and operator-- forwarding the position
  • operator* to access the content of the iteration

In case of c++11 the iterator also allows range-based iteration.

Definition at line 70 of file AliEmcalIterableContainer.h.

Constructor & Destructor Documentation

AliEmcalIterableContainer::iterator::iterator ( const AliEmcalIterableContainer cont,
int  currentpos,
bool  forward = true 
)

Content of class AliEmcalIterableContainer::Iterator ///.

Constructor of the iterator. Setting underlying data, starting position of the iterator, and direction.

Iterators should be constructed by the iterable container via the functions begin, end, rbegin and rend. Direct use of the constructor by the users is discouraged.

Parameters
[in]contEMCAL container to iterate over
[in]currentposstarting position for the iteration
[in]forwardDirection of the iteration. If true, the iteration is performed in forward direction, otherwise in backward direction.

Definition at line 139 of file AliEmcalIterableContainer.cxx.

AliEmcalIterableContainer::iterator::iterator ( const iterator ref)

Copy constructor. Only pointers are copied as the iterator does not own its container.

Parameters
[in]refReference for the copy

Definition at line 152 of file AliEmcalIterableContainer.cxx.

virtual AliEmcalIterableContainer::iterator::~iterator ( )
inlinevirtual

Definition at line 77 of file AliEmcalIterableContainer.h.

AliEmcalIterableContainer::iterator::iterator ( )
private

Member Function Documentation

bool AliEmcalIterableContainer::iterator::operator!= ( const iterator ref) const

Comparison operator for unequalness. Comparison is performed based on the position inside the container

Parameters
[in]refReference for comparison
Returns
True if the position does not match, false otherwise

Definition at line 180 of file AliEmcalIterableContainer.cxx.

TObject * AliEmcalIterableContainer::iterator::operator* ( ) const

Access operator. Providing access to the object at the position of the iterator.

Returns
Object at the position of the iterator (NULL if the iterator is out of range)

Definition at line 237 of file AliEmcalIterableContainer.cxx.

AliEmcalIterableContainer::iterator & AliEmcalIterableContainer::iterator::operator++ ( )

Prefix increment operator. Incrementing / decrementing position of the iterator based on the direction.

Returns
Status of the operator before incrementation.

Definition at line 189 of file AliEmcalIterableContainer.cxx.

AliEmcalIterableContainer::iterator AliEmcalIterableContainer::iterator::operator++ ( int  index)

Postfix increment operator. Incrementing / decrementing the position of the iterator based on the direction. This operator requires a copy of itself.

Parameters
[in]indexNot used
Returns
State of the iterator before incrementation

Definition at line 213 of file AliEmcalIterableContainer.cxx.

AliEmcalIterableContainer::iterator & AliEmcalIterableContainer::iterator::operator-- ( )

Prefix decrement operator. Decrementing / incrementing the position of the iterator based on the direction.

Returns
Status of the iterator before decrementation.

Definition at line 200 of file AliEmcalIterableContainer.cxx.

AliEmcalIterableContainer::iterator AliEmcalIterableContainer::iterator::operator-- ( int  index)

Postfix decrement operator. Decrementing / incrementing the position of the iterator based on the direction. This operator requires a copy of itself.

Parameters
[in]indexNot used
Returns
State of the iterator before decrementation.

Definition at line 226 of file AliEmcalIterableContainer.cxx.

AliEmcalIterableContainer::iterator & AliEmcalIterableContainer::iterator::operator= ( const iterator ref)

Assignment operator. Only pointers are copied as the iterator does not own its container.

Parameters
[in]refReference for the assignment
Returns
This iterator after assignment

Definition at line 166 of file AliEmcalIterableContainer.cxx.

Member Data Documentation

int AliEmcalIterableContainer::iterator::fCurrent
private

current index in the container

Definition at line 92 of file AliEmcalIterableContainer.h.

Referenced by operator!=(), and operator=().

bool AliEmcalIterableContainer::iterator::fForward
private

use forward or backward direction

Definition at line 93 of file AliEmcalIterableContainer.h.

Referenced by operator=().

const AliEmcalIterableContainer* AliEmcalIterableContainer::iterator::fkData
private

container with data

Definition at line 91 of file AliEmcalIterableContainer.h.

Referenced by operator=().


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