]>
Commit | Line | Data |
---|---|---|
0145e89a | 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 | ||
18 | #include "AliMUONPainterEnv.h" | |
19 | ||
20 | #include <TEnv.h> | |
21 | #include <TSystem.h> | |
22 | ||
23 | ///\class AliMUONPainterEnv | |
24 | /// | |
25 | /// A resource file handling class. | |
26 | /// | |
27 | /// Used to get some things persistent between two sessions of the mchview | |
28 | /// program. | |
29 | /// | |
30 | ///\author Laurent Aphecetche, Subatech | |
31 | ||
32 | ///\cond CLASSIMP | |
33 | ClassImp(AliMUONPainterEnv) | |
34 | ///\endcond | |
35 | ||
36 | //_____________________________________________________________________________ | |
37 | AliMUONPainterEnv::AliMUONPainterEnv(const char* resourceFile) | |
38 | : fEnv(new TEnv(resourceFile)) | |
39 | { | |
40 | /// Ctor | |
41 | } | |
42 | ||
43 | //_____________________________________________________________________________ | |
44 | AliMUONPainterEnv::~AliMUONPainterEnv() | |
45 | { | |
46 | /// dtor | |
47 | } | |
48 | ||
49 | //_____________________________________________________________________________ | |
50 | const char* | |
51 | AliMUONPainterEnv::String(const char* resourceName, const char* defaultValue) | |
52 | { | |
53 | /// Retrieve the value associated with a given source, as a string | |
54 | ||
55 | return fEnv->GetValue(resourceName,defaultValue); | |
56 | } | |
57 | ||
58 | //_____________________________________________________________________________ | |
59 | Int_t | |
60 | AliMUONPainterEnv::Integer(const char* resourceName, Int_t defaultValue) | |
61 | { | |
62 | /// Retrieve the value associated with a given source, as an integer | |
63 | ||
64 | return fEnv->GetValue(resourceName,defaultValue); | |
65 | } | |
66 | ||
67 | //_____________________________________________________________________________ | |
68 | Double_t | |
69 | AliMUONPainterEnv::Double(const char* resourceName, Double_t defaultValue) | |
70 | { | |
71 | /// Retrieve the value associated with a given source, as a double | |
72 | ||
73 | return fEnv->GetValue(resourceName,defaultValue); | |
74 | } | |
75 | ||
76 | //_____________________________________________________________________________ | |
77 | void | |
78 | AliMUONPainterEnv::Save() | |
79 | { | |
80 | /// Save the resource file | |
81 | fEnv->WriteFile(gSystem->ExpandPathName(Form("$HOME/%s",fEnv->GetRcName()))); | |
82 | } | |
83 | ||
84 | //_____________________________________________________________________________ | |
85 | void | |
86 | AliMUONPainterEnv::Set(const char* resourceName, Int_t value) | |
87 | { | |
88 | /// Set an integer resource | |
89 | ||
90 | fEnv->SetValue(resourceName,Form("%d",value)); | |
91 | } | |
92 | ||
93 | //_____________________________________________________________________________ | |
94 | void | |
95 | AliMUONPainterEnv::Set(const char* resourceName, const char* value) | |
96 | { | |
97 | /// Set a string resource | |
98 | ||
99 | fEnv->SetValue(resourceName,value); | |
100 | } | |
101 | ||
102 | //_____________________________________________________________________________ | |
103 | void | |
104 | AliMUONPainterEnv::Set(const char* resourceName, Double_t value) | |
105 | { | |
106 | /// Set a double resource | |
107 | ||
108 | fEnv->SetValue(resourceName,Form("%g",value)); | |
109 | } |