C++ main module for gpm Package  1.0
MATH_EOperator.h
Go to the documentation of this file.
1 #ifndef MATH_EOperator_H
2 #define MATH_EOperator_H
3 
4 #include "MATH_UnaryOperator.h"
5 #include "MATH_Variable.h"
6 
18  SP_OBJECT(MATH_EOperator);
19 
20  // ATTRIBUTES
21 
22 
23 protected:
24  // METHODS
25 
26  // CONSTRUCTORS
27 
31  setName("10^");
32  }
33 
34 
35 
36  // DESTRUCTORS
37 
38 
41  virtual ~MATH_EOperator(void) {
42  }
43 
44 
45 private:
46 
47 public:
50  static inline SP::MATH_EOperator New() {
51  SP::MATH_EOperator p(new MATH_EOperator(),MATH_EOperator::Delete());
52  p->setThis(p);
53  return p;
54  }
55 
58  virtual SP::MATH_NodeExpression newInstance() const {
59  return New();
60  }
61 
62 
63  // SET methods
64 
65 
66  // GET methods
67 
68 public:
69  // OTHERS methods
76  virtual int evaluate(const tFlag& action,MATH_Environment& symbols,MATH_Variable& var) const {
77  SPC::MATH_ChildExpression arg1=getArgument(0);
78  int retCode=SUCCESS;
79 
80  if (arg1.get()!=null) retCode=arg1->evaluate(action,symbols,var);
81  int n=var.getSize();
82  for (int i=0;i<n;i++) var[i]=pow(10,var[i]);
83  return retCode;
84  }
85 
86 };
87 
88 #endif
virtual int evaluate(const tFlag &action, MATH_Environment &symbols, MATH_Variable &var) const
void evaluate the expression
Definition: MATH_EOperator.h:76
static SP::MATH_EOperator New()
create a node expression
Definition: MATH_EOperator.h:50
DEFINE_SPTR(MATH_EOperator)
This class decribes a variable class for evaluation.
Definition: MATH_Variable.h:16
virtual SP::MATH_NodeExpression newInstance() const
create a node expression
Definition: MATH_EOperator.h:58
SPC::MATH_ChildExpression getArgument(const int &i) const
get argument at index i for reading
Definition: MATH_ParentExpression.h:124
virtual ~MATH_EOperator(void)
destroy
Definition: MATH_EOperator.h:41
#define null
Definition: types.h:13
int getSize() const
get the size
Definition: MATH_Variable.h:237
This class decribes an unary operator wiath is associated to a binary operator which replaces it if n...
Definition: MATH_UnaryOperator.h:17
This class describes a ten power operator (algebric: 10^)
Definition: MATH_EOperator.h:17
This class decribes an environment class.
Definition: MATH_Environment.h:14
static const int SUCCESS
Definition: MATH_Expression.h:41
void setName(const tString &n)
set the operator name
Definition: MATH_Operator.h:45
MATH_EOperator(void)
create
Definition: MATH_EOperator.h:30
class Free introduced for deleting a smart pointer
Definition: CORE_Object.h:106
#define tFlag
Definition: types.h:14