Isis 3.0 Programmer Reference
Back | Home
Calculator.h
Go to the documentation of this file.
1 
23 // Calculator.h
24 #ifndef CALCULATOR_H_
25 #define CALCULATOR_H_
26 
27 #include "Buffer.h"
28 
29 // I'm not sure how to forward declare the iterators
30 #include <QVector>
31 
32 template<class T> class QStack;
33 template<class T> class QVector;
34 
35 namespace Isis {
66  class Calculator {
67  public:
68  Calculator(); // Constructor
70  virtual ~Calculator();
71 
72  // Math methods
73  void Negative();
74  void Multiply();
75  void Add();
76  void Subtract();
77  void Divide();
78  void Modulus();
79 
80  void Exponent();
81  void SquareRoot();
82  void AbsoluteValue();
83  void Log();
84  void Log10();
85 
86  void LeftShift();
87  void RightShift();
88  void MinimumPixel();
89  void MaximumPixel();
90  void MinimumLine();
91  void MaximumLine();
92  void Minimum2();
93  void Maximum2();
94  void GreaterThan();
95  void LessThan();
96  void Equal();
97  void LessThanOrEqual();
98  void GreaterThanOrEqual();
99  void NotEqual();
100  void And();
101  void Or();
102 
103  void Sine();
104  void Cosine();
105  void Tangent();
106  void Secant();
107  void Cosecant();
108  void Cotangent();
109  void Arcsine();
110  void Arccosine();
111  void Arctangent();
112  void Arctangent2();
113  void SineH();
114  void CosineH();
115  void TangentH();
116  void ArcsineH();
117  void ArccosineH();
118  void ArctangentH();
119 
120  // Stack methods
121  void Push(double scalar);
122  void Push(Buffer &buff);
123  void Push(QVector<double> &vect);
124  QVector<double> Pop(bool keepSpecials = false);
125  void PrintTop();
126  bool Empty();
127  virtual void Clear();
128 
129  protected:
130  void PerformOperation(QVector<double> &results,
131  QVector<double>::iterator arg1Start,
133  double operation(double));
134  void PerformOperation(QVector<double> &results,
135  QVector<double>::iterator arg1Start,
137  QVector<double>::iterator arg2Start,
139  double operation(double, double));
140 
142  int StackSize();
143 
144  private:
147  };
148 };
149 
150 #endif
Buffer for reading and writing cube data.
Definition: Buffer.h:68
void LessThanOrEqual()
Pop two elements off the stack and compare them to see where one is less than or equal to the other...
Definition: Calculator.cpp:660
void MaximumLine()
Pop one element, then push the maximum on the stack.
Definition: Calculator.cpp:550
void And()
Pop two elements, AND them, then push the result on the stack.
Definition: Calculator.cpp:692
void Divide()
Pops two, divides them, then pushes the quotient on the stack.
Definition: Calculator.cpp:367
void ArctangentH()
Pops one element and push the inverse hyperbolic tangent.
Definition: Calculator.cpp:830
void Multiply()
Pops two elements, multiplies them, then pushes the product on the stack.
Definition: Calculator.cpp:330
void NotEqual()
Pop two elements off the stack and compare them to see where one is not equal to the other...
Definition: Calculator.cpp:675
void GreaterThan()
Pop two elements off the stack and compare them to see where one is greater than the other...
Definition: Calculator.cpp:600
void LeftShift()
Pop the top element, then perform a left shift with zero fill.
Definition: Calculator.cpp:454
void MinimumLine()
Pop one element, then push the minimum on the stack.
Definition: Calculator.cpp:531
void Arctangent()
Pops one element and push the arctangent.
Definition: Calculator.cpp:800
void PrintTop()
Print the vector at the top of the stack.
Definition: Calculator.cpp:998
void Arctangent2()
Pops two elements and push the arctangent.
Definition: Calculator.cpp:840
void MinimumPixel()
Pop two elements, then push the minimum on a pixel by pixel basis back on the stack.
Definition: Calculator.cpp:570
void Or()
Pop two elements, OR them, then push the result on the stack.
Definition: Calculator.cpp:706
void Arccosine()
Pops one element and push the arccosine.
Definition: Calculator.cpp:790
void LessThan()
Pop two elements off the stack and compare them to see where one is less than the other...
Definition: Calculator.cpp:615
void Modulus()
Pops two elements, mods them, then pushes the result on the stack.
Definition: Calculator.cpp:379
void GreaterThanOrEqual()
Pop two elements off the stack and compare them to see where one is greater than or equal to the othe...
Definition: Calculator.cpp:645
void Cotangent()
Pops one element and push the cotangent.
Definition: Calculator.cpp:770
QVector< double > Pop(bool keepSpecials=false)
Pop an element off the stack.
Definition: Calculator.cpp:958
virtual ~Calculator()
Virtual Constructor.
Definition: Calculator.cpp:309
void SineH()
Pops one element and push the hyperbolic sine.
Definition: Calculator.cpp:853
void Negative()
Pops an element, negates it, then pushes the result.
Definition: Calculator.cpp:320
void Log()
Pop an element, compute its log, then push the result on the stack.
Definition: Calculator.cpp:432
void Arcsine()
Pops one element and push the arcsine.
Definition: Calculator.cpp:780
void PerformOperation(QVector< double > &results, QVector< double >::iterator arg1Start, QVector< double >::iterator arg1End, double operation(double))
Performs the mathematical operations on each argument.
void SquareRoot()
Pop an element, compute its square root, then push the root on the stack.
Definition: Calculator.cpp:410
void Add()
Pops two elements, adds them, then pushes the sum on the stack.
Definition: Calculator.cpp:343
int StackSize()
Returns the current stack size.
Definition: Calculator.cpp:883
void Subtract()
Pops two elements, subtracts them, then pushes the difference on the stack.
Definition: Calculator.cpp:355
void Equal()
Pop two elements off the stack and compare them to see where one is equal to the other, then push the results on the stack.
Definition: Calculator.cpp:630
Calculator()
Constructor.
Definition: Calculator.cpp:302
bool Empty()
Check if the stack is empty.
void CosineH()
Pops one element and push the hyperbolic cosine.
Definition: Calculator.cpp:863
void Push(double scalar)
Push a scalar onto the stack.
Definition: Calculator.cpp:902
void ArccosineH()
Pops one element and push the inverse hyperbolic cosine.
Definition: Calculator.cpp:820
QStack< QVector< double > > * p_valStack
The current stack of arguments.
Definition: Calculator.h:146
virtual void Clear()
Clear out the stack.
void AbsoluteValue()
Pop an element, compute its absolute value, then push the result on the stack.
Definition: Calculator.cpp:420
void MaximumPixel()
Pop two elements, then push the maximum on a pixel by pixel basis back on the stack.
Definition: Calculator.cpp:585
void Secant()
Pops one element and push the secant.
Definition: Calculator.cpp:760
void Sine()
Pops one element and push the sine.
Definition: Calculator.cpp:720
void RightShift()
Pop the top element, then perform a right shift with zero fill.
Definition: Calculator.cpp:493
void Tangent()
Pops one element and push the tangent.
Definition: Calculator.cpp:740
void Cosecant()
Pops one element and push the cosecant.
Definition: Calculator.cpp:750
void Log10()
Pop an element, compute its base 10 log, then push the result on the stack.
Definition: Calculator.cpp:442
void Exponent()
Pops two elements, computes the power then pushes the result on the stack The exponent has to be a sc...
Definition: Calculator.cpp:395
void ArcsineH()
Pops one element and push the inverse hyperbolic sine.
Definition: Calculator.cpp:810
void Cosine()
Pops one element and push the cosine.
Definition: Calculator.cpp:730
void TangentH()
Pops one element and push the hyperbolic tangent.
Definition: Calculator.cpp:873
Calculator for arrays.
Definition: Calculator.h:66

U.S. Department of the Interior | U.S. Geological Survey
ISIS | Privacy & Disclaimers | Astrogeology Research Program
To contact us, please post comments and questions on the ISIS Support Center
File Modified: 07/12/2023 23:15:26