Isis 3 Programmer Reference
Isis::ExportPdsTable Class Reference

Export a PDS table from an ISIS Table. More...

#include <ExportPdsTable.h>

Collaboration diagram for Isis::ExportPdsTable:
Collaboration graph

Public Member Functions

 ExportPdsTable (Table isisTable)
 Construct an ExportPdsTable object and set default member variable values. More...
 
 ~ExportPdsTable ()
 Destructs for ExportPdsTable objects. More...
 
PvlObject exportTable (char *pdsTableBuffer, int pdsFileRecordBytes, QString pdsByteOrder)
 This methods fills the given buffer with the binary PDS table data and returns label information. More...
 
QString formatPdsTableName ()
 Format the PDS table object name using the ISIS table name. More...
 

Static Public Member Functions

static QString formatPdsTableName (QString isisTableName)
 Static method that formats the given ISIS table name in PDS format. More...
 

Private Member Functions

void Pack (TableRecord record, char *buffer, EndianSwapper *endianSwap)
 Pack the buffer with data from the table record, swapping bytes if needed. More...
 
PvlObject fillMetaData ()
 Creates a PvlObject to be added to the PDS label with needed TABLE information. More...
 

Private Attributes

Tablem_isisTable
 Input ISIS Table object to be exported. More...
 
int m_numRows
 The number of rows in the exported PDS table. More...
 
int m_outputRecordBytes
 The number of bytes per record in the exported PDS file. More...
 
int m_rowBytes
 The number of bytes per row in the exported PDS table. More...
 
QString m_pdsByteOrder
 A string indicating the byte order of the exported PDS file. More...
 

Detailed Description

Export a PDS table from an ISIS Table.

This class ingests an ISIS Table and converts it to a PDS Table.

NOTE: This class exports BINARY format PDS tables. The PDS Standards Reference document indicates that for files containing multiple tables with binary data, the records should be FIXED_LENGTH (not STREAM) and that this value should be the length of the longest record in the file (Appendix A, PDS Standards, last updated February 27, 2009). This document also indicates that all table rows that are less than the fixed record length value should be padded (ususally with nulls).

See also
http://pds.nasa.gov/standards-reference.shtml
http://pds.nasa.gov/documents/sr/AppendixA.pdf
ExportPdsTable pdsTable(isisTable);
pdsTable.exportToPds(buffer, recordBytes, "LSB");
Author
2012-07-21 Jeannie Backer
History:
2012-11-21 Original Version. References #678.
Todo:
This class is currently only exporting BINARY format PDS tables. Implementation may be added later to export ASCII PDS tables.

Definition at line 52 of file ExportPdsTable.h.

Constructor & Destructor Documentation

◆ ExportPdsTable()

Isis::ExportPdsTable::ExportPdsTable ( Table  isisTable)

Construct an ExportPdsTable object and set default member variable values.

This constructor sets the following defaults:

  • BYTEORDER = "LSB"
  • ROWS = Records
  • ROW_BYTES = RecordSize
Parameters
isisTableThe ISIS Table object to be exported.

Definition at line 38 of file ExportPdsTable.cpp.

References Isis::Table::Records().

◆ ~ExportPdsTable()

Isis::ExportPdsTable::~ExportPdsTable ( )

Destructs for ExportPdsTable objects.

Definition at line 51 of file ExportPdsTable.cpp.

Member Function Documentation

◆ exportTable()

PvlObject Isis::ExportPdsTable::exportTable ( char *  pdsTableBuffer,
int  outputFileRecordBytes,
QString  pdsTableByteOrder 
)

This methods fills the given buffer with the binary PDS table data and returns label information.

Parameters
pdsTableBufferThis buffer will be filled with binary PDS table data.
pdsFileRecordBytesThe number or RECORD_BYTES in the PDS file.
pdsByteOrderA string containing the byte order of the PDS file. Valid values are "LSB" or "MSB".
Returns
PvlObject A Pvl containing the PDS table's label information.

Definition at line 67 of file ExportPdsTable.cpp.

References Isis::TableRecord::RecordSize(), and Isis::toString().

Referenced by Isis::ProcessExportPds::ExportTable().

◆ fillMetaData()

PvlObject Isis::ExportPdsTable::fillMetaData ( )
private

Creates a PvlObject to be added to the PDS label with needed TABLE information.

Returns
PvlObject containing PDS Table metadata.

Definition at line 125 of file ExportPdsTable.cpp.

References Isis::PvlContainer::addKeyword(), Isis::PvlObject::addObject(), Isis::TableField::name(), Isis::TableField::size(), Isis::toString(), and Isis::TableField::type().

◆ formatPdsTableName() [1/2]

QString Isis::ExportPdsTable::formatPdsTableName ( )

Format the PDS table object name using the ISIS table name.

Returns
QString containing the formatted PDS table name.

Definition at line 205 of file ExportPdsTable.cpp.

Referenced by Isis::ProcessExportPds::ExportTable().

◆ formatPdsTableName() [2/2]

QString Isis::ExportPdsTable::formatPdsTableName ( QString  isisTableName)
static

Static method that formats the given ISIS table name in PDS format.

This method takes the upper camel case Isis table name and returns a PDS table name that is underscore separated, all upper case and with "_TABLE" appended to the end of the name, if not already present.

Parameters
isisTableNameAn QString containing the ISIS upper camel case table name.
Returns
QString containing the formatted PDS table name.

Definition at line 219 of file ExportPdsTable.cpp.

◆ Pack()

void Isis::ExportPdsTable::Pack ( TableRecord  record,
char *  buffer,
EndianSwapper endianSwap 
)
private

Pack the buffer with data from the table record, swapping bytes if needed.

Parameters
recordISIS TableRecord to be exported
bufferOutput buffer to be filled with PDS table row data in the appropriate byte order.
endianSwapPointer to EndianSwapper object to swap bytes if the input Isis Table byte order is not the same as the output PDS byte order.

Definition at line 249 of file ExportPdsTable.cpp.

References Isis::EndianSwapper::Double(), Isis::TableRecord::Fields(), Isis::EndianSwapper::Float(), Isis::EndianSwapper::Int(), Isis::TableField::isDouble(), Isis::TableField::isInteger(), Isis::TableField::isReal(), Isis::TableField::isText(), Isis::TableField::name(), and Isis::TableField::size().

Member Data Documentation

◆ m_isisTable

Table* Isis::ExportPdsTable::m_isisTable
private

Input ISIS Table object to be exported.

Definition at line 63 of file ExportPdsTable.h.

◆ m_numRows

int Isis::ExportPdsTable::m_numRows
private

The number of rows in the exported PDS table.

This value is the same as the number of records the ISIS Table.

Definition at line 64 of file ExportPdsTable.h.

◆ m_outputRecordBytes

int Isis::ExportPdsTable::m_outputRecordBytes
private

The number of bytes per record in the exported PDS file.

Definition at line 67 of file ExportPdsTable.h.

◆ m_pdsByteOrder

QString Isis::ExportPdsTable::m_pdsByteOrder
private

A string indicating the byte order of the exported PDS file.

Definition at line 73 of file ExportPdsTable.h.

◆ m_rowBytes

int Isis::ExportPdsTable::m_rowBytes
private

The number of bytes per row in the exported PDS table.

This value is the same as the RecordSize (number of bytes per record) of the ISIS Table.

Definition at line 69 of file ExportPdsTable.h.


The documentation for this class was generated from the following files:
Isis::ExportPdsTable::ExportPdsTable
ExportPdsTable(Table isisTable)
Construct an ExportPdsTable object and set default member variable values.
Definition: ExportPdsTable.cpp:38