Isis 3 Programmer Reference
Kernel.cpp
1 
7 /* SPDX-License-Identifier: CC0-1.0 */
8 
9 #include "Kernel.h"
10 
11 #include <QString>
12 #include <QStringList>
13 
14 using namespace std;
15 namespace Isis {
19  Kernel::Kernel() {
20  m_kernelType = static_cast<Type>(0);
21  m_kernels.clear();
22  }
23 
27  Kernel::~Kernel() {
28  }
29 
37  Kernel::Kernel(Type type, const QStringList &data) {
38  m_kernelType = type;
39  m_kernels = data;
40  }
41 
57  Kernel::Type Kernel::typeEnum(const QString &type) {
58  QString strng = type.simplified().trimmed().toUpper();
59  if (strng == "PREDICTED") return Predicted;
60  if (strng == "NADIR") return Nadir;
61  if (strng == "RECONSTRUCTED") return Reconstructed;
62  if (strng == "SMITHED") return Smithed;
63 
64  return static_cast<Kernel::Type>(0);
65  };
66 
80  const char *Kernel::typeEnum(const Type &type) {
81  if (type == Predicted) return "Predicted";
82  if (type == Nadir) return "Nadir";
83  if (type == Reconstructed) return "Reconstructed";
84  if (type == Smithed) return "Smithed";
85 
86  return "Unknown";
87  };
88 
93  QStringList Kernel::kernels() {
94  return m_kernels;
95  }
96 
101  Kernel::Type Kernel::type() {
102  return m_kernelType;
103  }
104 
109  void Kernel::setKernels(QStringList data) {
110  m_kernels = data;
111  }
112 
117  void Kernel::setType(const Type &type) {
118  m_kernelType = type;
119  }
120 
125  int Kernel::size() {
126  return m_kernels.size();
127  }
128 
133  void Kernel::push_back(const QString &str) {
134  m_kernels.push_back(str);
135  }
136 
144  QString &Kernel::operator[](const int index) {
145  return m_kernels[index];
146  }
147 
156  QString Kernel::operator[](const int index) const {
157  return m_kernels[index];
158  }
159 
168  bool Kernel::operator<(const Kernel &other) const {
169  return (this->m_kernelType < other.m_kernelType);
170  }
171 
172 
182  return static_cast<Kernel::Type>(static_cast<int>(a) | static_cast<int>(b));
183  }
184 } //end namespace isis
QStringList
Isis::operator|
Kernel::Type operator|(Kernel::Type a, Kernel::Type b)
Logical operator for combining Type flags.
Definition: Kernel.cpp:181
Isis::Kernel::Type
Type
Enumeration for type of kernel.
Definition: Kernel.h:41
std
Namespace for the standard library.
Isis::Kernel
This class stores Kernel information, including Type and kernel file names.
Definition: Kernel.h:36
Isis::Kernel::m_kernelType
Type m_kernelType
Enumeration value indicating the kernel type.
Definition: Kernel.h:75
Isis
This is free and unencumbered software released into the public domain.
Definition: Apollo.h:16