Math Type Library (libmath++) 0.0.3
visitor.h
1
2// Math Type Library
3// $Id: visitor.h,v 1.4 2002/04/29 19:34:30 cparpart Exp $
4// (This file contains the abstract interface to the expression tree visitor)
5//
6// Copyright (c) 2002 by Christian Parpart <cparpart@surakware.net>
7//
8// This library is free software; you can redistribute it and/or
9// modify it under the terms of the GNU Library General Public
10// License as published by the Free Software Foundation; either
11// version 2 of the License, or (at your option) any later version.
12//
13// This library is distributed in the hope that it will be useful,
14// but WITHOUT ANY WARRANTY; without even the implied warranty of
15// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16// Library General Public License for more details.
17//
18// You should have received a copy of the GNU Library General Public License
19// along with this library; see the file COPYING.LIB. If not, write to
20// the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
21// Boston, MA 02111-1307, USA.
23#ifndef libmath_visitor_h
24#define libmath_visitor_h
25
26namespace math {
27
28template<class> class TNumberNode; // numbers
29template<class> class TSymbolNode; // symbols ("e", "pi", "t", ...")
30template<class> class TParamNode; // usually the symbol "x"
31
32template<class> class TPlusNode; // operations 1st degree
33template<class> class TNegNode;
34
35template<class> class TMulNode; // operations 2nd degree
36template<class> class TDivNode;
37
38template<class> class TPowNode; // operations 3rd degree
39
40template<class> class TSqrtNode; // build-in functions
41template<class> class TSinNode;
42template<class> class TCosNode;
43template<class> class TTanNode;
44template<class> class TCoTanNode;
45template<class> class TLnNode;
46
47template<class> class TFuncNode; // user defined functions
48
49template<class> class TIfNode; // extended functions
50
51template<class> class TEquNode; // equations
52template<class> class TUnEquNode;
53template<class> class TGreaterNode;
54template<class> class TLessNode;
55template<class> class TGreaterEquNode;
56template<class> class TLessEquNode;
57
63template<typename T>
65public:
66 virtual ~TNodeVisitor() {};
67
68 virtual void visit(TNumberNode<T> *) = 0;
69 virtual void visit(TSymbolNode<T> *) = 0;
70 virtual void visit(TParamNode<T> *) = 0;
71
72 virtual void visit(TPlusNode<T> *) = 0;
73 virtual void visit(TNegNode<T> *) = 0;
74
75 virtual void visit(TMulNode<T> *) = 0;
76 virtual void visit(TDivNode<T> *) = 0;
77
78 virtual void visit(TPowNode<T> *) = 0;
79 virtual void visit(TSqrtNode<T> *) = 0;
80
81 virtual void visit(TSinNode<T> *) = 0;
82 virtual void visit(TCosNode<T> *) = 0;
83 virtual void visit(TTanNode<T> *) = 0;
84 virtual void visit(TLnNode<T> *) = 0;
85
86 virtual void visit(TFuncNode<T> *) = 0;
87 virtual void visit(TIfNode<T> *) = 0;
88
89 virtual void visit(TEquNode<T> *) = 0;
90 virtual void visit(TUnEquNode<T> *) = 0;
91 virtual void visit(TGreaterNode<T> *) = 0;
92 virtual void visit(TLessNode<T> *) = 0;
93 virtual void visit(TGreaterEquNode<T> *) = 0;
94 virtual void visit(TLessEquNode<T> *) = 0;
95};
96
97} // namespace math
98
99#endif