C++ main module for gpm Package  1.0
MATH_ChildExpression.h
Go to the documentation of this file.
1 #ifndef MATH_ChildExpression_H
2 #define MATH_ChildExpression_H
3 
4 #include "MATH_Expression.h"
5 
6 class MATH_Operator;
7 
19 
22 
24  SP_OBJECT(MATH_ChildExpression);
25  // ATTRIBUTES
26 
27 
28  private:
29  int mArgumentIndex;
30  WP::MATH_ParentExpression mParent;
31 
32  protected:
33  // METHODS
34 
35  // CONSTRUCTORS
36 
40 
41 
42 
43  // DESTRUCTORS
44 
45 
48  virtual ~MATH_ChildExpression(void);
49 
50 
51  // SET methods
52 public:
57  void setParent(SP::MATH_ParentExpression parent,
58  const int& argIndex);
59 
62  void resetParent();
63  // GET methods
64 public:
68  virtual const MATH_RootExpression* getRootNode() const;
69 
74  inline SP::MATH_ParentExpression getParent(int& index) {
75  SP::MATH_ParentExpression parent=mParent.lock();
76  index=mArgumentIndex;
77  return parent;
78  }
83  inline SPC::MATH_ParentExpression getParent(int& index) const {
84  SPC::MATH_ParentExpression parent=mParent.lock();
85  index=mArgumentIndex;
86  return parent;
87  }
91  inline SP::MATH_ParentExpression getParent() {
92  int index;
93  return getParent(index);
94  }
98  inline SPC::MATH_ParentExpression getParent() const {
99  int index;
100  return getParent(index);
101  }
102 
103  public:
104  // OTHERS methods
105 
114  MATH_Environment& symbols,tString& expr)=0;
115 
116 
117 };
118 
119 #endif
SP::MATH_ParentExpression getParent()
get the parent
Definition: MATH_ChildExpression.h:91
DEFINE_SPTR(MATH_ParentExpression)
This class is the base class of a math expression.
Definition: MATH_Expression.h:24
This class decribes an operator with a name.
Definition: MATH_Operator.h:15
virtual ~MATH_ChildExpression(void)
destroy
Definition: MATH_ChildExpression.cpp:12
SPC::MATH_ParentExpression getParent() const
get the parent
Definition: MATH_ChildExpression.h:98
MATH_ChildExpression(void)
create
Definition: MATH_ChildExpression.cpp:8
void resetParent()
reset the parent of the child
Definition: MATH_ChildExpression.cpp:18
void setParent(SP::MATH_ParentExpression parent, const int &argIndex)
set the parent
Definition: MATH_ChildExpression.cpp:42
This class is a root expression The MATH_RootExpression::newClassFactoryInstance() creates the class ...
Definition: MATH_RootExpression.h:24
virtual MATH_ChildExpression * insertInTree(MATH_Expression *tree, MATH_Environment &symbols, tString &expr)=0
insert the node This in tree & erase the This corresponding character in expr
SPC::MATH_ParentExpression getParent(int &index) const
get the parent
Definition: MATH_ChildExpression.h:83
This class is a children of a parent expression.
Definition: MATH_ChildExpression.h:23
DEFINE_SVPTR(MATH_ChildExpression)
This class describes a parent of math expression tree. A parent have arguments:
Definition: MATH_ParentExpression.h:22
#define tString
Definition: types.h:36
This class decribes an environment class.
Definition: MATH_Environment.h:14
virtual const MATH_RootExpression * getRootNode() const
return the root node of the node
Definition: MATH_ChildExpression.cpp:14
SP::MATH_ParentExpression getParent(int &index)
get the parent
Definition: MATH_ChildExpression.h:74