]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - MUON/mapping/AliMpStringObjMap.cxx
Fix for the problem during PbPb run of Nov 2010 (Indra)
[u/mrichter/AliRoot.git] / MUON / mapping / AliMpStringObjMap.cxx
index 7b8bf2e1dfd1c7fcdd60fdbc7431e3364177b84d..fdd6eef84a0357f4df05f4d4ba32ec17fec13c43 100644 (file)
  **************************************************************************/
 
 // $Id$
-// $MpId: $
+// $MpId: AliMpStringObjMap.cxx,v 1.4 2006/05/24 13:58:29 ivana Exp $
 
-// ------------------------------------ 
+//-----------------------------------------------------------------------------
 // Class AliMpStringObjMap
 // ------------------------------------ 
 // Helper class that substitutes map <string, int> 
 // which ALICE does not allow to use 
 // Author: Ivana Hrivnacova, IPN Orsay
-
-#include <Riostream.h>
-#include <TObjString.h>
+//-----------------------------------------------------------------------------
 
 #include "AliMpStringObjMap.h"
+
 #include "AliLog.h"
 
+#include <TObjString.h>
+#include <Riostream.h>
+
+/// \cond CLASSIMP
 ClassImp(AliMpStringObjMap)
+/// \endcond
+
+const TString AliMpStringObjMap::fgkUndefinedKey = "Undefined";
 
 //______________________________________________________________________________
-AliMpStringObjMap::AliMpStringObjMap()
+AliMpStringObjMap::AliMpStringObjMap(Bool_t isOwner)
  : TObject(),
    fNofItems(0),
    fFirstArray(),
-   fSecondArray()
+   fSecondArray(),
+   fCurrentIndex(0)
 {
 /// Standard constructor
 
   fFirstArray.SetOwner(true);
-}
-
-//______________________________________________________________________________
-AliMpStringObjMap::AliMpStringObjMap(const AliMpStringObjMap& rhs)
-  : TObject(rhs)
-{
-/// Protected copy constructor
-
-  AliFatal("Copy constructor is not implemented.");
+  fSecondArray.SetOwner(isOwner);
 }
 
 //______________________________________________________________________________
@@ -60,21 +59,6 @@ AliMpStringObjMap::~AliMpStringObjMap()
   fFirstArray.Delete();
 }
 
-//______________________________________________________________________________
-AliMpStringObjMap& 
-AliMpStringObjMap::operator = (const AliMpStringObjMap& rhs) 
-{
-/// Protected assignement operator
-
-  // check assignement to self
-  if (this == &rhs) return *this;
-
-  AliFatal("Assignment operator is not implemented.");
-    
-  return *this;  
-}
-
-
 //
 // public methods
 //
@@ -147,7 +131,7 @@ void AliMpStringObjMap::Print(const char* /*option*/) const
 //______________________________________________________________________________
 void AliMpStringObjMap::Print(const TString& key, ofstream& out) const
 {
-// Prints the map elements
+/// Special printing 
 
   for (Int_t i=0; i<fNofItems; i++) {
     out  << key << "  "
@@ -158,3 +142,53 @@ void AliMpStringObjMap::Print(const TString& key, ofstream& out) const
         << endl;
   }
 }       
+
+//______________________________________________________________________________
+void  AliMpStringObjMap::First()
+{
+/// Set iterator to the first item and return its object
+
+  fCurrentIndex = 0; 
+}  
+  
+
+//______________________________________________________________________________
+void  AliMpStringObjMap::Next()
+{
+/// Set iterator to the next item and return its object
+/// Return 0 if there are no more items
+
+  ++fCurrentIndex;
+}  
+    
+
+//______________________________________________________________________________
+TObject* AliMpStringObjMap::CurrentItem()
+{
+/// Set iterator to the first item and return its object
+
+  if ( fCurrentIndex >= fNofItems ) return 0;
+
+  return fSecondArray.At(fCurrentIndex);
+}  
+  
+
+//______________________________________________________________________________
+TString AliMpStringObjMap::CurrentKey()
+{
+/// Set iterator to the first item and return its object
+
+  if ( fCurrentIndex >= fNofItems ) return fgkUndefinedKey;
+  
+  return ((TObjString*)fFirstArray.At(fCurrentIndex))->GetString();
+}  
+  
+
+//______________________________________________________________________________
+Bool_t  AliMpStringObjMap::IsDone() const
+{
+/// Return true if the iterator reached the end of map
+
+  return fCurrentIndex >= fNofItems;
+}   
+