/////////////////////////////////////////////////////////////////////// // Math Type Library // $Id: visitor.h,v 1.4 2002/04/29 19:34:30 cparpart Exp $ // (This file contains the abstract interface to the expression tree visitor) // // Copyright (c) 2002 by Christian Parpart // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Library General Public // License as published by the Free Software Foundation; either // version 2 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Library General Public License for more details. // // You should have received a copy of the GNU Library General Public License // along with this library; see the file COPYING.LIB. If not, write to // the Free Software Foundation, Inc., 59 Temple Place - Suite 330, // Boston, MA 02111-1307, USA. /////////////////////////////////////////////////////////////////////// #ifndef libmath_visitor_h #define libmath_visitor_h namespace math { template class TNumberNode; // numbers template class TSymbolNode; // symbols ("e", "pi", "t", ...") template class TParamNode; // usually the symbol "x" template class TPlusNode; // operations 1st degree template class TNegNode; template class TMulNode; // operations 2nd degree template class TDivNode; template class TPowNode; // operations 3rd degree template class TSqrtNode; // build-in functions template class TSinNode; template class TCosNode; template class TTanNode; template class TCoTanNode; template class TLnNode; template class TFuncNode; // user defined functions template class TIfNode; // extended functions template class TEquNode; // equations template class TUnEquNode; template class TGreaterNode; template class TLessNode; template class TGreaterEquNode; template class TLessEquNode; /** * TNodeVisitor<> is the abstract base class for the expression tree. * It is used to extend the tree by additional functionalities such as * derivation, simplifying, or what ever you'd like to add. */ template class TNodeVisitor { public: virtual ~TNodeVisitor() {}; virtual void visit(TNumberNode *) = 0; virtual void visit(TSymbolNode *) = 0; virtual void visit(TParamNode *) = 0; virtual void visit(TPlusNode *) = 0; virtual void visit(TNegNode *) = 0; virtual void visit(TMulNode *) = 0; virtual void visit(TDivNode *) = 0; virtual void visit(TPowNode *) = 0; virtual void visit(TSqrtNode *) = 0; virtual void visit(TSinNode *) = 0; virtual void visit(TCosNode *) = 0; virtual void visit(TTanNode *) = 0; virtual void visit(TLnNode *) = 0; virtual void visit(TFuncNode *) = 0; virtual void visit(TIfNode *) = 0; virtual void visit(TEquNode *) = 0; virtual void visit(TUnEquNode *) = 0; virtual void visit(TGreaterNode *) = 0; virtual void visit(TLessNode *) = 0; virtual void visit(TGreaterEquNode *) = 0; virtual void visit(TLessEquNode *) = 0; }; } // namespace math #endif