]> git.uio.no Git - u/mrichter/AliRoot.git/blob - STEER/AliExpression.h
increased classdef
[u/mrichter/AliRoot.git] / STEER / AliExpression.h
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=1,   // AND '&'
22        kOpOR,      // OR '|'
23        kOpNOT };   // Unary negation '!'
24
25 class AliExpression : public TObject {
26
27 public:
28                            AliExpression() : fVname(0), fArg1(0), fArg2(0), fOperator(0)  {}
29                            AliExpression( TString exp );
30                virtual    ~AliExpression();
31                            AliExpression( const AliExpression& exp ) : TObject( exp ),
32                                           fVname(exp.fVname),
33                                           fArg1(exp.fArg1), fArg2(exp.fArg2),
34                                           fOperator(exp.fOperator)  {}
35          AliExpression&    operator=(const AliExpression& exp);
36
37         virtual Bool_t     Value( const TObjArray & vars );
38        virtual TString     Unparse() const;
39
40                 TString    fVname;   // Variable name
41
42 private:
43          AliExpression*    fArg1;         // left argument
44          AliExpression*    fArg2;         // right argument
45                  Int_t     fOperator;     // operator
46
47                            AliExpression( int op, AliExpression* a );
48                            AliExpression( int op, AliExpression* a, AliExpression* b );
49
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 );
54
55    ClassDef( AliExpression, 2 )  // Class to evaluate an expression
56 };
57
58
59
60
61 ///////////////////////////////////////////////////////////////////////////
62
63 class AliVariableExpression: public AliExpression {
64 public:
65                      AliVariableExpression( TString a ): AliExpression() { fVname = a; };
66                     ~AliVariableExpression() {}
67    virtual Bool_t    Value( const TObjArray& pgm );
68   virtual TString    Unparse() const { return fVname; }
69
70    ClassDef( AliVariableExpression, 2 )  // Class to define a variable expression
71 };
72
73 #endif