Isis 3.0 Object Programmers' Reference
Home
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
ImportPdsTable.h
Go to the documentation of this file.
1
#ifndef ImportPdsTable_h
2
#define ImportPdsTable_h
3
25
#include <QString>
26
#include <QList>
27
#include <QStringList>
28
29
#include <fstream>
30
#include <vector>
31
#include <string>
32
33
class
QString;
34
35
namespace
Isis {
36
class
Table;
37
class
TableField;
38
class
TableRecord;
39
class
PvlObject;
114
class
ImportPdsTable
{
115
public
:
116
ImportPdsTable
();
117
ImportPdsTable
(
const
QString &pdsLabFile,
118
const
QString &pdsTabFile=
""
,
119
const
QString &pdsTableName =
"TABLE"
);
120
virtual
~ImportPdsTable
();
121
122
QString
name
()
const
;
123
void
setName
(
const
QString &name =
"TABLE"
);
124
125
int
columns
()
const
;
126
int
rows
()
const
;
127
128
void
load
(
const
QString &pdsLabFile,
const
QString &pdsTabFile =
""
,
129
const
QString &pdsTableName =
"TABLE"
);
130
131
bool
hasColumn
(
const
QString &colName)
const
;
132
QString
getColumnName
(
const
unsigned
int
&index = 0,
133
const
bool
&formatted =
true
)
const
;
134
QStringList
getColumnNames
(
const
bool
&formatted =
true
)
const
;
135
QString
getFormattedName
(
const
QString &colname)
const
;
136
137
QString
getType
(
const
QString &colName)
const
;
138
bool
setType
(
const
QString &colName,
const
QString &dataType);
139
140
Table
importTable
(
const
QString &isisTableName);
141
Table
importTable
(
const
QString &colNames,
142
const
QString &isisTableName);
143
Table
importTable
(
const
QStringList
&colNames,
144
const
QString &isisTableName);
145
146
147
protected
:
148
struct
ColumnDescr
{
149
QString
m_name
;
150
int
m_colnum
;
151
QString
m_dataType
;
152
int
m_startByte
;
153
int
m_numBytes
;
154
int
m_itemBytes
;
155
int
m_items
;
156
};
157
158
// Internal types
159
typedef
QList<ColumnDescr>
ColumnTypes;
160
typedef
QStringList
Columns
;
161
typedef
QList<Columns>
Rows;
162
163
const
ColumnDescr
&
getColumnDescriptor
(
const
int
&nth)
const
;
164
ColumnDescr
*
findColumn
(
const
QString &colName);
165
const
ColumnDescr
*
findColumn
(
const
QString &colName)
const
;
166
167
168
QString
getColumnValue
(
const
QString &tline,
169
const
ColumnDescr
&cdesc,
170
const
QString &delimiter =
""
)
const
;
171
QStringList
getColumnFields
(
const
QString &tline,
172
const
ColumnDescr
&cdesc,
173
const
QString &delimiter =
""
)
const
;
174
175
176
QString
getGenericType
(
const
QString &ttype)
const
;
177
178
virtual
bool
processRow
(
const
int
&row,
const
QString &rowdata);
179
180
181
private
:
182
void
init
();
183
184
void
loadLabel
(
const
QString &labfile, QString &tblfile,
185
const
QString &tblname =
""
);
186
void
loadTable
(
const
QString &tabfile);
187
188
ColumnDescr
getColumnDescription
(
PvlObject
&colobj,
int
nth)
const
;
189
190
TableRecord
makeRecord
(
const
ColumnTypes &ctypes);
191
TableField
makeField
(
const
ColumnDescr
&cdesc);
192
TableField
makeFieldFromBinaryTable
(
const
ColumnDescr
&cdesc);
193
void
setPdsByteOrder
(QString byteOrder);
194
195
TableField
&
extract
(
const
Columns
&columns,
const
ColumnDescr
&cdesc,
196
TableField
&field)
const
;
197
TableRecord
&
extract
(
const
Columns
&columns,
const
ColumnTypes &ctypes,
198
TableRecord
&record)
const
;
199
TableRecord
extractBinary
(
char
*rowBuffer,
TableRecord
&record)
const
;
200
201
void
fillTable
(
Table
&table,
const
ColumnTypes &columns,
202
TableRecord
&record)
const
;
203
204
//private instance variables
205
int
m_trows
;
206
ColumnTypes
m_coldesc
;
207
Rows
m_rows
;
208
QString
m_pdsTableType
;
209
int
m_rowBytes
;
210
int
m_recordBytes
;
211
QString
m_tableName
;
212
QString
m_pdsTableFile
;
213
int
m_pdsTableStart
;
214
QString
m_byteOrder
;
216
};
217
218
}
219
#endif
220