Changeset 4063 in Sophya for trunk/SophyaLib/SysTools/cexpre.h
- Timestamp:
- Apr 27, 2012, 12:34:31 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaLib/SysTools/cexpre.h
r3586 r4063 9 9 #include <iostream> 10 10 #include <string> 11 #include <vector> 12 #include <map> 11 13 #include "pexceptions.h" 12 14 … … 46 48 }; 47 49 50 48 51 /*! 49 52 \ingroup SysTools … … 53 56 { ex.Print(s); return(s); } 54 57 58 /*! 59 \ingroup SysTools 60 \brief Interface class used by the CExpressionEvaluator class to represent a list of variables 61 or named values accessible trough a pointer. 62 63 Inherited class should define the \b GetVarPointer() method, and can optionaly redefine 64 the \b Update() method. 65 \sa CExpressionEvaluator 66 */ 67 class CE_VarListInterface { 68 public: 69 //! To be called to update values corresponding to the pointers. Default implementation does nothing. 70 virtual void Update() { return; } 71 //! Return a pointer to a double containing the value associated with \t name. 72 virtual double* GetVarPointer(std::string const& name) = 0; 73 }; 74 75 55 76 class CE_BinExp; 56 77 class CE_FuncExp; … … 58 79 class CExpressionEvaluator : public CExprBase { 59 80 public: 60 CExpressionEvaluator(string const & sex); 81 CExpressionEvaluator(const char* sexp, CE_VarListInterface* pvlist=NULL); 82 CExpressionEvaluator(string const & sex, CE_VarListInterface* pvlist=NULL); 83 61 84 virtual ~CExpressionEvaluator(); 62 85 //! Evaluate the expression and returns the corresponding value. … … 68 91 69 92 protected: 93 //! Parse variable names or constants and return CE_NumberExp object. 94 CExprBase* VarNameOrNumber(string const & s); 70 95 //! Does the parsing and builds an CExprBase object. 71 96 CExprBase* ParseString(int extype, string fname, string const & sex, … … 73 98 74 99 CExprBase * _exp; 100 CE_VarListInterface* _varlist; 75 101 }; 76 102
Note:
See TracChangeset
for help on using the changeset viewer.