]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/mapping/AliMpDataMap.cxx
In mapping:
[u/mrichter/AliRoot.git] / MUON / mapping / AliMpDataMap.cxx
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 // Category: basic
18
19 //-----------------------------------------------------------------------------
20 // Class AliMpDataMap
21 // ------------------------
22 // TObject class containing a map of strings to strings
23 // Author:Ivana Hrivnacova; IPN Orsay
24 //-----------------------------------------------------------------------------
25
26 #include "AliMpDataMap.h"
27
28 #include "AliLog.h"
29
30 #include <TObjString.h>
31
32 /// \cond CLASSIMP
33 ClassImp(AliMpDataMap)
34 /// \endcond
35
36 //_____________________________________________________________________________
37 AliMpDataMap::AliMpDataMap() 
38   : TObject(),
39     fMap()
40 {
41 /// Standard & default constructor
42
43 }
44
45 //_____________________________________________________________________________
46 AliMpDataMap::~AliMpDataMap() 
47 {
48 /// Destructor 
49 }
50
51 //
52 // private methods
53 //
54
55 //_____________________________________________________________________________
56 void AliMpDataMap::Add(const TString& path, const TString& data)
57 {
58 /// Add map element
59
60   fMap.Add(new TObjString(path), new TObjString(data));
61 }  
62
63 //_____________________________________________________________________________
64 TString  AliMpDataMap::Get(const TString& path, Bool_t warn) const
65 {
66 /// Find the data string for given path;
67 /// give error and return empty string if not found 
68
69   TObject* object = fMap.GetValue(path.Data());
70
71   if ( ! object )  {
72     if ( warn ) {
73       AliWarningStream()
74         << path << " not found in the map." << endl;
75     }    
76     return "";
77   }    
78   
79   return ((TObjString*)object)->String();
80 }  
81