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"
28 #include "AliMpExMap.h"
29 #include "AliMpIntPair.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(Long_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.
122 //_____________________________________________________________________________
124 AliMpExMapIterator::Next(Int_t& key)
126 /// Return the next object in iteration and fill the key.
127 /// The returned object must not be deleted by the user.
132 key = (Int_t)(index);
136 //_____________________________________________________________________________
138 AliMpExMapIterator::Next(AliMpIntPair& key)
140 /// Return the next object in iteration and fill the key.
141 /// The returned object must not be deleted by the user.
146 key = AliMpExMap::GetPair(index);
150 //_____________________________________________________________________________
152 AliMpExMapIterator::Next(TString& key)
154 /// Return the next object in iteration and fill the key.
155 /// The returned object must not be deleted by the user.
160 key = AliMpExMap::GetString(index);
164 //_____________________________________________________________________________
166 AliMpExMapIterator::Reset()
173 //_____________________________________________________________________________
175 AliMpExMapIterator::GetCollection() const
177 /// Nothing to be returned here, AliMpExMap is not a TCollection