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, // AND '&'
23 kOpNOT }; // Unary negation '!'
25 class AliExpression : public TObject {
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);
35 virtual Bool_t Value( TObjArray & vars );
36 virtual TString Unparse() const;
39 AliExpression* fArg1; // left argument
40 AliExpression* fArg2; // right argument
41 Int_t fOperator; // operator
43 AliExpression( int op, AliExpression* a );
44 AliExpression( int op, AliExpression* a, AliExpression* b );
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 );
51 ClassDef( AliExpression, 1 ) // Class to evaluate an expression
57 ///////////////////////////////////////////////////////////////////////////
59 class AliVariableExpression: public AliExpression {
61 AliVariableExpression( TString a ): AliExpression(), fVname(a) {};
62 ~AliVariableExpression() {}
63 virtual Bool_t Value( TObjArray& pgm );
64 virtual TString Unparse() const { return fVname; }
67 TString fVname; // Variable name
69 ClassDef( AliVariableExpression, 1 ) // Class to define a variable expression