home *** CD-ROM | disk | FTP | other *** search
/ The AGA Experience 2 / agavol2.iso / software / utilities / demos / stormc-demo / examples / fplot / fclass.h < prev    next >
C/C++ Source or Header  |  1992-08-28  |  1KB  |  63 lines

  1.  
  2. // Class-Definitionen:
  3.  
  4. class Func
  5. {   static double Dummy;
  6.   public:
  7.     virtual double eval(double) = 0;
  8.     virtual void print(char*) = 0;
  9.     virtual ~Func();
  10.     virtual int isconst(double &val = Dummy);
  11. };
  12.  
  13. class KonstN: public Func
  14. {  double Konst;
  15.   public:
  16.    double eval(double)
  17.      { return Konst; }
  18.    int isconst(double &);
  19.    KonstN(double);
  20.    void print(char*);
  21. };
  22.  
  23. class VarN: public Func
  24. { public:
  25.     double eval(double x)
  26.       { return x; }
  27.     void print(char*);
  28. };
  29.  
  30. class ErrorN: public Func
  31. { public:
  32.     double eval(double)
  33.       { return 1; }
  34.     void print(char*);
  35. };
  36.  
  37. enum UnOps { Op_neg, Op_sqr, Op_sqrt, Op_sin, Op_cos, Op_exp, Op_ln};
  38.  
  39. enum BinOps { Op_add, Op_sub, Op_mult, Op_div, Op_pot };
  40.  
  41. class UnOpN: public Func
  42. {  UnOps oper;
  43.    Func *arg;
  44.   public:
  45.    double eval(double);
  46.    UnOpN(UnOps, Func*);
  47.    void print(char*);
  48.    ~UnOpN();
  49. };
  50.  
  51. class BinOpN: public Func
  52. {  BinOps oper;
  53.    Func *l, *r;
  54.   public:
  55.    double eval(double);
  56.    BinOpN(BinOps, Func*, Func*);
  57.    void print(char*);
  58.    ~BinOpN();
  59. };
  60.  
  61. Func *Parse(char*);
  62.  
  63.