]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - STEER/AliCDBPath.cxx
AddTrial method added, changed trials to unsigned int
[u/mrichter/AliRoot.git] / STEER / AliCDBPath.cxx
index ee170c8d21bb62687c2baceb1addd9748f6c18fb..317c2aa175ab597528ec988eccaf098d8a799613 100644 (file)
@@ -35,8 +35,13 @@ ClassImp(AliCDBPath)
 
 //_____________________________________________________________________________
 AliCDBPath::AliCDBPath() :
-fIsValid(kTRUE),
-fIsWildcard(kFALSE)
+  TObject(),
+  fPath(""),
+  fLevel0(""),
+  fLevel1(""),
+  fLevel2(""),
+  fIsValid(kTRUE),
+  fIsWildcard(kFALSE)
 {
 // default constructor
 
@@ -44,8 +49,13 @@ fIsWildcard(kFALSE)
 
 //_____________________________________________________________________________
 AliCDBPath::AliCDBPath(const AliCDBPath& other):
-TObject(other),
-fPath(other.fPath)
+  TObject(other),
+  fPath(other.fPath),
+  fLevel0(""),
+  fLevel1(""),
+  fLevel2(""),
+  fIsValid(other.fIsValid),
+  fIsWildcard(other.fIsWildcard)
 {
 // constructor
        Init();
@@ -56,9 +66,13 @@ fPath(other.fPath)
 //_____________________________________________________________________________
 AliCDBPath::AliCDBPath(const char* level0, const char* level1,
        const char* level2):
-fLevel0(level0), 
-fLevel1(level1), 
-fLevel2(level2)
+  TObject(),
+  fPath(""),
+  fLevel0(level0), 
+  fLevel1(level1), 
+  fLevel2(level2),
+  fIsValid(kTRUE),
+  fIsWildcard(kFALSE)
 {
 // constructor
 
@@ -84,7 +98,13 @@ fLevel2(level2)
 
 //_____________________________________________________________________________
 AliCDBPath::AliCDBPath(const char* path):
-fPath(path)
+  TObject(),
+  fPath(path),
+  fLevel0(""),
+  fLevel1(""),
+  fLevel2(""),
+  fIsValid(kTRUE),
+  fIsWildcard(kFALSE)
 {
 // constructor
 
@@ -94,7 +114,13 @@ fPath(path)
 
 //_____________________________________________________________________________
 AliCDBPath::AliCDBPath(const TString& path):
-fPath(path)
+  TObject(),
+  fPath(path),
+  fLevel0(""),
+  fLevel1(""),
+  fLevel2(""),
+  fIsValid(kTRUE),
+  fIsWildcard(kFALSE)
 {
        Init();
        InitPath();
@@ -124,9 +150,9 @@ void AliCDBPath::InitPath() {
 
        } else if (paramCount == 2) {
                fLevel0 = ((TObjString*) anArray->At(0))->GetString();
-               TString aString =  ((TObjString*) anArray->At(1))->GetString();
+               TString bString =  ((TObjString*) anArray->At(1))->GetString();
 
-               if (IsWord(fLevel0) && aString == "*") {
+               if (IsWord(fLevel0) && bString == "*") {
                        fLevel1 = "*";
                        fLevel2 = "*";
                
@@ -157,10 +183,12 @@ void AliCDBPath::InitPath() {
        
        if (!fIsValid) {
                AliInfo(Form("Invalid AliCDBPath <%s>!", fPath.Data()));
+       } else {        
+               fPath = Form("%s/%s/%s", fLevel0.Data(), fLevel1.Data(), fLevel2.Data());
        }
        
        delete anArray;
-
+       
        Init();
 }
 
@@ -174,7 +202,7 @@ AliCDBPath::~AliCDBPath() {
 Bool_t AliCDBPath::IsWord(const TString& str) {
 // check if string is a word
 
-       TRegexp pattern("^[a-zA-Z0-9_.]+$");
+       TRegexp pattern("^[a-zA-Z0-9_.-]+$");
 
        return str.Contains(pattern);   
 }
@@ -223,7 +251,27 @@ Bool_t AliCDBPath::Level2Comprises(const TString& str) const {
 Bool_t AliCDBPath::Comprises(const AliCDBPath& other) const {
 // check if path is wildcard and comprises other
 
-       return Level0Comprises(other.fLevel0) 
+       return Level0Comprises(other.fLevel0)
                && Level1Comprises(other.fLevel1)
                && Level2Comprises(other.fLevel2);
 }
+
+//_____________________________________________________________________________
+const char* AliCDBPath::GetLevel(Int_t i) const {
+// return level i of the path
+
+       switch (i) {
+               case 0:
+                       return fLevel0.Data();
+                       break;
+               case 1:
+                       return fLevel1.Data();
+                       break;
+               case 2:
+                       return fLevel2.Data();
+                       break;
+               default:
+                       return 0;
+       }
+
+}