Isis 3 Programmer Reference
|
Class for storing an Isis::Table's field information. More...
#include <TableField.h>
Public Types | |
enum | Type { Integer, Double, Text, Real } |
This enum describes the value type for the TableField. More... | |
Public Member Functions | |
TableField (const QString &name, Type type, int size=1) | |
Constructs a TableField object with the given field name, field value type, and field size. More... | |
TableField (PvlGroup &field) | |
Constructs a TableField object from a PvlGroup. More... | |
~TableField () | |
Destroys the TableField object. More... | |
QString | name () const |
Returns the name of the TableField. More... | |
Type | type () const |
Returns the enumerated value of the TableField value's type. More... | |
bool | isInteger () const |
Determines whether the field type is Integer. More... | |
bool | isDouble () const |
Determines whether the field type is Double. More... | |
bool | isText () const |
Determines whether the field type is Text. More... | |
bool | isReal () const |
Determines whether the field type is Text. More... | |
int | bytes () const |
Returns the number of bytes in the field value. More... | |
int | size () const |
Returns the number of values stored for the field at each record. More... | |
operator int () const | |
Casts the table field value to int if the type is Integer and the size is. More... | |
operator double () const | |
Casts the table field value to double if the type is Double and the size is. More... | |
operator float () const | |
Casts the table field value to float if the type is Real and the size is. More... | |
operator QString () const | |
Casts the table field value to string if the type is Text. More... | |
operator std::vector< int > () const | |
Casts the table field value to a vector of ints if the type is Integer. More... | |
operator std::vector< double > () const | |
Casts the table field value to a vector of doubles if the type is Double. More... | |
operator std::vector< float > () const | |
Casts the table field value to a vector of floats if the type is Real. More... | |
void | operator= (const int value) |
Sets field value equal to input if TableField::Type is Integer and size is 1. More... | |
void | operator= (const double value) |
Sets field value equal to input if TableField::Type is Double and size is 1. More... | |
void | operator= (const float value) |
Sets field value equal to input if the TableField::Type is Real and the size is 1. More... | |
void | operator= (const QString &value) |
Sets field value equal to input if the TableField::Type is Text. More... | |
void | operator= (const std::vector< int > &values) |
Sets field value equal to input if the TableField::Type is Integer and the input vector size matches the field size. More... | |
void | operator= (const std::vector< double > &values) |
Sets field value equal to the input if the TableField::Type is Double and the input vector size matches the field size. More... | |
void | operator= (const std::vector< float > &value) |
Sets field value equal to the input if the TableField::Type is Real and the input vector size matches the field size. More... | |
void | operator= (const char *buf) |
Sets field value equal to the values found in the character string array if the TableField::Type is Text. More... | |
void | operator= (const void *buf) |
Sets field value equal to the values found in the input binary buffer. More... | |
PvlGroup | pvlGroup () |
Creates and returns a PvlGroup named "Field" containing the following keywords and their respective values: "Name", "Type", and "Size". More... | |
Static Public Member Functions | |
static QString | toString (const TableField &field, QString delimiter=",") |
Private Attributes | |
QString | m_name |
Field name. More... | |
Type | m_type |
Field value type. More... | |
int | m_size |
Field size. More... | |
int | m_bytes |
Number of bytes in field. More... | |
std::vector< int > | m_ivalues |
Vector containing integer field values. More... | |
std::vector< double > | m_dvalues |
Vector containing double field values. More... | |
std::vector< float > | m_rvalues |
Vector containing Real field values. More... | |
QString | m_svalue |
String containing text value of field. More... | |
Class for storing an Isis::Table's field information.
This class represents the field values of an Isis table. In Isis3, fields correspond to column values. Each TableField object is a single table entry for a column value at a specific row (or record) of the table.
Be careful to note that the size of a field is the number of array values for a single column entry. It is not the number of rows or records of the table.
Definition at line 47 of file TableField.h.
This enum describes the value type for the TableField.
Definition at line 52 of file TableField.h.
Isis::TableField::TableField | ( | const QString & | name, |
TableField::Type | type, | ||
int | size = 1 |
||
) |
Constructs a TableField object with the given field name, field value type, and field size.
The size defaults to 1 entry value per field.
name | The name of the field. |
type | The type of the field value. |
size | The size of the field. This is the number of values for a single table entry. Defaults to 1. |
Definition at line 25 of file TableField.cpp.
Isis::TableField::TableField | ( | PvlGroup & | field | ) |
Constructs a TableField object from a PvlGroup.
The given group must contain the PvlKeywords "Name", "Size", and "Type". "Size" must be an integer value and valid values for "Type" are "Integer", "Double", "Text", or "Real".
field | PvlGroup containing Name, Size, and Type for new TableField object |
IException::Programmer | - Invalid field type |
Definition at line 59 of file TableField.cpp.
Isis::TableField::~TableField | ( | ) |
Destroys the TableField object.
Definition at line 89 of file TableField.cpp.
int Isis::TableField::bytes | ( | ) | const |
Returns the number of bytes in the field value.
Definition at line 159 of file TableField.cpp.
Referenced by Isis::TableRecord::Swap(), and Isis::TableRecord::Unpack().
bool Isis::TableField::isDouble | ( | ) | const |
Determines whether the field type is Double.
Definition at line 132 of file TableField.cpp.
Referenced by Isis::ImportPdsTable::extract(), Isis::Blobber::load(), Isis::TableRecord::Pack(), Isis::ExportPdsTable::Pack(), and Isis::TableRecord::Swap().
bool Isis::TableField::isInteger | ( | ) | const |
Determines whether the field type is Integer.
Definition at line 122 of file TableField.cpp.
Referenced by Isis::ImportPdsTable::extract(), Isis::Blobber::load(), Isis::TableRecord::Pack(), Isis::ExportPdsTable::Pack(), and Isis::TableRecord::Swap().
bool Isis::TableField::isReal | ( | ) | const |
Determines whether the field type is Text.
Definition at line 150 of file TableField.cpp.
Referenced by Isis::TableRecord::Pack(), Isis::ExportPdsTable::Pack(), and Isis::TableRecord::Swap().
bool Isis::TableField::isText | ( | ) | const |
Determines whether the field type is Text.
Definition at line 141 of file TableField.cpp.
Referenced by Isis::TableRecord::Pack(), Isis::ExportPdsTable::Pack(), and Isis::TableRecord::Swap().
QString Isis::TableField::name | ( | ) | const |
Returns the name of the TableField.
Definition at line 97 of file TableField.cpp.
Referenced by Isis::ExportPdsTable::fillMetaData(), Isis::ExportPdsTable::Pack(), and Isis::TrackingTable::toTable().
Isis::TableField::operator double | ( | ) | const |
Casts the table field value to double if the type is Double and the size is.
TableField field("Field 1", FieldType::Double, 1); // The following lines are equivalent double value = double(field); double value = (double) field;
IException::Programmer | - Field is not a Double |
IException::Programmer | - Field has multiple Double values |
Definition at line 217 of file TableField.cpp.
Isis::TableField::operator float | ( | ) | const |
Casts the table field value to float if the type is Real and the size is.
TableField field("Field 1", FieldType::Real, 1); // The following lines are equivalent float value = float(field); float value = (float) field;
IException::Programmer | - Field is not a Real |
IException::Programmer | - Field has multiple Real values |
Definition at line 246 of file TableField.cpp.
Isis::TableField::operator int | ( | ) | const |
Casts the table field value to int if the type is Integer and the size is.
TableField field("Field 1", FieldType::Integer, 1); // The following lines are equivalent int value = int(field); int value = (int) field;
IException::Programmer | - Field is not an Integer |
IException::Programmer | - Field has multiple Integer values |
Definition at line 188 of file TableField.cpp.
Isis::TableField::operator QString | ( | ) | const |
Casts the table field value to string if the type is Text.
TableField field("Field 1", FieldType::Text, 9); // The following lines are equivalent string value = QString(field); string value = (QString) field;
IException::Programmer | - Field is not a string |
Definition at line 273 of file TableField.cpp.
Isis::TableField::operator std::vector< double > | ( | ) | const |
Casts the table field value to a vector of doubles if the type is Double.
TableField field("Field 1", FieldType::Double, 3); vector<double> values = std::vector<double>(field);
IException::Programmer | - Field is not a Double array |
Definition at line 313 of file TableField.cpp.
Isis::TableField::operator std::vector< float > | ( | ) | const |
Casts the table field value to a vector of floats if the type is Real.
TableField field("Field 1", FieldType::Real, 3); vector<float> values = std::vector<float>(field);
IException::Programmer | - Field is not an Integer array |
Definition at line 333 of file TableField.cpp.
Isis::TableField::operator std::vector< int > | ( | ) | const |
Casts the table field value to a vector of ints if the type is Integer.
TableField field("Field 1", FieldType::Integer, 3); vector<int> values = std::vector<int>(field);
IException::Programmer | - Field is not an Integer array |
Definition at line 293 of file TableField.cpp.
void Isis::TableField::operator= | ( | const char * | buf | ) |
Sets field value equal to the values found in the character string array if the TableField::Type is Text.
buf | Character array conataining text values to be assigned to the field value. |
IException::Programmer | - Field is not Text |
Definition at line 575 of file TableField.cpp.
void Isis::TableField::operator= | ( | const double | value | ) |
Sets field value equal to input if TableField::Type is Double and size is 1.
value | Double to be assigned to field value |
IException::Programmer | - Field is not a Double |
IException::Programmer | - Field has multiple Double values |
Definition at line 374 of file TableField.cpp.
References Isis::toString().
void Isis::TableField::operator= | ( | const float | value | ) |
Sets field value equal to input if the TableField::Type is Real and the size is 1.
value | float to be assigned to field value |
IException::Programmer | - Field is not a Real |
IException::Programmer | - Field has multiple Real values |
Definition at line 398 of file TableField.cpp.
References Isis::toString().
void Isis::TableField::operator= | ( | const int | value | ) |
Sets field value equal to input if TableField::Type is Integer and size is 1.
value | Integer to be assigned to field value |
IException::Programmer | - Field is not an Integer |
IException::Programmer | - Field has multiple Integer values |
Definition at line 350 of file TableField.cpp.
References Isis::toString().
void Isis::TableField::operator= | ( | const QString & | value | ) |
Sets field value equal to input if the TableField::Type is Text.
value | string to be assigned to field value |
IException::Programmer | - Field is not a string |
Definition at line 420 of file TableField.cpp.
References Isis::toString().
void Isis::TableField::operator= | ( | const std::vector< double > & | values | ) |
Sets field value equal to the input if the TableField::Type is Double and the input vector size matches the field size.
values | Double vector of values to be assigned to field value |
IException::Programmer | - Field is not a Double |
IException::Programmer | - Vector is not the correct size |
Definition at line 477 of file TableField.cpp.
References Isis::toString().
void Isis::TableField::operator= | ( | const std::vector< float > & | values | ) |
Sets field value equal to the input if the TableField::Type is Real and the input vector size matches the field size.
values | Float vector of values to be assigned to field value |
IException::Programmer | - Field is not a Real |
IException::Programmer | - Vector is not the correct size |
Definition at line 502 of file TableField.cpp.
References Isis::toString().
void Isis::TableField::operator= | ( | const std::vector< int > & | values | ) |
Sets field value equal to input if the TableField::Type is Integer and the input vector size matches the field size.
values | Integer vector of values to be assigned to field value |
IException::Programmer | - Field is not an Integer |
IException::Programmer | - Vector is not the correct size |
Definition at line 453 of file TableField.cpp.
References Isis::toString().
void Isis::TableField::operator= | ( | const void * | ibuf | ) |
Sets field value equal to the values found in the input binary buffer.
This method reads the buffer by assuming that the buffer values are stored in the same number of bytes as the TableField::Type.
ibuf | Binary buffer containing values to be assigned to the field value. |
iException::Programmer | - Undefined field type. |
Definition at line 528 of file TableField.cpp.
PvlGroup Isis::TableField::pvlGroup | ( | ) |
Creates and returns a PvlGroup named "Field" containing the following keywords and their respective values: "Name", "Type", and "Size".
Definition at line 589 of file TableField.cpp.
References Isis::toString().
int Isis::TableField::size | ( | ) | const |
Returns the number of values stored for the field at each record.
Definition at line 168 of file TableField.cpp.
Referenced by Isis::ImportPdsTable::extract(), Isis::ExportPdsTable::fillMetaData(), Isis::TableRecord::Pack(), Isis::ExportPdsTable::Pack(), and Isis::TableRecord::Swap().
TableField::Type Isis::TableField::type | ( | ) | const |
Returns the enumerated value of the TableField value's type.
Definition at line 112 of file TableField.cpp.
Referenced by Isis::ExportPdsTable::fillMetaData().
|
private |
Number of bytes in field.
Definition at line 102 of file TableField.h.
|
private |
Vector containing double field values.
If the field Type is not Double, this vector will be empty.
Definition at line 106 of file TableField.h.
|
private |
Vector containing integer field values.
If the field Type is not Integer, this vector will be empty.
Definition at line 103 of file TableField.h.
|
private |
Field name.
Definition at line 98 of file TableField.h.
|
private |
Vector containing Real field values.
If the field Type is not Real, this vector will be empty.
Definition at line 109 of file TableField.h.
|
private |
Field size.
This is the number of values per field entry of the table.
Definition at line 100 of file TableField.h.
|
private |
String containing text value of field.
If the field Type is not Text, this string will be empty.
Definition at line 112 of file TableField.h.
|
private |
Field value type.
Definition at line 99 of file TableField.h.