Isis 3.0 Object Programmers' Reference |
Home |
Class for storing Table blobs information. More...
#include <Table.h>
Public Types | |
enum | Association { None, Samples, Lines, Bands } |
Public Member Functions | |
Table (const QString &tableName, TableRecord &rec) | |
This constructor creates a new table using the given name and record. | |
Table (const QString &tableName) | |
This constructor creates an empty table from an existing table name to be read in when the Read() method is called. | |
Table (const QString &tableName, const QString &file) | |
This constructor reads an existing table using the given table name and file containing the table. | |
Table (const QString &tableName, const QString &file, const Pvl &fileHeader) | |
This constructor reads an existing table using the given table name and file containing the table and pvl labels. | |
Table (const Table &other) | |
Copy constructor for an Table object. | |
Table & | operator= (const Isis::Table &other) |
Sets the Table equal to the input Table object. | |
~Table () | |
Destroys the Table object. | |
void | SetAssociation (const Table::Association assoc) |
Sets the association to the input parameter. | |
bool | IsSampleAssociated () |
Checks to see if association is Samples. | |
bool | IsLineAssociated () |
Checks to see if association is Lines. | |
bool | IsBandAssociated () |
Checks to see if association is Bands. | |
int | Records () const |
Returns the number of records. | |
int | RecordFields () const |
Returns the number of fields per record. | |
int | RecordSize () const |
Returns the number of bytes per record. | |
TableRecord & | operator[] (const int index) |
Reads a TableRecord from the Table. | |
void | operator+= (TableRecord &rec) |
Adds a TableRecord to the Table. | |
void | Update (const TableRecord &rec, const int index) |
Updates a TableRecord. | |
void | Delete (const int index) |
Deletes a TableRecord from the Table. | |
void | Clear () |
Clear the table of all records. | |
QString | Type () const |
Accessor method that returns a string containing the Blob type. | |
QString | Name () const |
Accessor method that returns a string containing the Blob name. | |
int | Size () const |
Accessor method that returns the number of bytes in the blob data. | |
PvlObject & | Label () |
Accessor method that returns a PvlObject containing the Blob label. | |
void | Read (const QString &file) |
This method reads Pvl values from a specified file. | |
void | Read (const QString &file, const Pvl &pvlLabels) |
This method reads the given a file and labels. | |
virtual void | Read (const Pvl &pvl, std::istream &is) |
This method reads the Blob data from an open input file stream. | |
void | Write (const QString &file) |
Write the blob data out to a file. | |
void | Write (Pvl &pvl, std::fstream &stm, const QString &detachedFileName="") |
Write the blob data out to a Pvl object. | |
Protected Member Functions | |
void | ReadInit () |
Virtual function to validate PVL table information. | |
void | ReadData (std::istream &stream) |
Virtual function to Read the data. | |
void | WriteInit () |
Virtual Function to prepare labels for writing. | |
void | WriteData (std::fstream &os) |
Virtual function to write the data. | |
void | Find (const Pvl &pvl) |
This method searches the given Pvl for the Blob by the Blob's type and name. | |
Protected Attributes | |
TableRecord | p_record |
The current table record. | |
std::vector< char * > | p_recbufs |
Buffers containing record values. | |
int | p_records |
Holds record count read from labels, may differ from the size of p_recbufs. | |
Association | p_assoc |
Association Type of the table. | |
bool | p_swap |
Only used for reading. | |
PvlObject | p_blobPvl |
Pvl Blob object. | |
QString | p_blobName |
Name of the Blob object. | |
char * | p_buffer |
Buffer blob data is stored in. | |
BigInt | p_startByte |
Byte blob data starts at in buffer. | |
int | p_nbytes |
Size of blob data (in bytes) | |
QString | p_type |
Type of data stored in the buffer. | |
QString | p_detached |
Used for reading detached blobs. | |
QString | p_labelFile |
The file containing the labels. |
Class for storing Table blobs information.
This class can create new Tables or read table blobs from files. In general, records correspond to rows and fields correspond to columns. Thus the TableRecord class corresponds to a vector of row entries and TableField class corresponds to a specific entry of the table for a given record. Isis3 Table objects are record based, N records in a table. Each record will have the same number of fields, F. The fields can be of different types including Integer, Double, Text, and Real. The class uses PVL to store the structure of the table N, F, and Field types and binary to store the table data.
See the classes TableRecord and TableField for more information.
If you would like to see Table being used in implementation, see histats.cpp
Isis::Table::Table | ( | const QString & | tableName, |
Isis::TableRecord & | rec | ||
) |
This constructor creates a new table using the given name and record.
The Table::Association is set to None, the ByteOrder keyword in the labels is set to NULL, and the record information is added to the table.
This constructor also calls the parent constructor Blob(tableName, "Table").
tableName | Name of the Table to be read |
rec | Name of the TableRecord to be read into the Table |
Definition at line 47 of file Table.cpp.
References Isis::PvlObject::AddGroup(), Isis::TableRecord::Fields(), p_assoc, Isis::Blob::p_blobPvl, and p_record.
Isis::Table::Table | ( | const QString & | tableName | ) |
This constructor creates an empty table from an existing table name to be read in when the Read() method is called.
It should not be used to construct a new table object whose data will be filled in later since the record size will be set to 0. This constructor sets the Table::Association to None.
This constructor also calls the parent constructor Blob(tableName, "Table").
tableName | Name of the Table to be read |
Definition at line 68 of file Table.cpp.
References p_assoc.
Isis::Table::Table | ( | const QString & | tableName, |
const QString & | file | ||
) |
This constructor reads an existing table using the given table name and file containing the table.
This constructor sets the Table::Association to the Association keyword value in the Blob Pvl read from the file, if the keyword exists.
This constructor also calls the parent constructor Blob(tableName, "Table").
Definition at line 87 of file Table.cpp.
References p_assoc, and Isis::Blob::Read().
Isis::Table::Table | ( | const QString & | tableName, |
const QString & | file, | ||
const Pvl & | fileHeader | ||
) |
This constructor reads an existing table using the given table name and file containing the table and pvl labels.
This constructor sets the Table::Association to the Association keyword value in the Blob Pvl read from the file, if the keyword exists.
This constructor also calls the parent constructor Blob(tableName, "Table").
tableName | The name of the Table to be read |
file | The name of the file to be read into the Table |
fileHeader | Pvl labels. |
Definition at line 108 of file Table.cpp.
References p_assoc, and Isis::Blob::Read().
Isis::Table::Table | ( | const Table & | other | ) |
Copy constructor for an Table object.
This constructor copies TableRecords and the member variable values for record, records, assoc, and swap.
other | The table to copy from |
Definition at line 121 of file Table.cpp.
References p_assoc, p_recbufs, p_record, p_records, p_swap, and RecordSize().
Isis::Table::~Table | ( | ) |
void Isis::Table::Clear | ( | ) |
Clear the table of all records.
Definition at line 312 of file Table.cpp.
References p_recbufs.
Referenced by ReadInit(), and ~Table().
void Isis::Table::Delete | ( | const int | index | ) |
Deletes a TableRecord from the Table.
index | Index of TableRecord to be deleted |
Definition at line 302 of file Table.cpp.
References p_recbufs.
void Isis::Blob::Find | ( | const Pvl & | pvl | ) | [protected, inherited] |
This method searches the given Pvl for the Blob by the Blob's type and name.
If found, the start byte, number of bytes are read from the Pvl. Also, if a keyword label pointer is found, the filename for the detached blob is stored and the pointer is removed from the blob pvl.
pvl | The Pvl to be searched |
Definition at line 179 of file Blob.cpp.
References _FILEINFO_, Isis::PvlContainer::IsNamed(), Isis::PvlObject::Object(), Isis::PvlObject::Objects(), and Isis::FileName::path().
bool Isis::Table::IsBandAssociated | ( | ) |
bool Isis::Table::IsLineAssociated | ( | ) |
bool Isis::Table::IsSampleAssociated | ( | ) |
PvlObject & Isis::Blob::Label | ( | ) | [inherited] |
Accessor method that returns a PvlObject containing the Blob label.
Definition at line 167 of file Blob.cpp.
Referenced by Isis::SpicePosition::CacheLabel(), Isis::DawnVirCamera::getPointingTable(), and Isis::SpicePosition::LoadCache().
QString Isis::Blob::Name | ( | ) | const [inherited] |
Accessor method that returns a string containing the Blob name.
Definition at line 149 of file Blob.cpp.
Referenced by Isis::SpicePosition::LoadCache(), and Isis::Cube::write().
void Isis::Table::operator+= | ( | Isis::TableRecord & | rec | ) |
Adds a TableRecord to the Table.
rec | The record to be added to the table |
Definition at line 255 of file Table.cpp.
References _FILEINFO_, Isis::Blob::p_blobName, p_recbufs, Isis::TableRecord::Pack(), Isis::TableRecord::RecordSize(), RecordSize(), Isis::toString(), and Isis::IException::Unknown.
Table & Isis::Table::operator= | ( | const Isis::Table & | other | ) |
Sets the Table equal to the input Table object.
This method copies TableRecords and the member variable values for record, records, assoc, and swap.
other | The table to copy from |
Definition at line 147 of file Table.cpp.
References p_assoc, p_recbufs, p_record, p_records, p_swap, and RecordSize().
Isis::TableRecord & Isis::Table::operator[] | ( | const int | index | ) |
Reads a TableRecord from the Table.
index | Index where desired TableRecord is located |
Definition at line 245 of file Table.cpp.
References p_recbufs, p_record, and Isis::TableRecord::Unpack().
void Isis::Blob::Read | ( | const QString & | file | ) | [inherited] |
This method reads Pvl values from a specified file.
file | The filename to read from. |
iException::Io | - Unable to open file |
iException::Pvl | - Invalid label format |
Definition at line 243 of file Blob.cpp.
References _FILEINFO_, and Isis::Pvl::Read().
Referenced by Isis::OriginalLabel::OriginalLabel(), Isis::Cube::read(), and Table().
void Isis::Blob::Read | ( | const QString & | file, |
const Pvl & | pvlLabels | ||
) | [inherited] |
This method reads the given a file and labels.
file | The filename to read from. |
pvlLabels | A Pvl containing the label information. |
iException::Io | - Unable to open file |
Definition at line 268 of file Blob.cpp.
References _FILEINFO_, and Isis::Message::FileOpen().
void Isis::Blob::Read | ( | const Pvl & | pvl, |
std::istream & | istm | ||
) | [virtual, inherited] |
This method reads the Blob data from an open input file stream.
pvl | A Pvl containing the label information. |
istm | The input file stream containing the blob data to be read. |
iException::Io | - Unable to open file |
Reimplemented in Isis::History.
Definition at line 303 of file Blob.cpp.
References _FILEINFO_, and Isis::Message::FileOpen().
void Isis::Table::ReadData | ( | std::istream & | stream | ) | [protected, virtual] |
Virtual function to Read the data.
stream | InputStream to read data in from |
Isis::IException::Io | - Error reading or preparing to read a record |
Reimplemented from Isis::Blob.
Definition at line 356 of file Table.cpp.
References _FILEINFO_, Isis::IException::Io, Isis::Blob::p_blobName, p_recbufs, p_record, p_records, Isis::Blob::p_startByte, p_swap, RecordSize(), Isis::TableRecord::Swap(), and Isis::toString().
void Isis::Table::ReadInit | ( | ) | [protected, virtual] |
Virtual function to validate PVL table information.
Reimplemented from Isis::Blob.
Definition at line 318 of file Table.cpp.
References Clear(), g, Isis::PvlObject::Group(), Isis::PvlObject::Groups(), Isis::PvlObject::HasKeyword(), Isis::IsLsb(), Isis::IsMsb(), Isis::PvlContainer::IsNamed(), p_assoc, Isis::Blob::p_blobPvl, p_record, p_records, and p_swap.
int Isis::Table::RecordFields | ( | ) | const |
Returns the number of fields per record.
Definition at line 225 of file Table.cpp.
References Isis::TableRecord::Fields(), and p_record.
int Isis::Table::Records | ( | ) | const |
Returns the number of records.
Definition at line 216 of file Table.cpp.
References p_recbufs.
Referenced by Isis::CubeDisplayProperties::CubeDisplayProperties(), Isis::ExportPdsTable::ExportPdsTable(), Isis::DawnVirCamera::getPointingTable(), Isis::ApolloPanoramicDetectorMap::initializeInteriorOrientation(), Isis::SpicePosition::LoadCache(), Isis::Blobber::loadDouble(), Isis::Blobber::loadInteger(), Isis::DawnVirCamera::readHouseKeeping(), Isis::HrscCamera::ReadLineRates(), Isis::ProcessMosaic::SetMosaicOrigin(), Isis::AdvancedTrackTool::TrackMosaicOrigin(), WriteData(), and WriteInit().
int Isis::Table::RecordSize | ( | ) | const |
Returns the number of bytes per record.
Definition at line 234 of file Table.cpp.
References p_record, and Isis::TableRecord::RecordSize().
Referenced by operator+=(), operator=(), ReadData(), Table(), WriteData(), and WriteInit().
void Isis::Table::SetAssociation | ( | const Table::Association | assoc | ) |
int Isis::Blob::Size | ( | ) | const [inherited] |
Accessor method that returns the number of bytes in the blob data.
Definition at line 158 of file Blob.cpp.
Referenced by Isis::BundleAdjust::Observations().
QString Isis::Blob::Type | ( | ) | const [inherited] |
Accessor method that returns a string containing the Blob type.
Definition at line 140 of file Blob.cpp.
Referenced by Isis::Cube::write().
void Isis::Table::Update | ( | const TableRecord & | rec, |
const int | index | ||
) |
Updates a TableRecord.
rec | TableRecord to update old TableRecord with |
index | Index of TableRecord to be updated |
Definition at line 293 of file Table.cpp.
References p_recbufs, and Isis::TableRecord::Pack().
void Isis::Blob::Write | ( | const QString & | file | ) | [inherited] |
Write the blob data out to a file.
file | The filename to write to. |
IException::Io | - Unable to open file |
IException::Io | - Error preparing to write data to file |
IException::Io | - Error creating file |
Definition at line 369 of file Blob.cpp.
References _FILEINFO_, Isis::PvlObject::AddObject(), Isis::PvlObject::FindObject(), Isis::toString(), and Isis::Pvl::Write().
Referenced by Isis::Cube::write().
void Isis::Blob::Write | ( | Pvl & | pvl, |
std::fstream & | stm, | ||
const QString & | detachedFileName = "" |
||
) | [inherited] |
Write the blob data out to a Pvl object.
pvl | The pvl object to update |
stm | stream to write data to |
detachedFileName | If the stream is detached from the labels give the name of the file |
Definition at line 418 of file Blob.cpp.
References Isis::PvlObject::AddObject(), Isis::PvlContainer::Name(), Isis::PvlObject::Object(), Isis::PvlObject::Objects(), and Isis::toString().
void Isis::Table::WriteData | ( | std::fstream & | os | ) | [protected, virtual] |
Virtual function to write the data.
os | Outputstream to write the data to |
Reimplemented from Isis::Blob.
Definition at line 411 of file Table.cpp.
References p_recbufs, Records(), and RecordSize().
void Isis::Table::WriteInit | ( | ) | [protected, virtual] |
Virtual Function to prepare labels for writing.
Reimplemented from Isis::Blob.
Definition at line 381 of file Table.cpp.
References Isis::PvlContainer::DeleteKeyword(), Isis::PvlObject::HasKeyword(), Isis::IsLsb(), p_assoc, Isis::Blob::p_blobPvl, Isis::Blob::p_nbytes, Records(), RecordSize(), and Isis::toString().
Association Isis::Table::p_assoc [protected] |
Association Type of the table.
Definition at line 136 of file Table.h.
Referenced by IsBandAssociated(), IsLineAssociated(), IsSampleAssociated(), operator=(), ReadInit(), SetAssociation(), Table(), and WriteInit().
QString Isis::Blob::p_blobName [protected, inherited] |
Name of the Blob object.
Definition at line 95 of file Blob.h.
Referenced by Isis::Blob::Blob(), operator+=(), Isis::Blob::operator=(), ReadData(), and Isis::ImagePolygon::ReadData().
PvlObject Isis::Blob::p_blobPvl [protected, inherited] |
Definition at line 94 of file Blob.h.
Referenced by Isis::Blob::Blob(), Isis::Blob::operator=(), ReadInit(), Table(), and WriteInit().
char* Isis::Blob::p_buffer [protected, inherited] |
Buffer blob data is stored in.
Definition at line 97 of file Blob.h.
Referenced by Isis::Blob::Blob(), Isis::Blob::operator=(), Isis::History::ReturnHist(), Isis::OriginalLabel::ReturnLabels(), Isis::History::WriteInit(), and Isis::OriginalLabel::WriteInit().
QString Isis::Blob::p_detached [protected, inherited] |
Used for reading detached blobs.
Definition at line 101 of file Blob.h.
Referenced by Isis::Blob::Blob(), and Isis::Blob::operator=().
QString Isis::Blob::p_labelFile [protected, inherited] |
The file containing the labels.
Definition at line 102 of file Blob.h.
Referenced by Isis::Blob::Blob(), and Isis::Blob::operator=().
int Isis::Blob::p_nbytes [protected, inherited] |
Size of blob data (in bytes)
Definition at line 99 of file Blob.h.
Referenced by Isis::Blob::Blob(), Isis::Blob::operator=(), Isis::ImagePolygon::ReadData(), Isis::History::ReturnHist(), Isis::OriginalLabel::ReturnLabels(), Isis::ImagePolygon::WriteData(), Isis::History::WriteInit(), Isis::OriginalLabel::WriteInit(), WriteInit(), and Isis::ImagePolygon::WriteInit().
std::vector<char *> Isis::Table::p_recbufs [protected] |
Buffers containing record values.
Definition at line 131 of file Table.h.
Referenced by Clear(), Delete(), operator+=(), operator=(), operator[](), ReadData(), Records(), Table(), Update(), and WriteData().
TableRecord Isis::Table::p_record [protected] |
The current table record.
Definition at line 130 of file Table.h.
Referenced by operator=(), operator[](), ReadData(), ReadInit(), RecordFields(), RecordSize(), and Table().
int Isis::Table::p_records [protected] |
Holds record count read from labels, may differ from the size of p_recbufs.
Definition at line 133 of file Table.h.
Referenced by operator=(), ReadData(), ReadInit(), and Table().
BigInt Isis::Blob::p_startByte [protected, inherited] |
Byte blob data starts at in buffer.
Definition at line 98 of file Blob.h.
Referenced by Isis::Blob::Blob(), Isis::Blob::operator=(), ReadData(), and Isis::ImagePolygon::ReadData().
bool Isis::Table::p_swap [protected] |
Only used for reading.
Definition at line 137 of file Table.h.
Referenced by operator=(), ReadData(), ReadInit(), and Table().
QString Isis::Blob::p_type [protected, inherited] |
Type of data stored in the buffer.
Definition at line 100 of file Blob.h.
Referenced by Isis::Blob::Blob(), Isis::Blob::operator=(), and Isis::ImagePolygon::ReadData().