00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef _TREE
00022 #define _TREE
00023
00024 #include <stddef.h>
00025 #include "func.h"
00026
00027 union NumVar
00028 {
00029 int WhichVar;
00030 double Number;
00031 };
00032
00033 struct Node
00034 {
00035 Node *Parent;
00036 Node *Child_One;
00037 Node *Child_Two;
00038 func_type Type;
00039 NumVar Value;
00040 int Brackets;
00041 double CurrentValue;
00042 double (*evalfn)(double);
00043 };
00044
00045 class Parser;
00046
00047 class TTree
00048 {
00049 public:
00050 Node *Root;
00051
00052 TTree();
00053 ~TTree();
00054 void InitNode(Node *, func_type);
00055 void InitNode(Node *, func_type, NumVar, int brack=0);
00056 Node *AddParent(Node *);
00057 Node *AddChildOne(Node *);
00058 Node *AddChildTwo(Node *);
00059 Node *DeleteNode(Node *,Node *Blank=NULL,Node *Other=NULL);
00060 void Reset(int SetTo,Node *From=NULL);
00061 Node *Copy(Node *From,Node *To);
00062 void Delete(Node *From);
00063 Node *AddBelowOne(Node *, func_type, double Value=0);
00064 Node *AddBelowTwo(Node *, func_type, double Value=0);
00065
00066 };
00067
00068 #endif