本文整理汇总了C++中Table::Records方法的典型用法代码示例。如果您正苦于以下问题:C++ Table::Records方法的具体用法?C++ Table::Records怎么用?C++ Table::Records使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Table
的用法示例。
在下文中一共展示了Table::Records方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: loadInteger
/**
* @brief Provides direct reading in of the field data from the BLOB
*
* This method is called when the data stored in the BLOB is integer data.
* It determines the number of rows (lines) and columns (samples) in the BLOB
* and allocates the internal buffer required to store it. This differs from
* the double precision version only in the care taken when casting the data
* to double precision. We must properly convert special pixels from integer
* to double precision.
*
* @param [in] tbl (Table&) Reference to an ISIS Table object that contains the
* field from which to extract the data.
*/
void Blobber::loadInteger(Table &tbl) {
int nlines = tbl.Records();
int nsamps = tbl[0][getFieldName()].Size();
BlobBuf pixels(nlines, nsamps);
for (int i = 0 ; i < nlines ; i++) {
vector<int> d = tbl[i][getFieldName()];
for (unsigned int j = 0 ; j < d.size(); j++) {
pixels[i][j] = int2ToDouble(d[j]);
}
}
_buf = pixels;
}
示例2: main
int main(int argc, char *argv[]) {
Isis::Preference::Preferences(true);
QString inputFile = "data/VIR_IR_1A_1_332974737_1_HK.LBL";
if (--argc == 1) { inputFile = argv[1]; }
cout << "\n\nTesting ImportPdsTable class using file " << inputFile << "\n";
ImportPdsTable myTable(inputFile);
cout << "\n\nList of Columns found - Total: " << myTable.columns() << "\n";
QStringList kfiles = myTable.getColumnNames();
cout << kfiles.join("\n");
cout << "\n\nNow without Name Conversion: \n";
kfiles = myTable.getColumnNames(false);
cout << kfiles.join("\n") << endl;
// Update/correct column types
myTable.setType("ShutterStatus", "CHARACTER");
myTable.setType("ChannelId", "CHARACTER");
myTable.setType("CompressionMode", "CHARACTER");
myTable.setType("SpectralRange", "CHARACTER");
myTable.setType("CurrentMode", "CHARACTER");
myTable.setType("SubCurrentMode", "CHARACTER");
myTable.setType("IrExpo", "DOUBLE");
myTable.setType("IrTemp", "DOUBLE");
myTable.setType("CcdExpo", "DOUBLE");
myTable.setType("CcdTemp", "DOUBLE");
myTable.setType("MirrorSin", "DOUBLE");
myTable.setType("Mirror", "DOUBLE");
myTable.setType("SpectTemp", "DOUBLE");
myTable.setType("TeleTemp", "DOUBLE");
myTable.setType("COLD TIP TEMP", "DOUBLE");
myTable.setType("RADIATOR TEMP", "DOUBLE");
myTable.setType("SU MOTOR CURR", "DOUBLE");
myTable.setType("LEDGE TEMP", "DOUBLE");
myTable.setType("FRAME COUNT", "CHARACTER");
// Create a table from the input
cout << "Getting ISIS Table...\n";
Table newTable = myTable.importTable("VIR_DATA");
for (int i = 0; i < newTable[0].Fields(); i++) {
cout << newTable[0][i].name() << "\t";
}
cout << endl;
// this test was commented out since the output is not what was expected.
// See mantis ticket
//
//??? Table newTable2 = myTable.importTable("Apid,PacketsLength", "VIR_DATA_2");
//??? for (int i = 0; i < newTable2[0].Fields(); i++) {
//??? cout << newTable[0][i].name() << "\t";
//??? }
//??? cout << endl;//??? add mantis ticket -- appears to be failing
//???
//??? vector<string> cols;
//??? cols.push_back("Apid");
//??? cols.push_back("PacketsLength");
//??? Table newTable3 = myTable.importTable(cols, "VIR_DATA_2");
//??? for (int i = 0; i < newTable3[0].Fields(); i++) {
//??? cout << newTable[0][i].name() << "\t";
//??? }
//??? cout << endl;
// The following tests were added when the class was expanded to import binary
// PDS tables also...
QString pdsTableDir = "data/";
QString pdsLabelFile = "";
QString pdsTableFile = "";
cout << "\n\n\nImport PDS table from PDS table exported as MSB...\n";
pdsLabelFile = pdsTableDir + "msb_pds_binary_table.lbl";
// TEST: Read the table file name from the labels
ImportPdsTable pdsMsbTable(pdsLabelFile, pdsTableFile, "EXPORTED_ISIS_TABLE");
// Table isisTableFromMsb = pdsMsbTable.importFromBinaryPds();
Table isisTableFromMsb = pdsMsbTable.importTable("ReimportedMSB");
// print the table
cout << isisTableFromMsb.Name() << endl;
cout << isisTableFromMsb[0][0].name() << "\t";
cout << isisTableFromMsb[0][1].name() << "\t";
cout << isisTableFromMsb[0][2].name() << "\t";
cout << isisTableFromMsb[0][3].name() << "\n";
for (int i = 0; i < isisTableFromMsb.Records(); i++) {
cout << toString((double) isisTableFromMsb[i][0]) << "\t\t\t";
cout << toString((int) isisTableFromMsb[i][1]) << "\t\t\t\t";
cout << QString( isisTableFromMsb[i][2]) << "\t\t\t";
cout << toString((float) isisTableFromMsb[i][3]) << "\n";
}
cout << "\n\n\nImport PDS table from PDS table exported as LSB...\n";
pdsLabelFile = pdsTableDir + "lsb_pds_binary_table.lbl";
pdsTableFile = pdsTableDir + "lsb_pds_binary_table.dat";
// TEST: Use default constructor and load() method - default table name is TABLE
// The next 2 lines are equivalent to calling
// ImportPdsTable pdsLsbTable(pdsLabelFile, pdsTableFile, "TABLE");
ImportPdsTable pdsLsbTable;
pdsLsbTable.load(pdsLabelFile, pdsTableFile);
// Table isisTableFromLsb = pdsLsbTable.importFromBinaryPds();
Table isisTableFromLsb = pdsLsbTable.importTable("ReimportedLSB");
// print the table
//.........这里部分代码省略.........