USGS

Isis 3.0 Developer's Reference (API)

Home

Isis::Calculator Class Reference

Calculator for arrays. More...

#include <Calculator.h>

Inherited by Isis::CubeCalculator [private], and Isis::InlineCalculator.

Public Member Functions

 Calculator ()
 Constructor.
virtual ~Calculator ()
 Virtual Constructor.
void Negative ()
 Pops an element, negates it, then pushes the result.
void Multiply ()
 Pops two elements, multiplies them, then pushes the product on the stack.
void Add ()
 Pops two elements, adds them, then pushes the sum on the stack.
void Subtract ()
 Pops two elements, subtracts them, then pushes the difference on the stack.
void Divide ()
 Pops two, divides them, then pushes the quotient on the stack.
void Modulus ()
 Pops two elements, mods them, then pushes the result on the stack.
void Exponent ()
 Pops two elements, computes the power then pushes the result on the stack The exponent has to be a scalar.
void SquareRoot ()
 Pop an element, compute its square root, then push the root on the stack.
void AbsoluteValue ()
 Pop an element, compute its absolute value, then push the result on the stack.
void Log ()
 Pop an element, compute its log, then push the result on the stack.
void Log10 ()
 Pop an element, compute its base 10 log, then push the result on the stack.
void LeftShift ()
 Pop the top element, then perform a left shift with zero fill.
void RightShift ()
 Pop the top element, then perform a right shift with zero fill.
void MinimumPixel ()
 Pop two elements, then push the minimum on a pixel by pixel basis back on the stack.
void MaximumPixel ()
 Pop two elements, then push the maximum on a pixel by pixel basis back on the stack.
void MinimumLine ()
 Pop one element, then push the minimum on the stack.
void MaximumLine ()
 Pop one element, then push the maximum on the stack.
void Minimum2 ()
void Maximum2 ()
void GreaterThan ()
 Pop two elements off the stack and compare them to see where one is greater than the other, then push the results on the stack.
void LessThan ()
 Pop two elements off the stack and compare them to see where one is less than the other, then push the results on the stack.
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.
void LessThanOrEqual ()
 Pop two elements off the stack and compare them to see where one is less than or equal to the other, then push the results on the stack.
void GreaterThanOrEqual ()
 Pop two elements off the stack and compare them to see where one is greater than or equal to the other, then push the results on the stack.
void NotEqual ()
 Pop two elements off the stack and compare them to see where one is not equal to the other, then push the results on the stack.
void And ()
 Pop two elements, AND them, then push the result on the stack.
void Or ()
 Pop two elements, OR them, then push the result on the stack.
void Sine ()
 Pops one element and push the sine.
void Cosine ()
 Pops one element and push the cosine.
void Tangent ()
 Pops one element and push the tangent.
void Secant ()
 Pops one element and push the secant.
void Cosecant ()
 Pops one element and push the cosecant.
void Cotangent ()
 Pops one element and push the cotangent.
void Arcsine ()
 Pops one element and push the arcsine.
void Arccosine ()
 Pops one element and push the arccosine.
void Arctangent ()
 Pops one element and push the arctangent.
void Arctangent2 ()
 Pops two elements and push the arctangent.
void SineH ()
 Pops one element and push the hyperbolic sine.
void CosineH ()
 Pops one element and push the hyperbolic cosine.
void TangentH ()
 Pops one element and push the hyperbolic tangent.
void ArcsineH ()
 Pops one element and push the inverse hyperbolic sine.
void ArccosineH ()
 Pops one element and push the inverse hyperbolic cosine.
void ArctangentH ()
 Pops one element and push the inverse hyperbolic tangent.
void Push (double scalar)
 Push a scalar onto the stack.
void Push (Buffer &buff)
 Push a buffer onto the stack.
void Push (QVector< double > &vect)
 Push a vector onto the stack.
QVector< double > Pop (bool keepSpecials=false)
 Pop an element off the stack.
void PrintTop ()
 Print the vector at the top of the stack.
bool Empty ()
 Check if the stack is empty.
virtual void Clear ()
 Clear out the stack.

Protected Member Functions

void PerformOperation (QVector< double > &results, QVector< double >::iterator arg1Start, QVector< double >::iterator arg1End, double operation(double))
 Performs the mathematical operations on each argument.
