00001 #ifndef EXPRFACTORY_H 00002 #define EXPRFACTORY_H 00003 00004 #include "SundanceDefs.h" 00005 00006 #include "XMLObject.h" 00007 #include "Expr.h" 00008 #include "ExprHashtable.h" 00009 00010 00011 namespace Sundance 00012 { 00013 00014 using namespace TSF; 00015 using std::string; 00016 00017 using std::ostream; 00018 00019 00020 /** 00021 * \ingroup Interface 00022 * ExprFactory contains static methods that construct Sundance 00023 * Expr objects given an XML description of the Expr. 00024 * 00025 */ 00026 class ExprFactory 00027 { 00028 public: 00029 static Expr getExprByName(const string& name); 00030 00031 static Expr createExpr(const XMLObject& xml); 00032 00033 static Expr processMath(const XMLObject& xml); 00034 static Expr processMathDef(const XMLObject& xml); 00035 00036 static void getUnksAndVars(Expr& unks, Expr& vars); 00037 private: 00038 00039 00040 static Expr processExpr(const XMLObject& xml); 00041 static Expr processAssignment(const XMLObject& xml); 00042 static Expr processSum(const XMLObject& xml); 00043 static Expr processProduct(const XMLObject& xml); 00044 static Expr processReciprocal(const XMLObject& xml); 00045 static Expr processList(const XMLObject& xml); 00046 static Expr processUnaryMinus(const XMLObject& xml); 00047 static Expr processFunction(const XMLObject& xml); 00048 static Expr processConstant(const XMLObject& xml); 00049 static Expr processCoord(const XMLObject& xml); 00050 static Expr processUnknownExpr(const XMLObject& xml); 00051 static Expr processVariationalExpr(const XMLObject& xml); 00052 static Expr processDiscreteExpr(const XMLObject& xml); 00053 static Expr processDerivative(const XMLObject& xml); 00054 00055 static void checkTag(const XMLObject& xml, const string& tag); 00056 00057 static ExprHashtable exprs_; 00058 }; 00059 00060 00061 } 00062 #endif 00063