source: branches/AddingGoogleTestEnvironment/mbase/MParameters.h@ 19779

Last change on this file since 19779 was 9268, checked in by tbretz, 16 years ago
*** empty log message ***
File size: 2.9 KB
Line 
1#ifndef MARS_MParameters
2#define MARS_MParameters
3
4#ifndef MARS_MParContainer
5#include "MParContainer.h"
6#endif
7
8class MParameterD : public MParContainer
9{
10private:
11 Double_t fVal;
12
13protected:
14 Int_t ReadEnv(const TEnv &env, TString prefix, Bool_t print);
15
16public:
17 MParameterD(const char *name=NULL, const char *title=NULL);
18
19 void SetVal(Double_t v) { fVal = v; }
20 Double_t GetVal() const { return fVal; }
21
22 void Print(Option_t *o="") const;
23
24 Double_t *GetPtr() { return &fVal; }
25
26 ClassDef(MParameterD, 1) // Container to hold a generalized parameters (double)
27};
28
29class MParameterDerr : public MParameterD
30{
31private:
32 Double_t fErr;
33
34 Int_t ReadEnv(const TEnv &env, TString prefix, Bool_t print);
35
36public:
37 MParameterDerr(const char *name=NULL, const char *title=NULL);
38
39 void SetVal(Double_t v) { MParameterD::SetVal(v); }
40 void SetVal(Double_t v, Double_t e) { SetVal(v); fErr = e; }
41 Double_t GetErr() const { return fErr; }
42
43 void Print(Option_t *o="") const;
44
45 ClassDef(MParameterDerr, 2) // Container to hold a generalized parameters (double) and its Error
46};
47
48class MParameterI : public MParContainer
49{
50private:
51 Int_t fVal;
52
53 Int_t ReadEnv(const TEnv &env, TString prefix, Bool_t print);
54
55public:
56 MParameterI(const char *name=NULL, const char *title=NULL);
57
58 void SetVal(Int_t v) { fVal = v; }
59 Int_t GetVal() const { return fVal; }
60
61 void Print(Option_t *o="") const;
62
63 Int_t *GetPtr() { return &fVal; }
64
65 ClassDef(MParameterI, 1) // Container to hold a generalized parameters (integer)
66};
67
68/*
69class MParameters : public MParContainer
70{
71private:
72 TObjArray fList;
73 TObjArray fNames;
74
75public:
76 MParameters(const char *name=NULL, const char *title=NULL)
77 {
78 fName = name ? name : "MParameters";
79 fTitle = title ? title : "Additional temporary parameters";
80
81 SetReadyToSave();
82 }
83
84 MParamaterI &AddInteger(const TString name, const TString title, Int_t val=0)
85 {
86 MParameterI &p = *new MParameterI(name, title);
87 p.SetValue(val);
88
89 fList.Add(&p);
90
91 TNamed &n = *new TNamed(name, title);
92 fNames.Add(&n);
93
94 return p;
95 }
96
97 MParameterD &AddDouble(const TString name, const TString title, Double_t val=0)
98 {
99 MParameterD &p = *new MParameterD(name, title);
100 p.SetValue(val);
101
102 fList.Add(&p);
103
104 TNamed &n = *new TNamed(name, title);
105 fNames.Add(&n);
106
107 return p;
108 }
109
110 const TObjArray &GetList()
111 {
112 fList.SetNames(&fNames);
113 return fList;
114 }
115
116 MParameterD *GetParameterD(const TString &name)
117 {
118 fList.SetNames(&fNames);
119 return (MParamaterD*)fList.FindObject(name);
120 }
121
122 MParameterI *GetParameterI(const TString &name)
123 {
124 fList.SetNames(&fNames);
125 return (MParameterI*)fList.FindObject(name);
126 }
127
128 ClassDef(MParameters, 1) // List to hold generalized parameters (MParameterD/I)
129 }
130 */
131#endif
Note: See TracBrowser for help on using the repository browser.