1 #ifndef ALIEXPRESSION_H
2 #define ALIEXPRESSION_H
4 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
5 * See cxx source for full Copyright notice */
9 ///////////////////////////////////////////////////////////////////////////////
11 // AliExpression Class // //
13 ///////////////////////////////////////////////////////////////////////////////
19 // These are the valid operators types.
21 enum { kOpAND=1, // AND '&'
23 kOpNOT }; // Unary negation '!'
25 class AliExpression : public TObject {
28 AliExpression() : fVname(0), fArg1(0), fArg2(0), fOperator(0) {}
29 AliExpression( TString exp );
30 virtual ~AliExpression();
31 AliExpression( const AliExpression& exp ) : TObject( exp ),
33 fArg1(exp.fArg1), fArg2(exp.fArg2),
34 fOperator(exp.fOperator) {}
35 AliExpression& operator=(const AliExpression& exp);
37 virtual Bool_t Value( const TObjArray & vars );
38 virtual TString Unparse() const;
40 TString fVname; // Variable name
43 AliExpression* fArg1; // left argument
44 AliExpression* fArg2; // right argument
45 Int_t fOperator; // operator
47 AliExpression( int op, AliExpression* a );
48 AliExpression( int op, AliExpression* a, AliExpression* b );
50 TObjArray* Tokenize( TString str ) const;
51 static AliExpression* Element( TObjArray &st, Int_t &i );
52 static AliExpression* Primary( TObjArray &st, Int_t &i );
53 static AliExpression* Expression( TObjArray &st, Int_t &i );
55 ClassDef( AliExpression, 2 ) // Class to evaluate an expression
61 ///////////////////////////////////////////////////////////////////////////
63 class AliVariableExpression: public AliExpression {
65 AliVariableExpression( TString a ): AliExpression() { fVname = a; };
66 ~AliVariableExpression() {}
67 virtual Bool_t Value( const TObjArray& pgm );
68 virtual TString Unparse() const { return fVname; }
70 ClassDef( AliVariableExpression, 2 ) // Class to define a variable expression