|
Isis 3.0 Object Programmers' Reference |
Home |
#include <Table.h>
Inheritance diagram for Isis::Table:


This class reads table blobs from the cubes (or detached tables). It is 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, string, and double. See the classes TableRecord and TableField for more information. The class uses PVL to store the structure of the table N, F, and Field types and binary to store the table data.
If you would like to see Table being used in implementation, see histats.cpp
For internal use only.
Definition at line 57 of file Table.h.
Public Types | |
| None | |
| Samples | |
| Lines | |
| Bands | |
| enum | Association { None, Samples, Lines, Bands } |
Public Member Functions | |
| Table (const std::string &tableName) | |
| Constructor for reading a table. | |
| Table (const std::string &tableName, Isis::TableRecord &rec) | |
| Constructor for creating a table. | |
| Table (const std::string &tableName, const std::string &file) | |
| Constructor for reading a table. | |
| Table (const Table &other) | |
| Copy constructor for table. | |
| ~Table () | |
| Destroys the Table object. | |
| Isis::TableRecord & | operator[] (const int index) |
| Reads a TableRecord from the Table. | |
| void | operator+= (Isis::TableRecord &rec) |
| Adds a TableRecord to the Table. | |
| Table & | operator= (const Isis::Table &other) |
| void | Update (const Isis::TableRecord &rec, const int index) |
| Updates a TableRecord. | |
| void | Delete (const int index) |
| Deletes a TableRecord from the Table. | |
| int | Records () const |
| Returns the number of records. | |
| int | RecordSize () const |
| Returns the number of bytes per record. | |
| 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. | |
| void | Clear () |
| Clear the table of all records. | |
| void | Read (const std::string &file) |
| This reads Pvl values from a specified file. | |
| virtual void | Read (Isis::Pvl &pvl, std::fstream &is) |
| void | Write (const std::string &file) |
| Write the blob data out to a file. | |
| void | Write (Isis::Pvl &pvl, std::fstream &istm, const std::string &detachedFilename="") |
| Write the blob data out to a Pvl object. | |
| std::string | Type () const |
| std::string | Name () const |
| PvlObject & | Label () |
Protected Member Functions | |
| void | ReadInit () |
| Virtual function to validate PVL table information. | |
| void | ReadData (std::fstream &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 (Isis::Pvl &pvl) |
Protected Attributes | |
| Isis::TableRecord | p_record |
| std::vector< char * > | p_recbufs |
| 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. | |
| Isis::PvlObject | p_blobPvl |
| Pvl Blob object. | |
| std::string | 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). | |
| std::string | p_type |
| Type of data stored in the buffer. | |
| std::string | p_detached |
| Used for reading detached blobs. | |
| std::string | p_labelFile |
| The file containing the labels. | |
| Isis::Table::Table | ( | const std::string & | tableName | ) |
| Isis::Table::Table | ( | const std::string & | tableName, | |
| Isis::TableRecord & | rec | |||
| ) |
Constructor for creating a table.
| tableName | Name of the Table to be read | |
| rec | Name of the TableRecord to be read into the Table |
Definition at line 38 of file Table.cpp.
References Isis::PvlObject::AddGroup(), Isis::TableRecord::Fields(), p_assoc, Isis::Blob::p_blobPvl, and p_record.
| Isis::Table::Table | ( | const std::string & | tableName, | |
| const std::string & | file | |||
| ) |
| Isis::Table::Table | ( | const Table & | other | ) |
| Isis::Table::~Table | ( | ) |
| void Isis::Table::Clear | ( | ) |
Clear the table of all records.
Definition at line 268 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 156 of file Table.cpp.
References p_recbufs.
| bool Isis::Table::IsBandAssociated | ( | ) | [inline] |
| bool Isis::Table::IsLineAssociated | ( | ) | [inline] |
| bool Isis::Table::IsSampleAssociated | ( | ) | [inline] |
| 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 134 of file Table.cpp.
References p_recbufs, Isis::TableRecord::Pack(), 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 124 of file Table.cpp.
References p_recbufs, p_record, and Isis::TableRecord::Unpack().
| void Isis::Blob::Read | ( | const std::string & | file | ) | [inherited] |
This reads Pvl values from a specified file.
| file | The filename to read from. |
| Isis::iException::Io | - Unable to open file | |
| Isis::iException::Pvl | - Invalid label format |
Definition at line 141 of file Blob.cpp.
References _FILEINFO_, e, Isis::Message::FileOpen(), in, Isis::iException::Message(), Isis::Blob::p_blobName, Isis::Blob::p_type, and pvl().
Referenced by Isis::Blob::Blob(), Isis::History::History(), Isis::OriginalLabel::OriginalLabel(), Isis::OriginalLabel::Read(), Isis::History::Read(), Isis::Cube::Read(), and Table().
| void Isis::Table::ReadData | ( | std::fstream & | 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 202 of file Table.cpp.
References _FILEINFO_, Isis::iException::Message(), Isis::Blob::p_blobName, p_recbufs, p_record, p_records, Isis::Blob::p_startByte, p_swap, RecordSize(), and Isis::TableRecord::Swap().
| void Isis::Table::ReadInit | ( | ) | [protected, virtual] |
Virtual function to validate PVL table information.
Reimplemented from Isis::Blob.
Definition at line 164 of file Table.cpp.
References Isis::ByteOrderEnumeration(), 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::Records | ( | ) | const [inline] |
Returns the number of records.
Definition at line 86 of file Table.h.
References p_recbufs.
Referenced by Isis::SpicePosition::LoadCache(), Isis::Blobber::loadDouble(), Isis::Blobber::loadInteger(), Isis::Mex::HrscCamera::ReadLineRates(), WriteData(), and WriteInit().
| int Isis::Table::RecordSize | ( | ) | const [inline] |
Returns the number of bytes per record.
Definition at line 93 of file Table.h.
References p_record, and Isis::TableRecord::RecordSize().
Referenced by operator+=(), operator=(), ReadData(), Table(), WriteData(), and WriteInit().
| void Isis::Table::SetAssociation | ( | const Table::Association | assoc | ) | [inline] |
| void Isis::Table::Update | ( | const Isis::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 147 of file Table.cpp.
References p_recbufs, and Isis::TableRecord::Pack().
| void Isis::Blob::Write | ( | Isis::Pvl & | pvl, | |
| std::fstream & | stm, | |||
| const std::string & | 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 345 of file Blob.cpp.
References Isis::PvlContainer::DeleteKeyword(), Isis::PvlContainer::Name(), Isis::Blob::p_blobPvl, Isis::Blob::p_nbytes, Isis::Blob::p_type, pvl(), Isis::Blob::WriteData(), and Isis::Blob::WriteInit().
| void Isis::Blob::Write | ( | const std::string & | file | ) | [inherited] |
Write the blob data out to a file.
| file | The filename to write to. |
| Isis::iException::Io | - Unable to open file | |
| Isis::iException::Io | - Error preparing to write data to file | |
| Isis::iException::Io | - Error creating file |
Definition at line 296 of file Blob.cpp.
References _FILEINFO_, e, in, Isis::iException::Message(), Isis::Blob::p_blobName, Isis::Blob::p_blobPvl, Isis::Blob::p_nbytes, Isis::Blob::p_startByte, Isis::Blob::p_type, pvl(), Isis::Blob::WriteData(), and Isis::Blob::WriteInit().
Referenced by Isis::Cube::Write().
| 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 259 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 229 of file Table.cpp.
References Isis::ByteOrderName(), Isis::PvlContainer::DeleteKeyword(), Isis::PvlObject::HasKeyword(), Isis::IsLsb(), p_assoc, Isis::Blob::p_blobPvl, Isis::Blob::p_nbytes, Records(), and RecordSize().
Association Isis::Table::p_assoc [protected] |
Association Type of the table.
Definition at line 141 of file Table.h.
Referenced by IsBandAssociated(), IsLineAssociated(), IsSampleAssociated(), operator=(), ReadInit(), SetAssociation(), Table(), and WriteInit().
std::string Isis::Blob::p_blobName [protected, inherited] |
Name of the Blob object.
Definition at line 72 of file Blob.h.
Referenced by Isis::Blob::Blob(), Isis::Blob::Find(), Isis::Blob::Name(), Isis::Blob::operator=(), Isis::Blob::Read(), ReadData(), Isis::ImagePolygon::ReadData(), Isis::Blob::ReadData(), Isis::Blob::Write(), and Isis::Blob::WriteData().
Isis::PvlObject Isis::Blob::p_blobPvl [protected, inherited] |
Definition at line 71 of file Blob.h.
Referenced by Isis::Blob::Blob(), Isis::Blob::Find(), Isis::Blob::Label(), Isis::Blob::operator=(), ReadInit(), Table(), Isis::Blob::Write(), and WriteInit().
char* Isis::Blob::p_buffer [protected, inherited] |
Buffer blob data is stored in.
Definition at line 74 of file Blob.h.
Referenced by Isis::Blob::Blob(), Isis::Blob::operator=(), Isis::Blob::ReadData(), Isis::History::ReturnHist(), Isis::OriginalLabel::ReturnLabels(), Isis::Blob::WriteData(), Isis::OriginalLabel::WriteInit(), Isis::History::WriteInit(), and Isis::Blob::~Blob().
std::string Isis::Blob::p_detached [protected, inherited] |
Used for reading detached blobs.
Definition at line 78 of file Blob.h.
Referenced by Isis::Blob::Blob(), Isis::Blob::Find(), Isis::Blob::operator=(), and Isis::Blob::Read().
std::string Isis::Blob::p_labelFile [protected, inherited] |
The file containing the labels.
Definition at line 79 of file Blob.h.
Referenced by Isis::Blob::Blob(), Isis::Blob::Find(), and Isis::Blob::operator=().
int Isis::Blob::p_nbytes [protected, inherited] |
Size of blob data (in bytes).
Definition at line 76 of file Blob.h.
Referenced by Isis::Blob::Blob(), Isis::Blob::Find(), Isis::Blob::operator=(), Isis::ImagePolygon::ReadData(), Isis::Blob::ReadData(), Isis::History::ReturnHist(), Isis::OriginalLabel::ReturnLabels(), Isis::Blob::Write(), Isis::ImagePolygon::WriteData(), Isis::Blob::WriteData(), WriteInit(), Isis::OriginalLabel::WriteInit(), Isis::ImagePolygon::WriteInit(), and Isis::History::WriteInit().
int Isis::Table::p_records [protected] |
Holds record count read from labels, may differ from the size of p_recbufs.
Definition at line 138 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 75 of file Blob.h.
Referenced by Isis::Blob::Blob(), Isis::Blob::Find(), Isis::Blob::operator=(), ReadData(), Isis::ImagePolygon::ReadData(), Isis::Blob::ReadData(), and Isis::Blob::Write().
bool Isis::Table::p_swap [protected] |
Only used for reading.
Definition at line 142 of file Table.h.
Referenced by operator=(), ReadData(), ReadInit(), and Table().
std::string Isis::Blob::p_type [protected, inherited] |
Type of data stored in the buffer.
Definition at line 77 of file Blob.h.
Referenced by Isis::Blob::Blob(), Isis::Blob::Find(), Isis::Blob::operator=(), Isis::Blob::Read(), Isis::ImagePolygon::ReadData(), Isis::Blob::ReadData(), Isis::Blob::Type(), Isis::Blob::Write(), and Isis::Blob::WriteData().