Isis 3 Developer Reference
Kernels.h
Go to the documentation of this file.
1 #ifndef Kernels_h
2 #define Kernels_h
3 
27 #include <iostream>
28 #include <string>
29 #include <vector>
30 
31 #include "Camera.h"
32 #include "Cube.h"
33 #include "CollectorMap.h"
34 #include "IException.h"
35 #include "Pvl.h"
36 
37 namespace Isis {
38 
111 class Kernels {
112  public:
114  Kernels();
115  Kernels(const Kernels &kernels);
116  Kernels(const QString &filename);
117  Kernels(Cube &cube);
118  Kernels(Pvl &pvl);
120  virtual ~Kernels() { UnLoad(); }
121 
122  Kernels &operator=(const Kernels &kernels);
123 
125  int size() const { return (_kernels.size()); }
126  int Missing() const;
127 
128  void Init(Pvl &pvl);
129  bool Add(const QString &kfile);
130 
131  void Clear();
132  int Discover();
133 
134  void Manage();
135  void UnManage();
136  bool IsManaged() const;
137 
139 
140  int Load(const QString &ktype);
141  int Load();
142 
143  int UnLoad(const QString &ktype);
144  int UnLoad();
145 
146  int UpdateLoadStatus();
147 
148  int Merge(const Kernels &other);
149 
150  QStringList getKernelTypes() const;
151  QStringList getKernelList(const QString &ktype = "")
152  const;
153  QStringList getLoadedList(const QString &ktypes = "")
154  const;
155  QStringList getMissingList() const;
156 
157 
159  int CameraVersion() const { return (_camVersion); }
160 
161  private:
162  struct KernelFile {
163  QString pathname;
164  QString name;
165  QString fullpath;
166  bool exists;
167  QString ktype;
168  mutable bool loaded;
169  bool managed;
170  };
171 
172  typedef std::vector<KernelFile> KernelList;
173  KernelList _kernels;
174  int _camVersion;
175 
176  typedef std::vector<KernelFile *> KernelFileList;
177  typedef CollectorMap<QString, KernelFileList> TypeList;
178 
179  bool Load(KernelFile &kfile);
180  bool UnLoad(KernelFile &kfile);
181 
182  QStringList getTypes(const QString &ktypes) const;
183  QString resolveType(const QString &kfile) const;
184  QString resolveTypeByExt(const QString &kfile,
185  const QString &iktype = "UNKNOWN") const;
186 
187  bool IsNaifType(const QString &ktype) const;
188  KernelFile examine(const QString &fname, const bool &manage = true)
189  const;
190  int UpdateManagedStatus();
191  std::vector<KernelFile> findKernels(Pvl &pvl, const QString &kname,
192  const bool &manage = true);
193  KernelFile *findByName(const QString &kfile);
194  TypeList categorizeByType() const;
195 
196  void addKernels(const KernelList &klist);
197  QString getKernelType(const QString &kname) const;
198  void loadKernel(const QString &ktype = "");
199  int getCameraVersion(Pvl &pvl) const;
200 
201 };
202 
203 } // namespace Isis
204 #endif
205 
206 
int UnLoad()
Unloads all kernels from the NAIF pool.
Definition: Kernels.cpp:442
Kernels & operator=(const Kernels &kernels)
Copy constructor for existing Kernels objecr.
Definition: Kernels.cpp:93
QStringList getLoadedList(const QString &ktypes="") const
Returns list of kernel currently loaded according to status.
Definition: Kernels.cpp:737
QStringList getKernelList(const QString &ktype="") const
Provide a list of all the kernels found.
Definition: Kernels.cpp:689
void UnManage()
Set each kernels&#39; management state to unmanaged.
Definition: Kernels.cpp:305
void Manage()
Set each kernels management status to managed.
Definition: Kernels.cpp:286
QStringList getKernelTypes() const
Return list of types in kernel list.
Definition: Kernels.cpp:667
Determine SPICE kernels defined in an ISIS file.
Definition: Kernels.h:111
void Clear()
Remove all kernel files from internal list.
Definition: Kernels.cpp:212
bool IsManaged() const
Determine if all kernels are managed by this object.
Definition: Kernels.cpp:325
int Load()
Load all kernels in list.
Definition: Kernels.cpp:422
virtual ~Kernels()
Destructor always unloads the kernels from the pool.
Definition: Kernels.h:120
int Discover()
Determine which NAIF kernels are currently loaded in the pool.
Definition: Kernels.cpp:252
bool Add(const QString &kfile)
Add a new kernel to the list.
Definition: Kernels.cpp:195
int CameraVersion() const
Returns the ISIS camera model version number.
Definition: Kernels.h:159
void InitializeNaifKernelPool()
Initialize the NAIF kernel keeper pool.
Definition: Kernels.cpp:350
Container for cube-like labels.
Definition: Pvl.h:135
QStringList getMissingList() const
Returns list of kernels that were not found to exist.
Definition: Kernels.cpp:769
Namespace for ISIS/Bullet specific routines.
Definition: Apollo.h:31
Kernels()
Default Constructor.
Definition: Kernels.cpp:49
int Missing() const
Return count of missing kernel files.
Definition: Kernels.cpp:137
void Init(Pvl &pvl)
Determine Spice kernels in an ISIS label.
Definition: Kernels.cpp:159
int UpdateLoadStatus()
Determine the load status of all kernels known to this object.
Definition: Kernels.cpp:508
int Merge(const Kernels &other)
Merge the contents of another Kernels object.
Definition: Kernels.cpp:616
int size() const
Returns the number of kernels found and/or loaded.
Definition: Kernels.h:125
IO Handler for Isis Cubes.
Definition: Cube.h:170