1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
18 //-----------------------------------------------------------------------------
19 // Class AliMpExMapIterator
20 // ------------------------
21 // Implementation of TIterator for AliMpExMap
22 // Author: Laurent Aphecetche
23 //-----------------------------------------------------------------------------
25 #include "AliMpExMapIterator.h"
26 #include "AliMpExMap.h"
35 ClassImp(AliMpExMapIterator)
38 //_____________________________________________________________________________
39 AliMpExMapIterator::AliMpExMapIterator(const AliMpExMap& theMap)
41 fIterator(new TExMapIter(&(theMap.fMap)))
43 /// Standard constructor
46 //_____________________________________________________________________________
47 AliMpExMapIterator::AliMpExMapIterator(const AliMpExMapIterator& rhs)
49 fIterator(rhs.fIterator)
54 //_____________________________________________________________________________
56 AliMpExMapIterator::operator=(const AliMpExMapIterator& rhs)
58 /// Assignment operator
62 fIterator = rhs.fIterator;
67 //_____________________________________________________________________________
69 AliMpExMapIterator::operator=(const TIterator& rhs)
71 /// Overriden operator= (imposed by Root's definition of TIterator::operator= ?)
73 if ( this != &rhs && rhs.IsA() == AliMpExMapIterator::Class() )
75 const AliMpExMapIterator& rhs1 = static_cast<const AliMpExMapIterator&>(rhs);
76 fIterator = rhs1.fIterator;
81 //_____________________________________________________________________________
82 AliMpExMapIterator::~AliMpExMapIterator()
89 //_____________________________________________________________________________
91 AliMpExMapIterator::Next(Index_t& index, TObject*& object)
93 /// Move to next object in iteration
99 Bool_t rv = fIterator->Next(index,value);
103 object = reinterpret_cast<TObject*> (value);
109 //_____________________________________________________________________________
111 AliMpExMapIterator::Next()
113 /// Return the next object in iteration.
114 /// The returned object must not be deleted by the user.
121 //_____________________________________________________________________________
123 AliMpExMapIterator::Next(Int_t& key)
125 /// Return the next object in iteration and fill the key.
126 /// The returned object must not be deleted by the user.
131 key = (Int_t)(index);
135 //_____________________________________________________________________________
137 AliMpExMapIterator::Next(Int_t& keyFirst, Int_t& keySecond)
139 /// Return the next object in iteration and fill the key.
140 /// The returned object must not be deleted by the user.
144 keyFirst = AliMpExMap::GetPairFirst(index);
145 keySecond = AliMpExMap::GetPairSecond(index);
149 //_____________________________________________________________________________
151 AliMpExMapIterator::Next(TString& key)
153 /// Return the next object in iteration and fill the key.
154 /// The returned object must not be deleted by the user.
158 key = AliMpExMap::GetString(index);
162 //_____________________________________________________________________________
164 AliMpExMapIterator::Reset()
171 //_____________________________________________________________________________
173 AliMpExMapIterator::GetCollection() const
175 /// Nothing to be returned here, AliMpExMap is not a TCollection