ROOT logo
/**************************************************************************
* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
*                                                                        *
* Author: The ALICE Off-line Project.                                    *
* Contributors are mentioned in the code where appropriate.              *
*                                                                        *
* Permission to use, copy, modify and distribute this software and its   *
* documentation strictly for non-commercial purposes is hereby granted   *
* without fee, provided that the above copyright notice appears in all   *
* copies and that both the copyright notice and this permission notice   *
* appear in the supporting documentation. The authors make no claims     *
* about the suitability of this software for any purpose. It is          *
* provided "as is" without express or implied warranty.                  *
**************************************************************************/

// $Id$

//-----------------------------------------------------------------------------
/// \class AliMUON2DMapIteratorByI
///
/// Implementation of TIterator for 2D maps
/// 
/// An implementation of TIterator for 2D maps, which can iterate
/// on a range of i values (i being the first element of the couple
/// (i,j) used to index values in the map).
///
/// \author Laurent Aphecetche
//-----------------------------------------------------------------------------

#include "AliMUON2DMapIteratorByI.h"
#include "AliMpExMapIterator.h"
#include "AliMpExMap.h"
#include "AliLog.h"

/// \cond CLASSIMP
ClassImp(AliMUON2DMapIteratorByI)
/// \endcond

//_____________________________________________________________________________
AliMUON2DMapIteratorByI::AliMUON2DMapIteratorByI(const AliMpExMap& theMap, Int_t firstI, Int_t lastI)
: TIterator(),
fkMap(&theMap),
fIter1(theMap.CreateIterator()),
fIter2(0x0),
fFirstI(firstI),
fLastI(lastI),
fCurrentI(-1)
{
  /// default ctor
  Reset();
}

//_____________________________________________________________________________
AliMUON2DMapIteratorByI& 
AliMUON2DMapIteratorByI::operator=(const TIterator& /*rhs*/)
{
  // overriden operator= (imposed by Root's definition of TIterator::operator= ?)
  
  AliFatalGeneral("operator=(TIterator&)",""); // as in copy ctor
  return *this;
}

//_____________________________________________________________________________
AliMUON2DMapIteratorByI::~AliMUON2DMapIteratorByI()
{
  /// dtor
  delete fIter1;
  delete fIter2;
}

//_____________________________________________________________________________
const TCollection* 
AliMUON2DMapIteratorByI::GetCollection() const
{
  /// Return 0 as we're not really dealing with a Root TCollection...
  return 0x0;
}

//_____________________________________________________________________________
AliMpExMapIterator*
AliMUON2DMapIteratorByI::NextIterator()
{
  /// Get next map (from fIter1) and create an iterator to it
  
  AliMpExMap* m = static_cast<AliMpExMap*>(fIter1->Next(fCurrentI));
  
  if (!m) return 0x0;
  
  if ( fCurrentI < fFirstI || fCurrentI > fLastI ) return NextIterator(); // try again

  return m->CreateIterator();
}

//_____________________________________________________________________________
TObject*
AliMUON2DMapIteratorByI::Next()
{
  /// return next object

  if (!fIter2) return 0x0;
  
  TObject* o = fIter2->Next();
  
  if (!o)
  {
    delete fIter2;
    fIter2 = NextIterator();
    return Next();
  }  
  
  return o;
}

