Official websites use .gov
A .gov website belongs to an official government organization in the United States.

Secure .gov websites use HTTPS
A lock ( ) or https:// means you’ve safely connected to the .gov website. Share sensitive information only on official, secure websites.

Isis 3 Programmer Reference
CubeInfixToPostfix.cpp
1
5
6/* SPDX-License-Identifier: CC0-1.0 */
7
8#include "CubeInfixToPostfix.h"
9#include "IException.h"
10
11using namespace std;
12
13namespace Isis {
22
31 // List of the form funct(fN) where N is the file number
32 // For example pha(f1) returns the phase angle for f1
33 p_operators.push_back(new InfixFunction("cubemin", 1));
34 p_operators.push_back(new InfixFunction("cubemax", 1));
35 p_operators.push_back(new InfixFunction("cubeavg", 1));
36 p_operators.push_back(new InfixFunction("cubestd", 1));
37
38 p_operators.push_back(new InfixFunction("pha", 1));
39 p_operators.push_back(new InfixFunction("ema", 1));
40 p_operators.push_back(new InfixFunction("ina", 1));
41
42 p_operators.push_back(new InfixFunction("phal", 1));
43 p_operators.push_back(new InfixFunction("emal", 1));
44 p_operators.push_back(new InfixFunction("inal", 1));
45
46 p_operators.push_back(new InfixFunction("phac", 1));
47 p_operators.push_back(new InfixFunction("emac", 1));
48 p_operators.push_back(new InfixFunction("inac", 1));
49
50 p_operators.push_back(new InfixFunction("lat", 1));
51 p_operators.push_back(new InfixFunction("lon", 1));
52 p_operators.push_back(new InfixFunction("res", 1));
53 p_operators.push_back(new InfixFunction("radius", 1));
54 }
55
64 bool CubeInfixToPostfix::isKnownSymbol(QString representation) {
65 for(int i = 0; i < p_operators.size(); i++) {
66 if(representation.compare(p_operators[i]->inputString()) == 0) {
67 return true;
68 }
69 }
70
71 bool isFunction = (representation.size() > 1);
72 if(isFunction) {
73 isFunction &= (representation[0] == 'f');
74 for(int i = 1; isFunction && i < representation.size(); i++) {
75 isFunction &= (representation[i] >= '0' && representation[i] <= '9');
76 }
77 }
78 else {
79 isFunction = false;
80 }
81
82 return isFunction;
83 }
84
86 try {
87 return InfixToPostfix::findOperator(representation);
88 }
89 catch(IException &) {
90 }
91
92 bool isFunction = (representation.size() > 1);
93 if(representation[0] == 'f') {
94 for(int i = 1; i < representation.size(); i++) {
95 isFunction &= (representation[i] >= '0' && representation[i] <= '9');
96 }
97 }
98 else {
99 isFunction = false;
100 }
101
102 if(isFunction) {
103 p_operators.push_back(new InfixFunction(representation, 0));
104 return p_operators[p_operators.size()-1];
105 }
106
107 throw IException(IException::User,
108 "The operator '" + representation + "' is not recognized.",
109 _FILEINFO_);
110 }
111
112
113}; // end namespace Isis
CubeInfixToPostfix()
Constructs a CubeInfixToPostfix converter.
bool isKnownSymbol(QString representation)
This method will return true if it believes the argument represents a valid function or operator.
InfixOperator * findOperator(QString representation)
This method will return a pointer to the operator represented by 'representation.
void initialize()
This method is used to create functions that are specific to cubes.
InfixOperator and InfixFunction are helper classes for InfixToPostfix.
InfixOperator and InfixFunction are helper classes for InfixToPostfix.
virtual InfixOperator * findOperator(QString representation)
This method will return a pointer to the operator represented by 'representation.
bool isFunction(QString representation)
This method will return true if 'representation' is a known function.
This is free and unencumbered software released into the public domain.
Definition Apollo.h:16
Namespace for the standard library.