00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047 #ifndef _FUNC_H
00048 #define _FUNC_H
00049
00050 #include "muParser.h"
00056 static double *_addVar(const char *name, void *data);
00057
00058 class Func
00059 {
00060 public:
00061 static const int VARMAX;
00062 Func();
00063 Func(const Func& rhs);
00064 ~Func();
00065 void setExpr(string expr);
00066 string getExpr() const;
00067
00068
00069
00070
00071 vector<string> getVars() const;
00072 void setVarValues(vector< string > vars, vector < double > vals);
00073
00074
00075
00076 void setVar(string name, double value);
00077 double getVar(string name) const;
00078
00079
00080 double getValue() const;
00081
00082
00083 void setMode(unsigned int mode);
00084 unsigned int getMode() const;
00085
00086 void setX(double value);
00087 double getX() const;
00088
00089 void setY(double value);
00090 double getY() const;
00091
00092 void setZ(double value);
00093 double getZ() const;
00094
00095 void setXY(double x, double y);
00096 void setXYZ(double x, double y, double z);
00097
00098 double getDerivative() const;
00099
00100 Func& operator=(const Func rhs);
00101
00102 void process(const Eref& e, ProcPtr p);
00103 void reinit(const Eref& e, ProcPtr p);
00104
00105 static const Cinfo * initCinfo();
00106
00107 protected:
00108 friend double * _addVar(const char * name, void *data);
00109 vector< double *> _varbuf;
00110 mu::Parser _parser;
00111 double *_x, *_y, *_z;
00112 unsigned int _mode;
00113 mutable bool _valid;
00114 void _clearBuffer();
00115 void _showError(mu::Parser::exception_type &e) const;
00116 };
00117 #endif
00118
00119
00120
00121