source: trunk/Mars/mdata/MDataPhrase.h@ 19901

Last change on this file since 19901 was 19760, checked in by tbretz, 5 years ago
They are added to the ListOfCleanups. This is implemented as a THashTable. According to the root documentation, it is required to rehash the table whenever the name of an object in the table changes. This is now guranteed if name change happens via SetName
File size: 1.9 KB
Line 
1#ifndef MARS_MDataPhrase
2#define MARS_MDataPhrase
3
4#ifndef ROOT_TObjArray
5#include <TObjArray.h>
6#endif
7
8#ifndef MARS_MData
9#include "MData.h"
10#endif
11
12#ifndef MARS_MArrayD
13#include "MArrayD.h"
14#endif
15
16class TFormula;
17class MParList;
18
19class MDataPhrase : public MData
20{
21private:
22 TFormula *fFormula; // TFormula (its a pointer to be able to have no expression)
23 TObjArray fMembers; // List of arguments
24
25 MArrayD fStorage; //! Temporary storage used in GetValue (only!)
26
27 Int_t CheckForVariable(const TString &phrase, Int_t idx);
28 Int_t Substitute(TString &phrase, const TString &expr, Int_t idx) const;
29 TString Parse(TString phrase);
30
31public:
32 MDataPhrase(const char *rule=0, const char *name=0, const char *title=0);
33 MDataPhrase(MDataPhrase &ts);
34 ~MDataPhrase();
35
36 // TObject
37 void Clear(Option_t *o="");
38 void RecursiveRemove(TObject *obj);
39 void SetName(const char *name);
40
41 // MParContainer
42 Bool_t IsReadyToSave() const;
43 void SetVariables(const TArrayD &arr);
44 Int_t ReadEnv(const TEnv &env, TString prefix, Bool_t print=kFALSE);
45
46 // MData
47 Bool_t IsValid() const;
48 Bool_t HasValidRule() const { return fFormula ? kTRUE : kFALSE; }
49 Double_t GetValue() const { return Eval((Double_t*)NULL); }
50 Double_t Eval(const Double_t *x) const;
51 Double_t Eval(Double_t x, Double_t y=0, Double_t z=0, Double_t t=0) const
52 {
53 const Double_t xx[4] = { x, y, z, t };
54 return Eval(xx);
55 }
56 TString GetRule() const;
57 TString GetRuleRaw() const;
58 Bool_t PreProcess(const MParList *plist);
59 // void Print(Option_t *opt = "") const;
60 // TString GetDataMember() const;
61
62 // MDataPhrase
63 Bool_t GetBool() const;
64 Bool_t SetRule(const TString &phrase);
65
66 ClassDef(MDataPhrase, 1) // MDataPhrase is basically a mapper for TFormula supporting Mars features
67};
68
69#endif
Note: See TracBrowser for help on using the repository browser.