|
Isis 3.0 Object Programmers' Reference |
Home |
00001 #ifndef Blobber_h 00002 #define Blobber_h 00003 00026 #include <string> 00027 #include "tnt_array2d.h" 00028 00029 namespace Isis { 00030 00031 class Cube; 00032 class CubeInfo; 00033 class Table; 00034 00106 class Blobber { 00107 public: 00108 Blobber(); 00109 Blobber(const std::string &blobname, const std::string &fieldname, 00110 const std::string &name = "Blob"); 00111 Blobber(Cube &cube, const std::string &blobname, 00112 const std::string &fieldname, const std::string &name = "Blob"); 00114 virtual ~Blobber() { } 00115 00116 Blobber deepcopy() const; 00117 00127 void setName(const std::string &name) { _name = name; } 00128 00138 void setBlobName(const std::string &bname) { _blobname = bname; } 00139 00148 void setFieldName(const std::string &fname) { _fieldname = fname; } 00149 00154 inline int size() const { return (Lines() * Samples()); } 00155 00160 inline int Lines() const { return (_buf.dim1()); } 00165 inline int Samples() const { return (_buf.dim2()); } 00166 00171 std::string getName() const { return (_name); } 00172 00177 std::string getBlobName() const { return (_blobname); } 00178 00183 std::string getFieldName() const { return (_fieldname); } 00184 00196 inline double *operator[](int i) {return (_buf[i]); } 00209 inline double const *operator[](int i) const { return (_buf[i]); } 00210 00211 // Load options for reading the BLOB from ISIS files 00212 void load(const std::string &filename); 00213 void load(Cube &cube); 00214 00215 00216 protected: 00217 typedef TNT::Array2D<double> BlobBuf; 00218 00224 inline const BlobBuf &ref() const { return (_buf); } 00225 00226 private: 00227 std::string _blobname; 00228 std::string _fieldname; 00229 std::string _name; 00230 BlobBuf _buf; 00231 00232 // Low/level I/O and conversion methods 00233 void loadDouble(Table &tbl); 00234 void loadInteger(Table &tbl); 00235 double int2ToDouble (int value) const; 00236 }; 00237 }; 00238 00239 #endif 00240