USGS

Isis 3.0 Object Programmers' Reference

Home

Table.h
Go to the documentation of this file.
1 #ifndef Table_h
2 #define Table_h
3 
25 #include "Blob.h"
26 #include <vector>
27 #include "TableRecord.h"
28 
29 namespace Isis {
30  class Pvl;
77  class Table : public Isis::Blob {
78  public:
82  enum Association {
83  None,
84  Samples,
85  Lines,
86  Bands
87  };
88 
89  // Constructors and Destructors
90  Table(const QString &tableName, TableRecord &rec);
91  Table(const QString &tableName);// Only use this constructor for reading in an existing table
92  Table(const QString &tableName, const QString &file);
93  Table(const QString &tableName, const QString &file,
94  const Pvl &fileHeader);
95  Table(const Table &other);
96  Table &operator=(const Isis::Table &other);
97 
98  ~Table();
99 
100  void SetAssociation(const Table::Association assoc);
101  bool IsSampleAssociated();
102  bool IsLineAssociated();
103  bool IsBandAssociated();
104 
105  int Records() const;
106  int RecordFields() const;
107  int RecordSize() const;
108 
109  // Read a record
110  TableRecord &operator[](const int index);
111 
112  // Add a record
113  void operator+=(TableRecord &rec);
114 
115  // Update a record
116  void Update(const TableRecord &rec, const int index);
117 
118  // Delete a record
119  void Delete(const int index);
120 
121  void Clear();
122 
123 
124  protected:
125  void ReadInit();
126  void ReadData(std::istream &stream);
127  void WriteInit();
128  void WriteData(std::fstream &os);
129 
131  std::vector<char *> p_recbufs;
132 
133  int p_records;
136  Association p_assoc;
137  bool p_swap;
138  };
139 };
140 
141 #endif
142