Gadget
formula.h
Go to the documentation of this file.
1 #ifndef formula_h
2 #define formula_h
3 
4 #include "keeper.h"
5 #include "parameter.h"
6 #include "gadget.h"
7 
8 class Keeper;
9 
13 
18 class Formula {
19 public:
23  Formula();
28  Formula(double initial);
33  Formula(const Formula& initial);
39  Formula(FunctionType ft, vector<Formula*> formlist);
43  ~Formula();
48  void setValue(double init);
53  operator double() const;
59  void Interchange(Formula& newF, Keeper* keeper) const;
64  void Inform(Keeper* keeper);
69  void Delete(Keeper* keeper) const;
74  Formula& operator = (const Formula& F);
80  friend CommentStream& operator >> (CommentStream& infile, Formula& F);
85  FormulaType getType() const { return type; };
86 private:
91  double evalFunction() const;
95  FormulaType type;
99  FunctionType functiontype;
103  double value;
107  Parameter name;
111  vector<Formula*> argList;
112 };
113 
114 #endif
This is the class used to strip comments (and whitespace) from any input stream.
Definition: commentstream.h:40
This is the class used to calculate the value of the variables used in the model simulation.
Definition: formula.h:18
Formula & operator=(const Formula &F)
This operator will set the Formula equal to an existing Formula.
Definition: formula.cc:517
void Interchange(Formula &newF, Keeper *keeper) const
This function will swap the Formula value for a new value.
Definition: formula.cc:467
Formula()
This is the default Formula constructor.
Definition: formula.cc:7
~Formula()
This is the default Formula destructor.
Definition: formula.cc:19
void Delete(Keeper *keeper) const
This function will delete a Formula value.
Definition: formula.cc:499
FormulaType getType() const
This will return the type of Formula class.
Definition: formula.h:85
friend CommentStream & operator>>(CommentStream &infile, Formula &F)
This operator will read data from a CommentStream into a Formula.
Definition: formula.cc:282
void Inform(Keeper *keeper)
This function will inform the Keeper for the current model of the new Formula.
Definition: formula.cc:446
void setValue(double init)
This function will set the value of the Formula.
Definition: formula.cc:276
This is the class used to store information about the variables that are used in model simulation.
Definition: keeper.h:17
This is the class used to store the name of a variable used in the model simulation.
Definition: parameter.h:11
FunctionType
Definition: formula.h:11
@ SQRT
Definition: formula.h:12
@ NOT
Definition: formula.h:12
@ MULT
Definition: formula.h:11
@ IF
Definition: formula.h:12
@ GREATER
Definition: formula.h:12
@ EXP
Definition: formula.h:11
@ POWER
Definition: formula.h:12
@ COS
Definition: formula.h:11
@ RAND
Definition: formula.h:12
@ SIN
Definition: formula.h:11
@ EQUAL
Definition: formula.h:12
@ PI
Definition: formula.h:12
@ ABS
Definition: formula.h:12
@ DIV
Definition: formula.h:11
@ AND
Definition: formula.h:12
@ PLUS
Definition: formula.h:11
@ LESS
Definition: formula.h:12
@ OR
Definition: formula.h:12
@ NONE
Definition: formula.h:11
@ LOG
Definition: formula.h:11
@ LOG10
Definition: formula.h:12
@ MINUS
Definition: formula.h:11
FormulaType
Definition: formula.h:10
@ PARAMETER
Definition: formula.h:10
@ CONSTANT
Definition: formula.h:10
@ FUNCTION
Definition: formula.h:10