|
Isis 3.0 Object Programmers' Reference |
Home |
00001 00023 // Calculator.h 00024 #ifndef CALCULATOR_H_ 00025 #define CALCULATOR_H_ 00026 00027 #include "Buffer.h" 00028 #include <vector> 00029 #include <stack> 00030 00031 namespace Isis { 00057 class Calculator { 00058 public: 00059 Calculator(); // Constructor 00061 virtual ~Calculator() {} 00062 00063 // Math methods 00064 void Negative(); 00065 void Multiply(); 00066 void Add(); 00067 void Subtract(); 00068 void Divide(); 00069 void Modulus(); 00070 00071 void Exponent(); 00072 void SquareRoot(); 00073 void AbsoluteValue(); 00074 void Log(); 00075 void Log10(); 00076 00077 void LeftShift(); 00078 void RightShift(); 00079 void Minimum(); 00080 void Maximum(); 00081 void GreaterThan(); 00082 void LessThan(); 00083 void Equal(); 00084 void LessThanOrEqual(); 00085 void GreaterThanOrEqual(); 00086 void NotEqual(); 00087 void And(); 00088 void Or(); 00089 00090 void Sine(); 00091 void Cosine(); 00092 void Tangent(); 00093 void Secant(); 00094 void Cosecant(); 00095 void Cotangent(); 00096 void Arcsine(); 00097 void Arccosine(); 00098 void Arctangent(); 00099 void Arctangent2(); 00100 void SineH(); 00101 void CosineH(); 00102 void TangentH(); 00103 void ArcsineH(); 00104 void ArccosineH(); 00105 void ArctangentH(); 00106 00107 // Stack methods 00108 void Push(double scalar); 00109 void Push(Buffer &buff); 00110 void Push(std::vector<double> &vect); 00111 std::vector<double> Pop(bool keepSpecials = false); 00112 void PrintTop(); 00113 bool Empty(); 00114 virtual void Clear(); 00115 00116 protected: 00117 void PerformOperation(std::vector<double> &results, 00118 std::vector<double>::iterator arg1Start, 00119 std::vector<double>::iterator arg1End, 00120 double operation(double)); 00121 void PerformOperation(std::vector<double> &results, 00122 std::vector<double>::iterator arg1Start, 00123 std::vector<double>::iterator arg1End, 00124 std::vector<double>::iterator arg2Start, 00125 std::vector<double>::iterator arg2End, 00126 double operation(double, double)); 00127 00129 int StackSize() { return p_valStack.size(); } 00130 00131 private: 00133 std::stack<std::vector<double> > p_valStack; 00134 }; 00135 }; 00136 00137 #endif