USGS

Isis 3.0 Object Programmers' Reference

Home

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;
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