AliRoot Core  3abf5b4 (3abf5b4)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliMUON2DMapIteratorByI.cxx
Go to the documentation of this file.
1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
15 
16 // $Id$
17 
18 //-----------------------------------------------------------------------------
28 //-----------------------------------------------------------------------------
29 
31 #include "AliMpExMapIterator.h"
32 #include "AliMpExMap.h"
33 #include "AliLog.h"
34 
38 
39 //_____________________________________________________________________________
40 AliMUON2DMapIteratorByI::AliMUON2DMapIteratorByI(const AliMpExMap& theMap, Int_t firstI, Int_t lastI)
41 : TIterator(),
42 fkMap(&theMap),
43 fIter1(theMap.CreateIterator()),
44 fIter2(0x0),
45 fFirstI(firstI),
46 fLastI(lastI),
47 fCurrentI(-1)
48 {
50  Reset();
51 }
52 
53 //_____________________________________________________________________________
55 AliMUON2DMapIteratorByI::operator=(const TIterator& /*rhs*/)
56 {
57  // overriden operator= (imposed by Root's definition of TIterator::operator= ?)
58 
59  AliFatalGeneral("operator=(TIterator&)",""); // as in copy ctor
60  return *this;
61 }
62 
63 //_____________________________________________________________________________
65 {
67  delete fIter1;
68  delete fIter2;
69 }
70 
71 //_____________________________________________________________________________
72 const TCollection*
74 {
76  return 0x0;
77 }
78 
79 //_____________________________________________________________________________
82 {
84 
85  AliMpExMap* m = static_cast<AliMpExMap*>(fIter1->Next(fCurrentI));
86 
87  if (!m) return 0x0;
88 
89  if ( fCurrentI < fFirstI || fCurrentI > fLastI ) return NextIterator(); // try again
90 
91  return m->CreateIterator();
92 }
93 
94 //_____________________________________________________________________________
95 TObject*
97 {
99 
100  if (!fIter2) return 0x0;
101 
102  TObject* o = fIter2->Next();
103 
104  if (!o)
105  {
106  delete fIter2;
107  fIter2 = NextIterator();
108  return Next();
109  }
110 
111  return o;
112 }
113 
114 //_____________________________________________________________________________
115 void
117 {
119 
120  delete fIter2;
121  fIter1->Reset();
122  fIter2 = NextIterator();
123  fCurrentI = -1;
124 }
125 
virtual const TCollection * GetCollection() const
TIterator * fIter2
second iterator
AliMUON2DMapIteratorByI & operator=(const AliMUON2DMapIteratorByI &rhs)
Not implemented.
ClassImp(TPCGenInfo)
Definition: AliTPCCmpNG.C:254
Int_t fLastI
end of range for I
Implementation of TIterator for 2D maps.
AliMpExMapIterator * NextIterator()
virtual TObject * Next()
The returned object must not be deleted by the user.
AliMpExMapIterator * fIter1
first iterator
Int_t fCurrentI
current value of I
virtual TObject * Next()
The returned object must not be deleted by the user.
Implementation of TIterator for AliMpExMap.
Helper class making Root persistent TExMap.
Definition: AliMpExMap.h:28
AliMpExMapIterator * CreateIterator() const
Definition: AliMpExMap.cxx:357