AliRoot Core  3dc7879 (3dc7879)
AliMUON2DMapIterator.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 #include "AliMUON2DMapIterator.h"
19 
20 //-----------------------------------------------------------------------------
27 //-----------------------------------------------------------------------------
28 
29 #include "AliMpExMap.h"
30 #include "AliMpExMapIterator.h"
31 #include "AliLog.h"
32 
34 ClassImp(AliMUON2DMapIterator)
36 
37 //_____________________________________________________________________________
39 : TIterator(),
40 fkMap(&theMap),
41 fIter1(theMap.CreateIterator()),
42 fIter2(NextIterator())
43 {
45  Reset();
46 }
47 
48 //_____________________________________________________________________________
50 AliMUON2DMapIterator::operator=(const TIterator& /*rhs*/)
51 {
52  // overriden operator= (imposed by Root's definition of TIterator::operator= ?)
53 
54  AliFatalGeneral("operator=(TIterator&)",""); // as in copy ctor
55  return *this;
56 }
57 
58 //_____________________________________________________________________________
60 {
62  delete fIter1;
63  delete fIter2;
64 }
65 
66 //_____________________________________________________________________________
67 const TCollection*
69 {
71  return 0x0;
72 }
73 
74 //_____________________________________________________________________________
75 TIterator*
77 {
79 
80  AliMpExMap* m = static_cast<AliMpExMap*>(fIter1->Next());
81 
82  if (!m) return 0x0;
83 
84  return m->CreateIterator();
85 }
86 
87 //_____________________________________________________________________________
88 TObject*
90 {
92 
93  if (!fIter2) return 0x0;
94 
95  TObject* o = fIter2->Next();
96 
97  if (!o)
98  {
99  delete fIter2;
100  fIter2 = NextIterator();
101  return Next();
102  }
103 
104  return o;
105 }
106 
107 //_____________________________________________________________________________
108 void
110 {
112 
113  delete fIter2;
114  fIter1->Reset();
115  fIter2 = NextIterator();
116 }
117 
#define AliFatalGeneral(scope, message)
Definition: AliLog.h:650
virtual TObject * Next()
The returned object must not be deleted by the user.
TIterator * fIter1
first iterator
Implementation of TIterator for 2D maps.
TIterator * fIter2
second iterator
virtual const TCollection * GetCollection() const
AliMUON2DMapIterator & operator=(const AliMUON2DMapIterator &rhs)
Not implemented.
Helper class making Root persistent TExMap.
Definition: AliMpExMap.h:28
AliMpExMapIterator * CreateIterator() const
Definition: AliMpExMap.cxx:357