Isis 3 Developer Reference
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 {
70  class Calculator {
71  public:
72  Calculator(); // Constructor
74  virtual ~Calculator();
75 
76  // Math methods
77  void Negative();
78  void Multiply();
79  void Add();
80  void Subtract();
81  void Divide();
82  void Modulus();
83 
84  void Exponent();
85  void SquareRoot();
86  void AbsoluteValue();
87  void Log();
88  void Log10();
89 
90  void LeftShift();
91  void RightShift();
92  void MinimumPixel();
93  void MaximumPixel();
94  void MinimumLine();
95  void MaximumLine();
96  void Minimum2();
97  void Maximum2();
98  void GreaterThan();
99  void LessThan();
100  void Equal();
101  void LessThanOrEqual();
102  void GreaterThanOrEqual();
103  void NotEqual();
104  void And();
105  void Or();
106 
107  void Sine();
108  void Cosine();
109  void Tangent();
110  void Secant();
111  void Cosecant();
112  void Cotangent();
113  void Arcsine();
114  void Arccosine();
115  void Arctangent();
116  void Arctangent2();
117  void SineH();
118  void CosineH();
119  void TangentH();
120  void ArcsineH();
121  void ArccosineH();
122  void ArctangentH();
123 
124  // Stack methods
125  void Push(double scalar);
126  void Push(Buffer &buff);
127  void Push(QVector<double> &vect);
128  QVector<double> Pop(bool keepSpecials = false);
129  void PrintTop();
130  bool Empty();
131  virtual void Clear();
132 
133  protected:
134  void PerformOperation(QVector<double> &results,
135  QVector<double>::iterator arg1Start,
137  double operation(double));
138  void PerformOperation(QVector<double> &results,
139  QVector<double>::iterator arg1Start,
141  QVector<double>::iterator arg2Start,
143  double operation(double, double));
144 
146  int StackSize();
147 
148  private:
150  QStack< QVector<double> > * p_valStack;
151  };
152 };
153 
154 #endif
Buffer for reading and writing cube data.
Definition: Buffer.h:69
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:662
void MaximumLine()
Pop one element, then push the maximum on the stack.
Definition: Calculator.cpp:552
void And()
Pop two elements, AND them, then push the result on the stack.
Definition: Calculator.cpp:694
void Divide()
Pops two, divides them, then pushes the quotient on the stack.
Definition: Calculator.cpp:369
void ArctangentH()
Pops one element and push the inverse hyperbolic tangent.
Definition: Calculator.cpp:832
void Multiply()
Pops two elements, multiplies them, then pushes the product on the stack.
Definition: Calculator.cpp:332
void NotEqual()
Pop two elements off the stack and compare them to see where one is not equal to the other...
Definition: Calculator.cpp:677
void GreaterThan()
Pop two elements off the stack and compare them to see where one is greater than the other...
Definition: Calculator.cpp:602
void LeftShift()
Pop the top element, then perform a left shift with zero fill.
Definition: Calculator.cpp:456
void MinimumLine()
Pop one element, then push the minimum on the stack.
Definition: Calculator.cpp:533
void Arctangent()
Pops one element and push the arctangent.
Definition: Calculator.cpp:802
void PrintTop()
Print the vector at the top of the stack.
Definition: Calculator.cpp:1004
void Arctangent2()
Pops two elements and push the arctangent.
Definition: Calculator.cpp:842
void MinimumPixel()
Pop two elements, then push the minimum on a pixel by pixel basis back on the stack.
Definition: Calculator.cpp:572
void Or()
Pop two elements, OR them, then push the result on the stack.
Definition: Calculator.cpp:708
void Arccosine()
Pops one element and push the arccosine.
Definition: Calculator.cpp:792
void LessThan()
Pop two elements off the stack and compare them to see where one is less than the other...
Definition: Calculator.cpp:617
void Modulus()
Pops two elements, mods them, then pushes the result on the stack.
Definition: Calculator.cpp:381
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:647
void Cotangent()
Pops one element and push the cotangent.
Definition: Calculator.cpp:772
QVector< double > Pop(bool keepSpecials=false)
Pop an element off the stack.
Definition: Calculator.cpp:964
virtual ~Calculator()
Virtual Constructor.
Definition: Calculator.cpp:54
void SineH()
Pops one element and push the hyperbolic sine.
Definition: Calculator.cpp:855
void Negative()
Pops an element, negates it, then pushes the result.
Definition: Calculator.cpp:322
void Log()
Pop an element, compute its log, then push the result on the stack.
Definition: Calculator.cpp:434
void Arcsine()
Pops one element and push the arcsine.
Definition: Calculator.cpp:782
void PerformOperation(QVector< double > &results, QVector< double >::iterator arg1Start, QVector< double >::iterator arg1End, double operation(double))
Performs the mathematical operations on each argument.
Definition: Calculator.cpp:1052
void SquareRoot()
Pop an element, compute its square root, then push the root on the stack.
Definition: Calculator.cpp:412
void Add()
Pops two elements, adds them, then pushes the sum on the stack.
Definition: Calculator.cpp:345
int StackSize()
Returns the current stack size.
Definition: Calculator.cpp:889
void Subtract()
Pops two elements, subtracts them, then pushes the difference on the stack.
Definition: Calculator.cpp:357
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:632
Calculator()
The code that performs math operations is designed to call a function and use the result...
Definition: Calculator.cpp:47
bool Empty()
Check if the stack is empty.
Definition: Calculator.cpp:1028
void CosineH()
Pops one element and push the hyperbolic cosine.
Definition: Calculator.cpp:865
Definition: Calculator.h:32
void Push(double scalar)
Push a scalar onto the stack.
Definition: Calculator.cpp:908
void ArccosineH()
Pops one element and push the inverse hyperbolic cosine.
Definition: Calculator.cpp:822
virtual void Clear()
Clear out the stack.
Definition: Calculator.cpp:1036
void AbsoluteValue()
Pop an element, compute its absolute value, then push the result on the stack.
Definition: Calculator.cpp:422
Definition: Calculator.h:33
void MaximumPixel()
Pop two elements, then push the maximum on a pixel by pixel basis back on the stack.
Definition: Calculator.cpp:587
void Secant()
Pops one element and push the secant.
Definition: Calculator.cpp:762
void Sine()
Pops one element and push the sine.
Definition: Calculator.cpp:722
void RightShift()
Pop the top element, then perform a right shift with zero fill.
Definition: Calculator.cpp:495
void Tangent()
Pops one element and push the tangent.
Definition: Calculator.cpp:742
Namespace for ISIS/Bullet specific routines.
Definition: Apollo.h:31
void Cosecant()
Pops one element and push the cosecant.
Definition: Calculator.cpp:752
void Minimum2()
Not implemented in Calculator.cpp.
void Log10()
Pop an element, compute its base 10 log, then push the result on the stack.
Definition: Calculator.cpp:444
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:397
void ArcsineH()
Pops one element and push the inverse hyperbolic sine.
Definition: Calculator.cpp:812
void Cosine()
Pops one element and push the cosine.
Definition: Calculator.cpp:732
void TangentH()
Pops one element and push the hyperbolic tangent.
Definition: Calculator.cpp:875
void Maximum2()
Not implemented in Calculator.cpp.
Calculator for arrays.
Definition: Calculator.h:70