void PerformOperation (QVector< double > &results, QVector< double >::iterator arg1Start, QVector< double >::iterator arg1End, QVector< double >::iterator arg2Start, QVector< double >::iterator arg2End, double operation(double, double))
 Performs the mathematical operation on each pair of arguments, or a set of agruments against a single argument.
int StackSize ()
 Returns the current stack size.

Detailed Description

Calculator for arrays.

This class is a RPN calculator on arrays. It uses classic push/pop/operator methods. That is, push array1, push array2, add, pop arrayResult.

Author
2007-04-01 Sean Crosby

Constructor & Destructor Documentation

Isis::Calculator::Calculator ( )

Constructor.

Isis::Calculator::~Calculator ( )
virtual

Virtual Constructor.

Constructor.

Member Function Documentation

void Isis::Calculator::AbsoluteValue ( )

Pop an element, compute its absolute value, then push the result on the stack.

void Isis::Calculator::Add ( )

Pops two elements, adds them, then pushes the sum on the stack.

References Isis::AddOperator().

void Isis::Calculator::And ( )

Pop two elements, AND them, then push the result on the stack.

References Isis::BitwiseAndOperator().

void Isis::Calculator::Arccosine ( )

Pops one element and push the arccosine.

void Isis::Calculator::ArccosineH ( )

Pops one element and push the inverse hyperbolic cosine.

void Isis::Calculator::Arcsine ( )

Pops one element and push the arcsine.

void Isis::Calculator::ArcsineH ( )

Pops one element and push the inverse hyperbolic sine.

void Isis::Calculator::Arctangent ( )

Pops one element and push the arctangent.

void Isis::Calculator::Arctangent2 ( )

Pops two elements and push the arctangent.

void Isis::Calculator::ArctangentH ( )

Pops one element and push the inverse hyperbolic tangent.

void Isis::Calculator::Clear ( )
virtual

Clear out the stack.

Referenced by Isis::InlineCalculator::compile().

void Isis::Calculator::Cosecant ( )

Pops one element and push the cosecant.

References Isis::CosecantOperator().

void Isis::Calculator::Cosine ( )

Pops one element and push the cosine.

void Isis::Calculator::CosineH ( )

Pops one element and push the hyperbolic cosine.

void Isis::Calculator::Cotangent ( )

Pops one element and push the cotangent.

References Isis::CotangentOperator().

void Isis::Calculator::Divide ( )

Pops two, divides them, then pushes the quotient on the stack.

References Isis::DivideOperator().

bool Isis::Calculator::Empty ( )

Check if the stack is empty.

Returns
bool True if the stack is empty
void Isis::Calculator::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.

References Isis::EqualOperator().

void Isis::Calculator::Exponent ( )

Pops two elements, computes the power then pushes the result on the stack The exponent has to be a scalar.

Exceptions
Isis::iException::Math
void Isis::Calculator::GreaterThan ( )

Pop two elements off the stack and compare them to see where one is greater than the other, then push the results on the stack.

References Isis::GreaterThanOperator().

void Isis::Calculator::GreaterThanOrEqual ( )

Pop two elements off the stack and compare them to see where one is greater than or equal to the other, then push the results on the stack.

References Isis::GreaterThanOrEqualOperator().

void Isis::Calculator::LeftShift ( )

Pop the top element, then perform a left shift with zero fill.

Exceptions
Isis::iException::Math

References _FILEINFO_.

void Isis::Calculator::LessThan ( )

Pop two elements off the stack and compare them to see where one is less than the other, then push the results on the stack.

References Isis::LessThanOperator().

void Isis::Calculator::LessThanOrEqual ( )

Pop two elements off the stack and compare them to see where one is less than or equal to the other, then push the results on the stack.

References Isis::LessThanOrEqualOperator().

void Isis::Calculator::Log ( )

Pop an element, compute its log, then push the result on the stack.

Exceptions
Isis::iException::Math
void Isis::Calculator::Log10 ( )

Pop an element, compute its base 10 log, then push the result on the stack.

void Isis::Calculator::Maximum2 ( )
void Isis::Calculator::MaximumLine ( )

Pop one element, then push the maximum on the stack.

References Isis::IsSpecial().

void Isis::Calculator::MaximumPixel ( )

Pop two elements, then push the maximum on a pixel by pixel basis back on the stack.

References Isis::MaximumOperator().

void Isis::Calculator::Minimum2 ( )
void Isis::Calculator::MinimumLine ( )

Pop one element, then push the minimum on the stack.

References Isis::IsSpecial().

