]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Moving the Decode methods (which are used by 2 classes now) (Laurent)
authorivana <ivana@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 29 Mar 2007 11:14:54 +0000 (11:14 +0000)
committerivana <ivana@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 29 Mar 2007 11:14:54 +0000 (11:14 +0000)
MUON/AliMUONV2DStore.cxx
MUON/mapping/AliMpHelper.cxx
MUON/mapping/AliMpHelper.h

index 7d9a2cdefa9c9511168dc3c394366a28c19d7ca6..efd431ebe8b0b542e66f468237963cc7a4ceed3c 100644 (file)
@@ -33,6 +33,7 @@ ClassImp(AliMUONV2DStore)
 
 #include "AliMpIntPair.h"
 #include "AliMUONObjectPair.h"
+#include "AliMpHelper.h"
 #include "AliMUONVDataIterator.h"
 #include "Riostream.h"
 #include "TMap.h"
@@ -52,44 +53,6 @@ AliMUONV2DStore::~AliMUONV2DStore()
 /// Destructor
 }
 
-TMap* Decode(const TString& s)
-{
-  TString ss(s);
-  ss.ToUpper();
-  
-  TMap* m = new TMap;
-  m->SetOwner(true);
-  
-  TObjArray* a = ss.Tokenize(";");
-  TIter next(a);
-  TObjString* o;
-  
-  while ( ( o = static_cast<TObjString*>(next()) ) )
-  {
-    TString& os(o->String());
-    TObjArray* b = os.Tokenize("=");
-    if (b->GetEntries()==2)
-    {
-      m->Add(b->At(0),b->At(1));
-    }
-  }
-  return m;
-}
-
-Bool_t Decode(const TMap& m, const TString& key, TString& value)
-{
-  TString skey(key);
-  skey.ToUpper();
-  value = "";
-  TPair* p = static_cast<TPair*>(m.FindObject(skey));
-  if (p) 
-  {
-    value = (static_cast<TObjString*>(p->Value()))->String();
-    return kTRUE;
-  }
-  return kFALSE;
-}
-
 //_____________________________________________________________________________
 void
 AliMUONV2DStore::Print(Option_t* opt) const
@@ -104,14 +67,14 @@ AliMUONV2DStore::Print(Option_t* opt) const
   
   AliMUONObjectPair* pair;
   
-  TMap* m = Decode(opt);
+  TMap* m = AliMpHelper::Decode(opt);
   
   TString si;  
-  Bool_t selectI = Decode(*m,"i",si);
+  Bool_t selectI = AliMpHelper::Decode(*m,"i",si);
   TString sj;
-  Bool_t selectJ = Decode(*m,"j",sj);
+  Bool_t selectJ = AliMpHelper::Decode(*m,"j",sj);
   TString sopt;
-  Decode(*m,"opt",sopt);
+  AliMpHelper::Decode(*m,"opt",sopt);
   
   m->DeleteAll();
   delete m;
index 28b0dacdb36ca5d9e4fbdee433d993a8c83810f1..1656dc9ba30bc4cdbb791b2aa3f382b2c2c93362 100644 (file)
@@ -22,6 +22,7 @@
 #include "TObjArray.h"
 #include "TObjString.h"
 #include "TString.h"
+#include "TMap.h"
 
 ///
 /// \class AliMpHelper
@@ -50,6 +51,52 @@ AliMpHelper::~AliMpHelper()
   ///
 }
 
+//_____________________________________________________________________________
+TMap* 
+AliMpHelper::Decode(const TString& s)
+{
+  /// \todo add comment  
+
+  TString ss(s);
+  ss.ToUpper();
+  
+  TMap* m = new TMap;
+  m->SetOwner(true);
+  
+  TObjArray* a = ss.Tokenize(";");
+  TIter next(a);
+  TObjString* o;
+  
+  while ( ( o = static_cast<TObjString*>(next()) ) )
+  {
+    TString& os(o->String());
+    TObjArray* b = os.Tokenize("=");
+    if (b->GetEntries()==2)
+    {
+      m->Add(b->At(0),b->At(1));
+    }
+  }
+  return m;
+}
+
+//_____________________________________________________________________________
+Bool_t 
+AliMpHelper::Decode(const TMap& m, const TString& key, TString& value)
+{
+  /// \todo add comment  
+
+  TString skey(key);
+  skey.ToUpper();
+  value = "";
+  TPair* p = static_cast<TPair*>(m.FindObject(skey));
+  if (p) 
+  {
+    value = (static_cast<TObjString*>(p->Value()))->String();
+    return kTRUE;
+  }
+  return kFALSE;
+}
+
 //_____________________________________________________________________________
 void AliMpHelper::DecodeName(const char* name, char sep, TArrayI& theList)
 {
index f72bccd90b6e2237927d8b6b22f60e429f1eb2fc..0c6e7be31a4b4befc31b2e661f39f4c10c2f7fa1 100644 (file)
@@ -19,6 +19,7 @@
 
 class TArrayI;
 class TString;
+class TMap;
 
 class AliMpHelper : public TObject
 {
@@ -33,6 +34,10 @@ class AliMpHelper : public TObject
 
   static TString Normalize(const char* line);
                            
+  static TMap* Decode(const TString& s);
+  
+  static Bool_t Decode(const TMap& m, const TString& key, TString& value);
+  
   ClassDef(AliMpHelper,1) // Helper for parsing slat stations mapping files 
 };