Isis 3 Developer Reference
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 
114  class Blobber {
115  public:
116  Blobber();
117  Blobber(const QString &blobname, const QString &fieldname,
118  const QString &name = "Blob");
119  Blobber(Cube &cube, const QString &blobname,
120  const QString &fieldname, const QString &name = "Blob");
122  virtual ~Blobber() { }
123 
124  Blobber deepcopy() const;
125 
135  void setName(const QString &name) {
136  _name = name;
137  }
138 
148  void setBlobName(const QString &bname) {
149  _blobname = bname;
150  }
151 
160  void setFieldName(const QString &fname) {
161  _fieldname = fname;
162  }
163 
168  inline int size() const {
169  return (Lines() * Samples());
170  }
171 
176  inline int Lines() const {
177  return (_buf.dim1());
178  }
183  inline int Samples() const {
184  return (_buf.dim2());
185  }
186 
191  QString getName() const {
192  return (_name);
193  }
194 
199  QString getBlobName() const {
200  return (_blobname);
201  }
202 
207  QString getFieldName() const {
208  return (_fieldname);
209  }
210 
222  inline double *operator[](int i) {
223  return (_buf[i]);
224  }
237  inline double const *operator[](int i) const {
238  return (_buf[i]);
239  }
240 
241 // Load options for reading the BLOB from ISIS files
242  void load(const QString &filename);
243  void load(Cube &cube);
244 
245 
246  protected:
247  typedef TNT::Array2D<double> BlobBuf;
248 
254  inline const BlobBuf &ref() const {
255  return (_buf);
256  }
257 
258  private:
259  QString _blobname;
260  QString _fieldname;
261  QString _name;
262  BlobBuf _buf;
263 
264 // Low/level I/O and conversion methods
265  void loadDouble(Table &tbl);
266  void loadInteger(Table &tbl);
267  double int2ToDouble(unsigned int value) const;
268  double int2ToDouble(int value) const;
269  };
270 };
271 
272 #endif
273 
TNT::Array2D< double > BlobBuf
Internal buffer uses TNT.
Definition: Blobber.h:247
QString getFieldName() const
Retreive the name of the field in the Tabel object BLOB.
Definition: Blobber.h:207
int Samples() const
Number of columns or samples in the BLOB.
Definition: Blobber.h:183
const BlobBuf & ref() const
Returns a const reference to the internal buffer for ease of use to derived objects.
Definition: Blobber.h:254
int size() const
Returns the total number of elements (rows * columns) in blob.
Definition: Blobber.h:168
Base class for accessing ISIS blobs.
Definition: Blobber.h:114
void load(const QString &filename)
Loads the contents of a BLOB from a cube file.
Definition: Blobber.cpp:136
QString getName() const
Returns the name of the BLOB given to refer to this instantiation.
Definition: Blobber.h:191
QString getBlobName() const
Retrieves the name of the Table object.
Definition: Blobber.h:199
Blobber deepcopy() const
Create a unique copy of this blob.
Definition: Blobber.cpp:123
void setName(const QString &name)
Specifies the name of this class instantiation.
Definition: Blobber.h:135
double const * operator[](int i) const
Returns the ith row/line in the BLOB that can be further referenced into samples. ...
Definition: Blobber.h:237
virtual ~Blobber()
Destructor of this object.
Definition: Blobber.h:122
Class for storing Table blobs information.
Definition: Table.h:77
double * operator[](int i)
Returns the ith row/line in the BLOB that can be further referenced into samples. ...
Definition: Blobber.h:222
Namespace for ISIS/Bullet specific routines.
Definition: Apollo.h:31
Blobber()
Default basic constructor that is mostly not useful.
Definition: Blobber.cpp:43
void setFieldName(const QString &fname)
Sets field name in the ISIS BLOB object that contains data.
Definition: Blobber.h:160
int Lines() const
Number of rows or lines in the BLOB.
Definition: Blobber.h:176
void setBlobName(const QString &bname)
Sets the name of the ISIS BLOB object that contains the data.
Definition: Blobber.h:148
IO Handler for Isis Cubes.
Definition: Cube.h:170