USGS

Isis 3.0 Object Programmers' Reference

Home

Blobber.h
Go to the documentation of this file.
1 #ifndef Blobber_h
2 #define Blobber_h
3 
26 #include <QString>
27 
28 #include <tnt/tnt_array2d.h>
29 
30 namespace Isis {
31  class Cube;
32  class Table;
33 
111  class Blobber {
112  public:
113  Blobber();
114  Blobber(const QString &blobname, const QString &fieldname,
115  const QString &name = "Blob");
116  Blobber(Cube &cube, const QString &blobname,
117  const QString &fieldname, const QString &name = "Blob");
119  virtual ~Blobber() { }
120 
121  Blobber deepcopy() const;
122 
132  void setName(const QString &name) {
133  _name = name;
134  }
135 
145  void setBlobName(const QString &bname) {
146  _blobname = bname;
147  }
148 
157  void setFieldName(const QString &fname) {
158  _fieldname = fname;
159  }
160 
165  inline int size() const {
166  return (Lines() * Samples());
167  }
168 
173  inline int Lines() const {
174  return (_buf.dim1());
175  }
180  inline int Samples() const {
181  return (_buf.dim2());
182  }
183 
188  QString getName() const {
189  return (_name);
190  }
191 
196  QString getBlobName() const {
197  return (_blobname);
198  }
199 
204  QString getFieldName() const {
205  return (_fieldname);
206  }
207 
219  inline double *operator[](int i) {
220  return (_buf[i]);
221  }
234  inline double const *operator[](int i) const {
235  return (_buf[i]);
236  }
237 
238 // Load options for reading the BLOB from ISIS files
239  void load(const QString &filename);
240  void load(Cube &cube);
241 
242 
243  protected:
244  typedef TNT::Array2D<double> BlobBuf;
245 
251  inline const BlobBuf &ref() const {
252  return (_buf);
253  }
254 
255  private:
256  QString _blobname;
257  QString _fieldname;
258  QString _name;
260 
261 // Low/level I/O and conversion methods
262  void loadDouble(Table &tbl);
263  void loadInteger(Table &tbl);
264  double int2ToDouble(int value) const;
265  };
266 };
267 
268 #endif
269