: TObject(),
fNofItems(0),
fFirstArray(100),
- fSecondArray(100)
+ fSecondArray(100),
+ fCurrentIndex(0)
{
/// Standard constructor
<< endl;
}
}
+
+//______________________________________________________________________________
+Bool_t AliMUONStringIntMap::Next(TString& first, Int_t& second)
+{
+/// Iterator: next method.
+/// Returns false if the iterator reached the end.
+
+
+ if ( fCurrentIndex >= fNofItems ) return false;
+
+ TObjString* objString = (TObjString*)fFirstArray.At(fCurrentIndex);
+ first = objString->GetString();
+
+ second = fSecondArray.At(fCurrentIndex);
+
+ ++fCurrentIndex;
+
+ return true;
+}
+
+//______________________________________________________________________________
+void AliMUONStringIntMap::ResetItr()
+{
+/// Reset iterator
+
+ fCurrentIndex = 0;
+}
virtual void Clear(Option_t* /*option*/ ="");
virtual void Print(const char* /*option*/ = "") const;
void Print(const TString& key, ofstream& out) const;
-
+
+ // Methods for iterating over all elements
+ Bool_t Next(TString& first, Int_t& second);
+ void ResetItr();
+
protected:
/// Not implemented
AliMUONStringIntMap(const AliMUONStringIntMap& rhs);
Int_t fNofItems; ///< number of items
TObjArray fFirstArray; ///< first item array
TArrayI fSecondArray; ///< second item array
-
- ClassDef(AliMUONStringIntMap,1) // motif map
+ Int_t fCurrentIndex;///< current index
+
+ ClassDef(AliMUONStringIntMap,2) // motif map
};
#endif //ALI_MUON_STRING_INT_MAP_H