00001 /* $Id: OSExpressionTree.h 4996 2015-04-14 20:38:45Z Gassmann $ */ 00015 #ifndef EXPRESSIONTREE_H 00016 #define EXPRESSIONTREE_H 00017 00018 #include "OSnLNode.h" 00019 #include <vector> 00020 #include <map> 00021 00022 class ExprNode; 00023 class OSnLNode; 00024 class OSnLMNode; 00025 00037 class OSExpressionTree 00038 { 00039 public: 00043 OSExpressionTree(); 00044 00048 ~OSExpressionTree(); 00049 00055 std::map<int, int> *mapVarIdx; 00056 00065 //virtual std::map<int, int> *getVariableIndicesMap(); 00066 00070 bool m_bIndexMapGenerated; 00071 00076 bool bADMustReTape; 00077 00081 bool bDestroyNlNodes; 00082 00086 bool IsEqual(OSExpressionTree *that); 00087 };//end OSExpressionTree 00088 00089 00099 class ScalarExpressionTree : public OSExpressionTree 00100 { 00101 public: 00102 00106 OSnLNode *m_treeRoot; 00107 00111 ScalarExpressionTree(); 00112 00116 ~ScalarExpressionTree(); 00117 00121 bool IsEqual(ScalarExpressionTree *that); 00122 00131 std::vector<ExprNode*> getPrefixFromExpressionTree(); 00132 00141 std::vector<ExprNode*> getPostfixFromExpressionTree(); 00142 00151 std::map<int, int> *getVariableIndicesMap(); 00152 00153 #if 0 00154 00157 bool m_bIndexMapGenerated; 00158 00163 bool bADMustReTape; 00164 00168 bool bDestroyNlNodes; 00169 #endif 00170 00182 double calculateFunction( double *x, bool new_x); 00183 00189 //bool deepCopyFrom(ScalarExpressionTree *that); 00190 00191 private: 00195 double m_dTreeRootValue; 00196 };//end ScalarExpressionTree 00197 00198 00208 class MatrixExpressionTree : public OSExpressionTree 00209 { 00210 public: 00214 OSnLMNode *m_treeRoot; 00215 00219 MatrixExpressionTree(); 00220 00224 ~MatrixExpressionTree(); 00225 00229 bool IsEqual(MatrixExpressionTree *that); 00230 00239 std::vector<ExprNode*> getPrefixFromExpressionTree(); 00240 00249 std::vector<ExprNode*> getPostfixFromExpressionTree(); 00250 00259 //std::map<int, int> *getVariableIndicesMap(); 00260 00261 #if 0 00262 00265 bool m_bIndexMapGenerated; 00266 00271 bool bADMustReTape; 00272 00276 bool bDestroyNlNodes; 00277 00289 double calculateFunction( double *x, bool new_x); 00290 #endif 00291 00292 private: 00293 00297 //double m_dTreeRootValue; 00298 };//end MatrixExpressionTree 00299 00300 #endif 00301
1.6.1