source: trunk/MagicSoft/Mars/mdata/MDataPhrase.h@ 8408

Last change on this file since 8408 was 8315, checked in by tbretz, 18 years ago
*** empty log message ***
File size: 1.6 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
19
20class MDataPhrase : public MData
21{
22private:
23 TFormula *fFormula; // TFormula (its a pointer to be able to have no expression)
24 TObjArray fMembers; // List of arguments
25
26 MArrayD fStorage; //! Temporary storage used in GetValue (only!)
27
28 Int_t CheckForVariable(const TString &phrase, Int_t idx);
29 Int_t Substitute(TString &phrase, const TString &expr, Int_t idx) const;
30 TString Parse(TString phrase);
31
32public:
33 MDataPhrase(const char *rule=0, const char *name=0, const char *title=0);
34 MDataPhrase(MDataPhrase &ts);
35 ~MDataPhrase();
36
37 // TObject
38 void Clear(Option_t *o="");
39
40 // MParContainer
41 Bool_t IsReadyToSave() const;
42 void SetVariables(const TArrayD &arr);
43 Int_t ReadEnv(const TEnv &env, TString prefix, Bool_t print=kFALSE);
44
45 // MData
46 Bool_t IsValid() const;
47 Bool_t HasValidRule() const { return fFormula ? kTRUE : kFALSE; }
48 Double_t GetValue() const;
49 TString GetRule() const;
50 Bool_t PreProcess(const MParList *plist);
51 // void Print(Option_t *opt = "") const;
52 // TString GetDataMember() const;
53
54 // MDataPhrase
55 Bool_t GetBool() const { return TMath::Nint(GetValue())!=0; }
56 Bool_t SetRule(const TString &phrase);
57
58 ClassDef(MDataPhrase, 1) // MDataPhrase is basically a mapper for TFormula supporting Mars features
59};
60
61#endif
Note: See TracBrowser for help on using the repository browser.