00001 #ifndef gridripper_math_expr_FnCollection_h 00002 #define gridripper_math_expr_FnCollection_h 00003 00004 #include "Evaluator.h" 00005 #include "StkConst.h" 00006 #include "StkVar.h" 00007 00008 namespace gridripper { namespace math { namespace expr { 00009 00010 using namespace std; 00011 00018 class FnCollection 00019 { 00020 private: 00021 string xname; 00022 00023 tvector<StkOp*> stkops; 00024 00025 tvector<Evaluator::Function*> varlist; 00026 00027 public: 00034 FnCollection(const string& xname, const tvector<StkOp*>& stkops, 00035 const tvector<Evaluator::Function*>& varlist); 00036 00037 ~FnCollection(); 00038 00045 GReal_t eval(const string& expr); 00046 00052 void addConst(const string& constname, const string& expr) 00053 throw(IllegalArgumentException&); 00054 00060 StkVar* getStkVar(const string& varname) const; 00061 00067 void addConstsAndVars(const string& defs) throw(IllegalArgumentException&); 00068 00075 Evaluator::Function* addVar(const string& varname, const string& expr) 00076 throw(IllegalArgumentException&); 00077 00084 Evaluator::Function* getVar(const string& varname) const; 00085 00094 Evaluator::Function* findVar(const string& name_or_def); 00095 }; 00096 00097 } } } /* namespace gridripper::math::expr */ 00098 00099 #endif /* gridripper_math_expr_FnCollection_h */