void Isis::Calculator::MinimumPixel ( )

Pop two elements, then push the minimum on a pixel by pixel basis back on the stack.

References Isis::MinimumOperator().

void Isis::Calculator::Modulus ( )

Pops two elements, mods them, then pushes the result on the stack.

References Isis::ModulusOperator().

void Isis::Calculator::Multiply ( )

Pops two elements, multiplies them, then pushes the product on the stack.

References Isis::MultiplyOperator().

void Isis::Calculator::Negative ( )

Pops an element, negates it, then pushes the result.

References Isis::NegateOperator().

void Isis::Calculator::NotEqual ( )

Pop two elements off the stack and compare them to see where one is not equal to the other, then push the results on the stack.

References Isis::NotEqualOperator().

void Isis::Calculator::Or ( )

Pop two elements, OR them, then push the result on the stack.

References Isis::BitwiseOrOperator().

void Isis::Calculator::PerformOperation ( QVector< double > &  results,
QVector< double >::iterator  arg1Start,
QVector< double >::iterator  arg1End,
double   operationdouble 
)
protected

Performs the mathematical operations on each argument.

Parameters
results[out] The results of the performed operation
arg1StartThe first argument to have the operation done on
arg1EndOne argument beyond the final argument to have the operation done upon
operationThe operation to be done on all arguments

Referenced by Isis::InlineCalculator::floatModulus().

void Isis::Calculator::PerformOperation ( QVector< double > &  results,
QVector< double >::iterator  arg1Start,
QVector< double >::iterator  arg1End,
QVector< double >::iterator  arg2Start,
QVector< double >::iterator  arg2End,
double   operationdouble, double 
)
protected

Performs the mathematical operation on each pair of arguments, or a set of agruments against a single argument.

Parameters
results[out] The results of the performed operation
arg1StartThe first of the primary argument to have the operation done on
arg1EndOne arguement beyond the final primary argument to have the operation done upon
arg2StartThe first of the secondaty argument to have the operation done on
arg2EndOne arguement beyond the final secondary argument to have the operation done upon
operationThe operation to be done on all pairs of arguments

References _FILEINFO_.

QVector< double > Isis::Calculator::Pop ( bool  keepSpecials = false)

Pop an element off the stack.

Parameters
keepSpecialsIf true, special pixels will be preserved; otherwise, they will be mapped to double values
Returns
The top of the stack, which gets popped

References _FILEINFO_, Isis::Hrs, Isis::Lrs, and Isis::Null.

Referenced by Isis::InlineCalculator::degrees(), Isis::InlineCalculator::evaluate(), Isis::InlineCalculator::floatModulus(), and Isis::InlineCalculator::radians().

void Isis::Calculator::PrintTop ( )

Print the vector at the top of the stack.

void Isis::Calculator::Push ( double  scalar)
void Isis::Calculator::Push ( Buffer buff)

Push a buffer onto the stack.

Parameters
buffThe buffer that will be pushed on the stack

References Isis::IsHisPixel(), Isis::IsHrsPixel(), Isis::IsLisPixel(), Isis::IsLrsPixel(), Isis::IsNullPixel(), Isis::IsSpecial(), and Isis::Buffer::size().

void Isis::Calculator::Push ( QVector< double > &  vect)

Push a vector onto the stack.

Parameters
vectThe vector that will be pushed on the stack
void Isis::Calculator::RightShift ( )

Pop the top element, then perform a right shift with zero fill.

Exceptions
Isis::iException::Math

References _FILEINFO_.

void Isis::Calculator::Secant ( )

Pops one element and push the secant.

References Isis::SecantOperator().

void Isis::Calculator::Sine ( )

Pops one element and push the sine.

void Isis::Calculator::SineH ( )

Pops one element and push the hyperbolic sine.

void Isis::Calculator::SquareRoot ( )

Pop an element, compute its square root, then push the root on the stack.

Exceptions
Isis::iException::Math
int Isis::Calculator::StackSize ( )
protected

Returns the current stack size.

Get the current stack size.

Referenced by Isis::InlineCalculator::evaluate().

void Isis::Calculator::Subtract ( )

Pops two elements, subtracts them, then pushes the difference on the stack.

References Isis::SubtractOperator().

void Isis::Calculator::Tangent ( )

Pops one element and push the tangent.

void Isis::Calculator::TangentH ( )

Pops one element and push the hyperbolic tangent.


The documentation for this class was generated from the following files: