]>
Commit | Line | Data |
---|---|---|
a5a091ce | 1 | #ifndef ALIEXPRESSION_H |
2 | #define ALIEXPRESSION_H | |
3 | ||
4 | /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
5 | * See cxx source for full Copyright notice */ | |
6 | ||
7 | /* $Id$ */ | |
8 | ||
9 | /////////////////////////////////////////////////////////////////////////////// | |
10 | // // | |
11 | // AliExpression Class // // | |
12 | // // | |
13 | /////////////////////////////////////////////////////////////////////////////// | |
14 | ||
15 | #include <TObject.h> | |
16 | class TString; | |
17 | class TObjArray; | |
18 | ||
19 | // These are the valid operators types. | |
20 | ||
21 | enum { kOpAND, // AND '&' | |
22 | kOpOR, // OR '|' | |
23 | kOpNOT }; // Unary negation '!' | |
24 | ||
25 | class AliExpression : public TObject { | |
26 | ||
27 | public: | |
28 | AliExpression() : fArg1(0), fArg2(0), fOperator(0) {} | |
29 | AliExpression( TString exp ); | |
30 | virtual ~AliExpression(); | |
31 | AliExpression( const AliExpression& exp ) : TObject( exp ), | |
32 | fArg1(exp.fArg1), fArg2(exp.fArg2), fOperator(exp.fOperator) {} | |
33 | AliExpression& operator=(const AliExpression& exp); | |
34 | ||
35 | virtual Bool_t Value( TObjArray & vars ); | |
36 | virtual TString Unparse() const; | |
37 | ||
38 | private: | |
39 | AliExpression* fArg1; // left argument | |
40 | AliExpression* fArg2; // right argument | |
41 | Int_t fOperator; // operator | |
42 | ||
43 | AliExpression( int op, AliExpression* a ); | |
44 | AliExpression( int op, AliExpression* a, AliExpression* b ); | |
45 | ||
46 | TObjArray* Tokenize( TString str ) const; | |
47 | static AliExpression* Element( TObjArray &st, Int_t &i ); | |
48 | static AliExpression* Primary( TObjArray &st, Int_t &i ); | |
49 | static AliExpression* Expression( TObjArray &st, Int_t &i ); | |
50 | ||
51 | ClassDef( AliExpression, 1 ) // Class to evaluate an expression | |
52 | }; | |
53 | ||
54 | ||
55 | ||
56 | ||
57 | /////////////////////////////////////////////////////////////////////////// | |
58 | ||
59 | class AliVariableExpression: public AliExpression { | |
60 | public: | |
61 | AliVariableExpression( TString a ): AliExpression(), fVname(a) {}; | |
62 | ~AliVariableExpression() {} | |
63 | virtual Bool_t Value( TObjArray& pgm ); | |
64 | virtual TString Unparse() const { return fVname; } | |
65 | ||
66 | private: | |
67 | TString fVname; // Variable name | |
68 | ||
69 | ClassDef( AliVariableExpression, 1 ) // Class to define a variable expression | |
70 | }; | |
71 | ||
72 | #endif |