File failed to load: https://isis.astrogeology.usgs.gov/6.0.0/Object/assets/jax/output/NativeMML/config.js
Isis 3 Programmer Reference
CubeInfixToPostfix.cpp
1 
6 /* SPDX-License-Identifier: CC0-1.0 */
7 
8 #include "CubeInfixToPostfix.h"
9 #include "IException.h"
10 
11 using namespace std;
12 
13 namespace Isis {
19  CubeInfixToPostfix::CubeInfixToPostfix() {
20  initialize();
21  }
22 
30  void CubeInfixToPostfix::initialize() {
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(representation[0] == 'f') {
73  for(int i = 1; isFunction && i < representation.size(); i++) {
74  isFunction &= (representation[i] >= '0' && representation[i] <= '9');
75  }
76  }
77  else {
78  isFunction = false;
79  }
80 
81  return isFunction;
82  }
83 
84  InfixOperator *CubeInfixToPostfix::findOperator(QString representation) {
85  try {
86  return InfixToPostfix::findOperator(representation);
87  }
88  catch(IException &) {
89  }
90 
91  bool isFunction = (representation.size() > 1);
92  if(representation[0] == 'f') {
93  for(int i = 1; i < representation.size(); i++) {
94  isFunction &= (representation[i] >= '0' && representation[i] <= '9');
95  }
96  }
97  else {
98  isFunction = false;
99  }
100 
101  if(isFunction) {
102  p_operators.push_back(new InfixFunction(representation, 0));
103  return p_operators[p_operators.size()-1];
104  }
105 
106  throw IException(IException::User,
107  "The operator '" + representation + "' is not recognized.",
108  _FILEINFO_);
109  }
110 
111 
112 }; // end namespace Isis
Isis::InfixFunction
InfixOperator and InfixFunction are helper classes for InfixToPostfix.
Definition: InfixToPostfix.h:130
Isis::InfixOperator
InfixOperator and InfixFunction are helper classes for InfixToPostfix.
Definition: InfixToPostfix.h:81
Isis::IException
Isis exception class.
Definition: IException.h:91
std
Namespace for the standard library.
Isis
This is free and unencumbered software released into the public domain.
Definition: Apollo.h:16

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 USGS Astrogeology Discussion Board
To report a bug, or suggest a feature go to: ISIS Github
File Modified: 07/13/2023 15:16:22