Isis Developer Reference
Kernels.h
Go to the documentation of this file.
1#ifndef Kernels_h
2#define Kernels_h
8/* SPDX-License-Identifier: CC0-1.0 */
9
10#include <iostream>
11#include <string>
12#include <vector>
13
14#include "Camera.h"
15#include "Cube.h"
16#include "CollectorMap.h"
17#include "IException.h"
18#include "Pvl.h"
19
20namespace Isis {
21
94class Kernels {
95 public:
97 Kernels();
98 Kernels(const Kernels &kernels);
99 Kernels(const QString &filename);
100 Kernels(Cube &cube);
101 Kernels(Pvl &pvl);
103 virtual ~Kernels() { UnLoad(); }
104
105 Kernels &operator=(const Kernels &kernels);
106
108 int size() const { return (_kernels.size()); }
109 int Missing() const;
110
111 void Init(Pvl &pvl);
112 bool Add(const QString &kfile);
113
114 void Clear();
115 int Discover();
116
117 void Manage();
118 void UnManage();
119 bool IsManaged() const;
120
122
123 int Load(const QString &ktype);
124 int Load();
125
126 int UnLoad(const QString &ktype);
127 int UnLoad();
128
129 int UpdateLoadStatus();
130
131 int Merge(const Kernels &other);
132
134 QStringList getKernelList(const QString &ktype = "")
135 const;
136 QStringList getLoadedList(const QString &ktypes = "")
137 const;
139
140
142 int CameraVersion() const { return (_camVersion); }
143
144 private:
145 struct KernelFile {
146 QString pathname;
147 QString name;
148 QString fullpath;
149 bool exists;
150 QString ktype;
151 mutable bool loaded;
152 bool managed;
153 };
154
155 typedef std::vector<KernelFile> KernelList;
156 KernelList _kernels;
157 int _camVersion;
158
159 typedef std::vector<KernelFile *> KernelFileList;
160 typedef CollectorMap<QString, KernelFileList> TypeList;
161
162 bool Load(KernelFile &kfile);
163 bool UnLoad(KernelFile &kfile);
164
165 QStringList getTypes(const QString &ktypes) const;
166 QString resolveType(const QString &kfile) const;
167 QString resolveTypeByExt(const QString &kfile,
168 const QString &iktype = "UNKNOWN") const;
169
170 bool IsNaifType(const QString &ktype) const;
171 KernelFile examine(const QString &fname, const bool &manage = true)
172 const;
173 int UpdateManagedStatus();
174 std::vector<KernelFile> findKernels(Pvl &pvl, const QString &kname,
175 const bool &manage = true);
176 KernelFile *findByName(const QString &kfile);
177 TypeList categorizeByType() const;
178
179 void addKernels(const KernelList &klist);
180 QString getKernelType(const QString &kname) const;
181 void loadKernel(const QString &ktype = "");
182 int getCameraVersion(Pvl &pvl) const;
183
184};
185
186} // namespace Isis
187#endif
188
189
IO Handler for Isis Cubes.
Definition Cube.h:168
Determine SPICE kernels defined in an ISIS file.
Definition Kernels.h:94
int CameraVersion() const
Returns the ISIS camera model version number.
Definition Kernels.h:142
void InitializeNaifKernelPool()
Initialize the NAIF kernel keeper pool.
Definition Kernels.cpp:333
bool Add(const QString &kfile)
Add a new kernel to the list.
Definition Kernels.cpp:178
void Manage()
Set each kernels management status to managed.
Definition Kernels.cpp:269
int Discover()
Determine which NAIF kernels are currently loaded in the pool.
Definition Kernels.cpp:235
int UpdateLoadStatus()
Determine the load status of all kernels known to this object.
Definition Kernels.cpp:491
void Init(Pvl &pvl)
Determine Spice kernels in an ISIS label.
Definition Kernels.cpp:142
Kernels()
Default Constructor.
Definition Kernels.cpp:32
QStringList getKernelList(const QString &ktype="") const
Provide a list of all the kernels found.
Definition Kernels.cpp:672
void Clear()
Remove all kernel files from internal list.
Definition Kernels.cpp:195
QStringList getLoadedList(const QString &ktypes="") const
Returns list of kernel currently loaded according to status.
Definition Kernels.cpp:720
int Missing() const
Return count of missing kernel files.
Definition Kernels.cpp:120
virtual ~Kernels()
Destructor always unloads the kernels from the pool.
Definition Kernels.h:103
int size() const
Returns the number of kernels found and/or loaded.
Definition Kernels.h:108
bool IsManaged() const
Determine if all kernels are managed by this object.
Definition Kernels.cpp:308
int UnLoad()
Unloads all kernels from the NAIF pool.
Definition Kernels.cpp:425
QStringList getMissingList() const
Returns list of kernels that were not found to exist.
Definition Kernels.cpp:752
int Merge(const Kernels &other)
Merge the contents of another Kernels object.
Definition Kernels.cpp:599
int Load()
Load all kernels in list.
Definition Kernels.cpp:405
QStringList getKernelTypes() const
Return list of types in kernel list.
Definition Kernels.cpp:650
Kernels & operator=(const Kernels &kernels)
Copy constructor for existing Kernels objecr.
Definition Kernels.cpp:76
void UnManage()
Set each kernels' management state to unmanaged.
Definition Kernels.cpp:288
Container for cube-like labels.
Definition Pvl.h:119
This is free and unencumbered software released into the public domain.
Definition Apollo.h:16