C++ main module for gpm Package  1.0
MATH_ExpressionClassFactory.h
Go to the documentation of this file.
1 #ifndef MATH_ExpressionClassFactory_H
2 #define MATH_ExpressionClassFactory_H
3 
4 
5 #include "CORE_ClassFactory.h"
6 
7 
8 #include "MATH_UnaryOperator.h"
9 #include "MATH_BinaryOperator.h"
10 #include "MATH_FunctionNode.h"
11 
22 class MATH_ExpressionClassFactory : public virtual CORE_ClassFactory { // class
23 
24  SP_OBJECT(MATH_ExpressionClassFactory);
25 
26  // ATTRIBUTES
27 public:
28 
29  static const tFlag UNKNOWN_NODE;
30  static const tFlag BLOCK_MISMATCHED;
31  static const tFlag END_ARGUMENT;
32  static const tFlag EMPTY;
33  static const tFlag SPACE;
34 private:
35 
36 
37  // ASSOCIATIONS
38  SV::MATH_UnaryOperator mUOperators;
39  SV::MATH_BinaryOperator mBOperators;
40  SV::MATH_FunctionNode mFunctions;
41 
42 
43  // METHODS
44 
45 
46 protected:
47  // CONSTRUCTORS
51 
52 
53 
54 
55  // DESTRUCTORS
59  virtual ~MATH_ExpressionClassFactory(void);
60 
61 
62 
63 
64 
65 public:
66  // NEW
69  inline static SP::MATH_ExpressionClassFactory New() {
70  SP::MATH_ExpressionClassFactory p(new MATH_ExpressionClassFactory(),MATH_ExpressionClassFactory::Delete());
71  p->setThis(p);
72  p->initNodesLists();
73  return p;
74  };
75 
76  // SET
77 
80  inline void resetFunctionsList() {
81  mFunctions.clear();
82  }
85  inline void resetUnaryOperatorsList() {
86  mUOperators.clear();
87  }
90  inline void resetBinaryOperatorsList() {
91  mBOperators.clear();
92  }
93 
96  inline void addToFunctionsList(SP::MATH_FunctionNode fct) {
97  mFunctions.add(fct);
98  }
101  inline void addToUnaryOperatorsList(SP::MATH_UnaryOperator op) {
102  mUOperators.add(op);
103  }
106  inline void addToBinaryOperatorsList(SP::MATH_BinaryOperator op) {
107  mBOperators.add(op);
108  }
109  // GET
110 
111 
112  // OTHERS
115  virtual SP::CORE_Object NewInstance(const tString& name,
116  const SVC::CORE_Object& newParameters) const;
117 
118 
128  SP::MATH_ChildExpression NewInstance(const tString& formula,int& retCode) const;
129 
132  virtual void initNodesLists();
133 
134 private:
140  SP::MATH_ChildExpression NewNodeInstance(const tString& formula,int& retCode) const;
141 
142 
143 };
144 #endif
virtual ~MATH_ExpressionClassFactory(void)
destroy a MATH_ExpressionClassFactory
Definition: MATH_ExpressionClassFactory.cpp:146
void resetFunctionsList()
reset functions list
Definition: MATH_ExpressionClassFactory.h:80
static const tFlag END_ARGUMENT
Definition: MATH_ExpressionClassFactory.h:31
void addToBinaryOperatorsList(SP::MATH_BinaryOperator op)
add an binary operator to binary operators list
Definition: MATH_ExpressionClassFactory.h:106
static const tFlag UNKNOWN_NODE
Definition: MATH_ExpressionClassFactory.h:29
static const tFlag BLOCK_MISMATCHED
Definition: MATH_ExpressionClassFactory.h:30
this class describes a class factory to generate MATH_Expression classes. The nodes lists are initial...
Definition: MATH_ExpressionClassFactory.h:22
void resetBinaryOperatorsList()
reset binary operators list
Definition: MATH_ExpressionClassFactory.h:90
void resetUnaryOperatorsList()
reset unary operators list
Definition: MATH_ExpressionClassFactory.h:85
virtual SP::CORE_Object NewInstance(const tString &name, const SVC::CORE_Object &newParameters) const
create an instance of a class
Definition: MATH_ExpressionClassFactory.cpp:150
static const tFlag EMPTY
Definition: MATH_ExpressionClassFactory.h:32
DEFINE_SPTR(MATH_ExpressionClassFactory)
static SP::MATH_ExpressionClassFactory New()
create a class factory
Definition: MATH_ExpressionClassFactory.h:69
#define tString
Definition: types.h:36
static const tFlag SPACE
Definition: MATH_ExpressionClassFactory.h:33
void addToFunctionsList(SP::MATH_FunctionNode fct)
add a function node to functions list
Definition: MATH_ExpressionClassFactory.h:96
virtual void initNodesLists()
init the node lists
Definition: MATH_ExpressionClassFactory.cpp:81
this class describes a class factory to generate classes for User Interface Software ...
Definition: CORE_ClassFactory.h:18
MATH_ExpressionClassFactory()
build a MATH_ExpressionClassFactory
Definition: MATH_ExpressionClassFactory.cpp:78
class Free introduced for deleting a smart pointer
Definition: CORE_Object.h:106
#define tFlag
Definition: types.h:14
void addToUnaryOperatorsList(SP::MATH_UnaryOperator op)
add an unary operator to unary operators list
Definition: MATH_ExpressionClassFactory.h:101