]>
Commit | Line | Data |
---|---|---|
8cb048f5 | 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 "AliMpExMapIterator.h" | |
19 | ||
20 | #include "AliLog.h" | |
21 | #include "AliMpExMap.h" | |
22 | #include "AliMpIntPair.h" | |
23 | #include <TClass.h> | |
24 | #include <TExMap.h> | |
25 | #include <TString.h> | |
26 | ||
27 | /// \cond CLASSIMP | |
28 | ClassImp(AliMpExMapIterator) | |
29 | /// \endcond | |
30 | ||
31 | //_____________________________________________________________________________ | |
32 | AliMpExMapIterator::AliMpExMapIterator(const AliMpExMap& theMap) | |
33 | : fIterator(new TExMapIter(&(theMap.fMap))) | |
34 | { | |
35 | /// Standard constructor | |
36 | } | |
37 | ||
38 | //_____________________________________________________________________________ | |
39 | AliMpExMapIterator::AliMpExMapIterator(const AliMpExMapIterator& rhs) | |
40 | : fIterator(rhs.fIterator) | |
41 | { | |
42 | /// Copy constructor | |
43 | } | |
44 | ||
45 | //_____________________________________________________________________________ | |
46 | AliMpExMapIterator& | |
47 | AliMpExMapIterator::operator=(const AliMpExMapIterator& rhs) | |
48 | { | |
49 | /// Assignment operator | |
50 | ||
51 | if ( this != &rhs ) | |
52 | { | |
53 | fIterator = rhs.fIterator; | |
54 | } | |
55 | return *this; | |
56 | } | |
57 | ||
58 | //_____________________________________________________________________________ | |
59 | TIterator& | |
60 | AliMpExMapIterator::operator=(const TIterator& rhs) | |
61 | { | |
62 | /// overriden operator= (imposed by Root's definition of TIterator::operator= ?) | |
63 | ||
64 | if ( this != &rhs && rhs.IsA() == AliMpExMapIterator::Class() ) | |
65 | { | |
66 | const AliMpExMapIterator& rhs1 = static_cast<const AliMpExMapIterator&>(rhs); | |
67 | fIterator = rhs1.fIterator; | |
68 | } | |
69 | return *this; | |
70 | } | |
71 | ||
72 | //_____________________________________________________________________________ | |
73 | AliMpExMapIterator::~AliMpExMapIterator() | |
74 | { | |
75 | /// Destructor | |
76 | ||
77 | delete fIterator; | |
78 | } | |
79 | ||
80 | //_____________________________________________________________________________ | |
81 | Bool_t | |
82 | AliMpExMapIterator::Next(Long_t& index, TObject*& object) | |
83 | { | |
84 | /// Move to next object in iteration | |
85 | ||
86 | Long_t value(0); | |
87 | ||
88 | object = 0; | |
89 | ||
90 | Bool_t rv = fIterator->Next(index,value); | |
91 | ||
92 | if ( rv ) | |
93 | { | |
94 | object = reinterpret_cast<TObject*> (value); | |
95 | } | |
96 | ||
97 | return rv; | |
98 | } | |
99 | ||
100 | //_____________________________________________________________________________ | |
101 | TObject* | |
102 | AliMpExMapIterator::Next() | |
103 | { | |
104 | /// Return the next object in iteration. | |
105 | /// The returned object must not be deleted by the user. | |
106 | ||
107 | Long_t dummy; | |
108 | TObject* o(0x0); | |
109 | Next(dummy,o); | |
110 | return o; | |
111 | } | |
112 | ||
113 | //_____________________________________________________________________________ | |
114 | TObject* | |
115 | AliMpExMapIterator::Next(Int_t& key) | |
116 | { | |
117 | /// Return the next object in iteration and fill the key. | |
118 | /// The returned object must not be deleted by the user. | |
119 | ||
120 | TObject* o; | |
121 | Long_t index; | |
122 | Next(index,o); | |
123 | key = (Int_t)(index); | |
124 | return o; | |
125 | } | |
126 | ||
127 | //_____________________________________________________________________________ | |
128 | TObject* | |
129 | AliMpExMapIterator::Next(AliMpIntPair& key) | |
130 | { | |
131 | /// Return the next object in iteration and fill the key. | |
132 | /// The returned object must not be deleted by the user. | |
133 | ||
134 | Long_t index; | |
135 | TObject* o(0x0); | |
136 | Next(index,o); | |
137 | key = AliMpExMap::GetPair(index); | |
138 | return o; | |
139 | } | |
140 | ||
141 | //_____________________________________________________________________________ | |
142 | TObject* | |
143 | AliMpExMapIterator::Next(TString& key) | |
144 | { | |
145 | /// Return the next object in iteration and fill the key. | |
146 | /// The returned object must not be deleted by the user. | |
147 | ||
148 | Long_t index; | |
149 | TObject* o(0x0); | |
150 | Next(index,o); | |
151 | key = AliMpExMap::GetString(index); | |
152 | return o; | |
153 | } | |
154 | ||
155 | //_____________________________________________________________________________ | |
156 | void | |
157 | AliMpExMapIterator::Reset() | |
158 | { | |
159 | /// Reset | |
160 | ||
161 | fIterator->Reset(); | |
162 | } | |
163 | ||
164 | //_____________________________________________________________________________ | |
165 | const TCollection* | |
166 | AliMpExMapIterator::GetCollection() const | |
167 | { | |
168 | /// Nothing to be returned here, AliMpExMap is not a TCollection | |
169 | ||
170 | return 0x0; | |
171 | } |