//_____________________________________________________________________________
void
AliMUON2DMapIteratorByI::Reset()
{
  /// rewind the iterator
  
  delete fIter2;
  fIter1->Reset();
  fIter2 = NextIterator();
  fCurrentI = -1;
}

 AliMUON2DMapIteratorByI.cxx:1
 AliMUON2DMapIteratorByI.cxx:2
 AliMUON2DMapIteratorByI.cxx:3
 AliMUON2DMapIteratorByI.cxx:4
 AliMUON2DMapIteratorByI.cxx:5
 AliMUON2DMapIteratorByI.cxx:6
 AliMUON2DMapIteratorByI.cxx:7
 AliMUON2DMapIteratorByI.cxx:8
 AliMUON2DMapIteratorByI.cxx:9
 AliMUON2DMapIteratorByI.cxx:10
 AliMUON2DMapIteratorByI.cxx:11
 AliMUON2DMapIteratorByI.cxx:12
 AliMUON2DMapIteratorByI.cxx:13
 AliMUON2DMapIteratorByI.cxx:14
 AliMUON2DMapIteratorByI.cxx:15
 AliMUON2DMapIteratorByI.cxx:16
 AliMUON2DMapIteratorByI.cxx:17
 AliMUON2DMapIteratorByI.cxx:18
 AliMUON2DMapIteratorByI.cxx:19
 AliMUON2DMapIteratorByI.cxx:20
 AliMUON2DMapIteratorByI.cxx:21
 AliMUON2DMapIteratorByI.cxx:22
 AliMUON2DMapIteratorByI.cxx:23
 AliMUON2DMapIteratorByI.cxx:24
 AliMUON2DMapIteratorByI.cxx:25
 AliMUON2DMapIteratorByI.cxx:26
 AliMUON2DMapIteratorByI.cxx:27
 AliMUON2DMapIteratorByI.cxx:28
 AliMUON2DMapIteratorByI.cxx:29
 AliMUON2DMapIteratorByI.cxx:30
 AliMUON2DMapIteratorByI.cxx:31
 AliMUON2DMapIteratorByI.cxx:32
 AliMUON2DMapIteratorByI.cxx:33
 AliMUON2DMapIteratorByI.cxx:34
 AliMUON2DMapIteratorByI.cxx:35
 AliMUON2DMapIteratorByI.cxx:36
 AliMUON2DMapIteratorByI.cxx:37
 AliMUON2DMapIteratorByI.cxx:38
 AliMUON2DMapIteratorByI.cxx:39
 AliMUON2DMapIteratorByI.cxx:40
 AliMUON2DMapIteratorByI.cxx:41
 AliMUON2DMapIteratorByI.cxx:42
 AliMUON2DMapIteratorByI.cxx:43
 AliMUON2DMapIteratorByI.cxx:44
 AliMUON2DMapIteratorByI.cxx:45
 AliMUON2DMapIteratorByI.cxx:46
 AliMUON2DMapIteratorByI.cxx:47
 AliMUON2DMapIteratorByI.cxx:48
 AliMUON2DMapIteratorByI.cxx:49
 AliMUON2DMapIteratorByI.cxx:50
 AliMUON2DMapIteratorByI.cxx:51
 AliMUON2DMapIteratorByI.cxx:52
 AliMUON2DMapIteratorByI.cxx:53
 AliMUON2DMapIteratorByI.cxx:54
 AliMUON2DMapIteratorByI.cxx:55
 AliMUON2DMapIteratorByI.cxx:56
 AliMUON2DMapIteratorByI.cxx:57
 AliMUON2DMapIteratorByI.cxx:58
 AliMUON2DMapIteratorByI.cxx:59
 AliMUON2DMapIteratorByI.cxx:60
 AliMUON2DMapIteratorByI.cxx:61
 AliMUON2DMapIteratorByI.cxx:62
 AliMUON2DMapIteratorByI.cxx:63
 AliMUON2DMapIteratorByI.cxx:64
 AliMUON2DMapIteratorByI.cxx:65
 AliMUON2DMapIteratorByI.cxx:66
 AliMUON2DMapIteratorByI.cxx:67
 AliMUON2DMapIteratorByI.cxx:68
 AliMUON2DMapIteratorByI.cxx:69
 AliMUON2DMapIteratorByI.cxx:70
 AliMUON2DMapIteratorByI.cxx:71
 AliMUON2DMapIteratorByI.cxx:72
 AliMUON2DMapIteratorByI.cxx:73
 AliMUON2DMapIteratorByI.cxx:74
 AliMUON2DMapIteratorByI.cxx:75
 AliMUON2DMapIteratorByI.cxx:76
 AliMUON2DMapIteratorByI.cxx:77
 AliMUON2DMapIteratorByI.cxx:78
 AliMUON2DMapIteratorByI.cxx:79
 AliMUON2DMapIteratorByI.cxx:80
 AliMUON2DMapIteratorByI.cxx:81
 AliMUON2DMapIteratorByI.cxx:82
 AliMUON2DMapIteratorByI.cxx:83
 AliMUON2DMapIteratorByI.cxx:84
 AliMUON2DMapIteratorByI.cxx:85
 AliMUON2DMapIteratorByI.cxx:86
 AliMUON2DMapIteratorByI.cxx:87
 AliMUON2DMapIteratorByI.cxx:88
 AliMUON2DMapIteratorByI.cxx:89
 AliMUON2DMapIteratorByI.cxx:90
 AliMUON2DMapIteratorByI.cxx:91
 AliMUON2DMapIteratorByI.cxx:92
 AliMUON2DMapIteratorByI.cxx:93
 AliMUON2DMapIteratorByI.cxx:94
 AliMUON2DMapIteratorByI.cxx:95
 AliMUON2DMapIteratorByI.cxx:96
 AliMUON2DMapIteratorByI.cxx:97
 AliMUON2DMapIteratorByI.cxx:98
 AliMUON2DMapIteratorByI.cxx:99
 AliMUON2DMapIteratorByI.cxx:100
 AliMUON2DMapIteratorByI.cxx:101
 AliMUON2DMapIteratorByI.cxx:102
 AliMUON2DMapIteratorByI.cxx:103
 AliMUON2DMapIteratorByI.cxx:104
 AliMUON2DMapIteratorByI.cxx:105
 AliMUON2DMapIteratorByI.cxx:106
 AliMUON2DMapIteratorByI.cxx:107
 AliMUON2DMapIteratorByI.cxx:108
 AliMUON2DMapIteratorByI.cxx:109
 AliMUON2DMapIteratorByI.cxx:110
 AliMUON2DMapIteratorByI.cxx:111
 AliMUON2DMapIteratorByI.cxx:112
 AliMUON2DMapIteratorByI.cxx:113
 AliMUON2DMapIteratorByI.cxx:114
 AliMUON2DMapIteratorByI.cxx:115
 AliMUON2DMapIteratorByI.cxx:116
 AliMUON2DMapIteratorByI.cxx:117
 AliMUON2DMapIteratorByI.cxx:118
 AliMUON2DMapIteratorByI.cxx:119
 AliMUON2DMapIteratorByI.cxx:120
 AliMUON2DMapIteratorByI.cxx:121
 AliMUON2DMapIteratorByI.cxx:122
 AliMUON2DMapIteratorByI.cxx:123
 AliMUON2DMapIteratorByI.cxx:124
 AliMUON2DMapIteratorByI.cxx:125