1 /* 2 GUIDO Library 3 Copyright (C) 2006-2008 Grame 4 5 This library is free software; you can redistribute it and/or 6 modify it under the terms of the GNU Lesser General Public 7 License as published by the Free Software Foundation; either 8 version 2.1 of the License, or (at your option) any later version. 9 10 This library is distributed in the hope that it will be useful, 11 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 Lesser General Public License for more details. 14 15 You should have received a copy of the GNU Lesser General Public 16 License along with this library; if not, write to the Free Software 17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 19 Grame Research Laboratory, 9 rue du Garet, 69001 Lyon - France 20 research@grame.fr 21 22 */ 23 24 #ifndef __guidoEval__ 25 #define __guidoEval__ 26 27 #include "export.h" 28 #include "guidoExprTypes.h" 29 #include "visitor.h" 30 31 namespace guidolang 32 { 33 34 /*! \brief base class for the evaluation functors */ 35 class export guidoEval : 36 public guido::visitor<Sguidoexpression>, 37 public guido::visitor<SguidoNamedExpr>, 38 public guido::visitor<SguidoGroupedExpr>, 39 public guido::visitor<SguidoAbstractExpr>, 40 public guido::visitor<SguidoApplyExpr>, 41 public guido::visitor<SguidoTranspExpr>, 42 public guido::visitor<SguidoStretchExpr>, 43 public guido::visitor<SguidoSeqExpr>, 44 public guido::visitor<SguidoParExpr>, 45 public guido::visitor<SguidoHeadExpr>, 46 public guido::visitor<SguidoTailExpr>, 47 public guido::visitor<SguidoTopExpr>, 48 public guido::visitor<SguidoBottomExpr>, 49 public guido::visitor<SguidoIdentExpr>, 50 public guido::visitor<SguidoScoreExpr> 51 { 52 private: 53 Sguidovalue fValue; 54 SguidoEnv fEnv; 55 56 public: guidoEval()57 guidoEval() {} ~guidoEval()58 virtual ~guidoEval() {} 59 60 Sguidovalue eval(Sguidoexpression, SguidoEnv); 61 62 protected: 63 virtual void evalBinary( Sguidoexpression e, Sguidovalue& v1, Sguidovalue& v2); 64 65 virtual void visitStart( Sguidoexpression&); 66 virtual void visitStart( SguidoNamedExpr&); 67 virtual void visitStart( SguidoGroupedExpr&); 68 virtual void visitStart( SguidoAbstractExpr&); 69 virtual void visitStart( SguidoApplyExpr&); 70 virtual void visitStart( SguidoTranspExpr&); 71 virtual void visitStart( SguidoStretchExpr&); 72 virtual void visitStart( SguidoSeqExpr&); 73 virtual void visitStart( SguidoParExpr&); 74 virtual void visitStart( SguidoHeadExpr&); 75 virtual void visitStart( SguidoTailExpr&); 76 virtual void visitStart( SguidoTopExpr&); 77 virtual void visitStart( SguidoBottomExpr&); 78 virtual void visitStart( SguidoIdentExpr&); 79 virtual void visitStart( SguidoScoreExpr&); 80 }; 81 82 } // namespace 83 84 #endif 85