43 TrackingTable::TrackingTable() {
54 TrackingTable::TrackingTable(
Table table) {
56 for (
int i=0; i < table.
Records(); i++) {
58 QString nameField = QString(record[
"FileName"]).split(
"/").last();
59 QString extension(
FileName(nameField).extension());
60 int found = nameField.lastIndexOf(extension);
63 nameField.remove(found + 3);
66 QString serialNumber = QString(record[
"SerialNumber"]);
75 TrackingTable::~TrackingTable() {
85 Table TrackingTable::toTable() {
91 for (
int i=0; i < m_fileList.size(); i++) {
92 if (m_fileList[i].first.name().length() > fieldLength) {
93 fieldLength = m_fileList[i].first.name().length();
95 if (m_fileList[i].second.length() > fieldLength) {
96 fieldLength = m_fileList[i].second.length();
102 TableField fileNameField(
"FileName", TableField::Text, fieldLength);
103 TableField serialNumberField(
"SerialNumber", TableField::Text, fieldLength);
104 TableField indexField(
"PixelValue", TableField::Integer);
105 dummyRecord += fileNameField;
106 dummyRecord += serialNumberField;
107 dummyRecord += indexField;
108 Table table(trackingTableName, dummyRecord);
111 for (
int i=0; i < m_fileList.size(); i++) {
113 fileNameField = m_fileList[i].first.
name();
114 serialNumberField = m_fileList[i].second;
115 indexField = (int) (i + VALID_MINUI4);
118 record += fileNameField;
119 record += serialNumberField;
120 record += indexField;
136 FileName TrackingTable::pixelToFileName(
unsigned int pixel) {
137 if (pixel < VALID_MINUI4) {
138 QString msg =
"Cannot convert pixel [" +
toString(pixel)
139 +
"] to a filename, pixel is below valid minimum [" 144 unsigned int index = pixel - VALID_MINUI4;
145 if (index >= (
unsigned int)m_fileList.size()) {
146 QString msg =
"Cannot convert pixel [" +
toString(pixel)
147 +
"] to a filename, pixel is above valid maximum [" 148 +
toString(VALID_MINUI4 + m_fileList.size()) +
"].";
152 return m_fileList[index].first;
166 unsigned int TrackingTable::fileNameToPixel(
FileName file, QString serialNumber) {
167 for (
int i = 0; i < m_fileList.size(); i++) {
168 if (QString::compare(m_fileList[i].first.toString(), file.
name()) == 0) {
169 return i + VALID_MINUI4;
176 return m_fileList.size() - 1 + VALID_MINUI4;
186 QString TrackingTable::pixelToSN(
unsigned int pixel) {
187 if (pixel < VALID_MINUI4) {
188 QString msg =
"Cannot convert pixel [" +
toString(pixel)
189 +
"] to a serial number, pixel is below valid minimum [" 194 unsigned int index = pixel - VALID_MINUI4;
195 if (index >= (
unsigned int)m_fileList.size()) {
196 QString msg =
"Cannot convert pixel [" +
toString(pixel)
197 +
"] to a serial number, pixel is above valid maximum [" 198 +
toString(VALID_MINUI4 + m_fileList.size()) +
"].";
202 return m_fileList[index].second;
216 int TrackingTable::fileNameToIndex(
FileName file, QString serialNumber) {
217 for (
int i = 0; i < m_fileList.size(); i++) {
218 if (m_fileList[i].first == file) {
226 return m_fileList.size() - 1;
int Records() const
Returns the number of records.
File name manipulation and expansion.
Namespace for the standard library.
QString name() const
Returns the name of the file excluding the path and the attributes in the file name.
QString toString(bool boolToConvert)
Global function to convert a boolean to a string.
#define _FILEINFO_
Macro for the filename and line number.
QString name() const
Returns the name of the TableField.
Class for storing Table blobs information.
Namespace for ISIS/Bullet specific routines.
Class for storing an Isis::Table's field information.