1 #ifndef MATH_ParentExpression_H
2 #define MATH_ParentExpression_H
34 SV::MATH_ChildExpression mArguments;
62 mArguments.setSize(n);
73 SP::MATH_ChildExpression sp;
93 SP::MATH_ChildExpression p;
105 for (
int i=mArguments.getSize()-1;i>=0;i--)
124 inline SPC::MATH_ChildExpression
getArgument(
const int& i)
const {
125 return mArguments[i];
132 return mArguments[i];
138 return mArguments.getSize();
165 int nArgs=mArguments.getSize();
167 for (
int i=0;i<nArgs;i++) {
168 arg=mArguments.get(i);
170 retCode=arg->
evaluate(action,symbols,var);
171 if (retCode<0)
return FAIL;
DEFINE_SPTR(MATH_ParentExpression)
This class decribes a variable class for evaluation.
Definition: MATH_Variable.h:16
int getArgumentsNumber() const
get the arguments number
Definition: MATH_ParentExpression.h:137
tBoolean setArgument(const int &index, MATH_ChildExpression *arg)
set an argument at index
Definition: MATH_ParentExpression.h:92
void setArgumentsNumber(const int &n)
set the arguments number
Definition: MATH_ParentExpression.h:61
This class is the base class of a math expression.
Definition: MATH_Expression.h:24
SPC::MATH_ChildExpression getArgument(const int &i) const
get argument at index i for reading
Definition: MATH_ParentExpression.h:124
virtual ~MATH_ParentExpression(void)
destroy
Definition: MATH_ParentExpression.cpp:7
virtual int evaluate(const tFlag &action, MATH_Environment &symbols, MATH_Variable &var) const
void evaluate the expression
Definition: MATH_ParentExpression.h:163
#define tBoolean
Definition: types.h:35
#define null
Definition: types.h:13
virtual const MATH_RootExpression * getRootNode() const =0
return the root node of the parent
MATH_ParentExpression(void)
create
Definition: MATH_ParentExpression.cpp:4
This class is a root expression The MATH_RootExpression::newClassFactoryInstance() creates the class ...
Definition: MATH_RootExpression.h:24
void getSharedPointer(SP::CORE_Object &p)
get the shared pointer of this class into p
Definition: CORE_Object.h:65
virtual int evaluate(const tFlag &action, MATH_Environment &symbols, MATH_Variable &value) const =0
void evaluate the expression
static const int FAIL
Definition: MATH_Expression.h:42
This class is a children of a parent expression.
Definition: MATH_ChildExpression.h:23
void resetArguments()
reset all the arguments
Definition: MATH_ParentExpression.h:104
virtual tBoolean addArgument(SP::MATH_ChildExpression operand)
add the argument
Definition: MATH_ParentExpression.cpp:11
This class describes a parent of math expression tree. A parent have arguments:
Definition: MATH_ParentExpression.h:22
#define tString
Definition: types.h:36
SP::MATH_ChildExpression getArgument(const int &i)
get argument at index i for writing
Definition: MATH_ParentExpression.h:131
This class decribes an environment class.
Definition: MATH_Environment.h:14
tBoolean setArgument(const int &index, SP::MATH_ChildExpression org)
set the argument at index
Definition: MATH_ParentExpression.cpp:34
void resetArgument(const int &index)
reset the argument at index
Definition: MATH_ParentExpression.cpp:58
virtual tBoolean addArgument(MATH_ChildExpression *operand)
add the argument
Definition: MATH_ParentExpression.h:72
virtual tString toString() const
to String
Definition: MATH_ParentExpression.cpp:73
#define tFlag
Definition: types.h:14