11#include "PvlKeyword.h" 
   60    m_name = (QString) field[
"Name"];
 
   61    m_size = (int) field[
"Size"];
 
   62    if ((QString) field[
"Type"] == 
"Integer") {
 
   67    else if ((QString) field[
"Type"] == 
"Double") {
 
   72    else if ((QString) field[
"Type"] == 
"Text") {
 
   77    else if ((QString) field[
"Type"] == 
"Real") {
 
   83      QString msg = 
"Field [" + 
m_name + 
"] has invalid type.";
 
 
  188  TableField::operator int()
 const {
 
  190      QString msg = 
"Field [" + m_name + 
"] is not Integer.";
 
  193    if (m_ivalues.size() > 1) {
 
  194      QString msg = 
"Field [" + m_name + 
"] has multiple Integer values. " 
  195                   "Use std::vector<int>().";
 
 
  217  TableField::operator double()
 const {
 
  219      QString msg = 
"Field [" + m_name + 
"] is not a Double.";
 
  222    if (m_dvalues.size() > 1) {
 
  223      QString msg = 
"Field [" + m_name + 
"] has multiple Double values. " 
  224                   "Use std::vector<double>().";
 
 
  246  TableField::operator float()
 const {
 
  248      QString msg = 
"Field [" + m_name + 
"] is not Real.";
 
  251    if (m_rvalues.size() > 1) {
 
  252      QString msg = 
"Field [" + m_name + 
"] has multiple Real values. " 
  253                   "Use std::vector<float>().";
 
 
  273  TableField::operator QString()
 const {
 
  275      QString msg = 
"Field [" + m_name + 
"] is not Text.";
 
  278    return QString(m_svalue.toLatin1().data());
 
 
  293  TableField::operator std::vector<int>()
 const {
 
  295      QString msg = 
"Field [" + m_name + 
"] is not an Integer array.";
 
 
  313  TableField::operator std::vector<double>()
 const {
 
  315      QString msg = 
"Field [" + m_name + 
"] is not a Double array.";
 
 
  333  TableField::operator std::vector<float>()
 const {
 
  335      QString msg = 
"Field [" + m_name + 
"] is not a Real array.";
 
 
  352      QString msg = 
"Unable to set field to the given int value. Field ["  
  353                   + 
m_name + 
"] Type is not Integer.";
 
  357      QString msg = 
"Unable to set field to the given int value. " 
  359                    "Integer values. Use operator=(vector<int>).";
 
 
  376      QString msg = 
"Unable to set field to the given double value. Field ["  
  377                   + 
m_name + 
"] Type is not Double.";
 
  381      QString msg = 
"Unable to set field to the given double value. " 
  383                    "Double values. Use operator=(vector<double>).";
 
 
  400      QString msg = 
"Unable to set field to the given float value. Field ["  
  401                   + 
m_name + 
"] Type is not Real.";
 
  405      QString msg = 
"Unable to set field to the given float value. " 
  407                    "Real values. Use operator=(vector<float>).";
 
 
  423      QString msg = 
"Unable to set field to the given string value. Field ["  
  424                    + 
m_name + 
"] Type is not Text.";
 
  427    if (
m_size < (
int) val.size()) {
 
  428      for (
int i = 
m_size; i < val.size(); i++) {
 
  430        if (val[i] != 
' ' && val[i] != 
'\0') {
 
  431          QString msg = 
"Unable to set the Text TableField to the given string. " 
  432                        "The number of bytes allowed for this field value ["  
  434                        "given string [" + value + 
"].";
 
 
  455      QString msg = 
"Unable to set field to the given vector of int values. " 
  456                    "Field [" + 
m_name + 
"] Type is not Integer.";
 
  459    else if ((
int) values.size() != 
m_size) {
 
  460      QString msg = 
"Unable to set field to the given vector of int values. " 
  461                    "Field [" + 
m_name + 
"] values has size ["  
 
  479      QString msg = 
"Unable to set field to the given vector of double values. " 
  480                    "Field [" + 
m_name + 
"] Type is not Double.";
 
  483    else if ((
int) values.size() != 
m_size) {
 
  484      QString msg = 
"Unable to set field to the given vector of double values. " 
  485                    "Field [" + 
m_name + 
"] values has size ["  
 
  504      QString msg = 
"Unable to set field to the given vector of float values. " 
  505                    "Field [" + 
m_name + 
"] Type is not Real.";
 
  508    else if ((
int) values.size() != 
m_size) {
 
  509      QString msg = 
"Unable to set field to the given vector of float values. " 
  510                    "Field [" + 
m_name + 
"] values has size ["  
 
  529    char *buf = (
char *) ibuf;
 
  531      for (
unsigned int i = 0; i < 
m_dvalues.size(); i++) {
 
  534        memmove(&bufDouble, buf + i * 8, 8);
 
  539      for (
unsigned int i = 0; i < 
m_ivalues.size(); i++) {
 
  542        memmove(&bufInt, buf + i * 4, 4);
 
  548      for (
int i = 0; i < 
bytes(); i++) {
 
  553      for (
unsigned int i = 0; i < 
m_rvalues.size(); i++) {
 
  556        memmove(&bufFloat, buf + i * 4, 4);
 
  561      string msg = 
"Undefined field type [" + 
IString(
m_type) + 
"].";
 
 
  577      QString msg = 
"Unable to set field to the given string value. Field [" + 
m_name + 
"] Type is not Text.";
 
 
  610  QString TableField::toString(
const TableField &field, QString delimiter){
 
  611    QString fieldValues = 
"";
 
  612    if (field.size()== 1){
 
  614        fieldValues = (QString)field;
 
  616      else if (field.isInteger()){
 
  619      else if (field.isDouble()){
 
  629        fieldValues +=(QString)field;
 
  631      else if (field.isInteger()){
 
  632        vector< int > currField = field;
 
  633        for (
int i = 0;i <(int)currField.size();i++){
 
  635          if (i <(
int)currField.size()- 1){
 
  637            fieldValues += delimiter;
 
  641      else if (field.isDouble()){
 
  642        vector< double > currField = field;
 
  643        for (
int i = 0;i <(int)currField.size();i++){
 
  645          if (i <(
int)currField.size()- 1){
 
  646            fieldValues += delimiter;
 
  651        vector< float > currField = field;
 
  652        for (
int i = 0;i <(int)currField.size();i++){
 
  654          if (i <(
int)currField.size()- 1){
 
  655            fieldValues += delimiter;
 
@ Unknown
A type of error that cannot be classified as any of the other error types.
 
@ Programmer
This error is for when a programmer made an API call that was illegal.
 
Adds specific functionality to C++ strings.
 
Contains multiple PvlContainers.
 
A single keyword-value pair.
 
Class for storing an Isis::Table's field information.
 
std::vector< float > m_rvalues
Vector containing Real field values.
 
int m_bytes
Number of bytes in field.
 
bool isInteger() const
Determines whether the field type is Integer.
 
std::vector< double > m_dvalues
Vector containing double field values.
 
bool isDouble() const
Determines whether the field type is Double.
 
bool isReal() const
Determines whether the field type is Text.
 
QString name() const
Returns the name of the TableField.
 
Type
This enum describes the value type for the TableField.
 
@ Integer
The values in the field are 4 byte integers.
 
@ Real
The values in the field are 4 byte reals or floats.
 
@ Text
The values in the field are text strings with 1 byte per character.
 
@ Double
The values in the field are 8 byte doubles.
 
int size() const
Returns the number of values stored for the field at each record.
 
PvlGroup pvlGroup()
Creates and returns a PvlGroup named "Field" containing the following keywords and their respective v...
 
bool isText() const
Determines whether the field type is Text.
 
QString m_name
Field name.
 
TableField(const QString &name, Type type, int size=1)
Constructs a TableField object with the given field name, field value type, and field size.
 
Type type() const
Returns the enumerated value of the TableField value's type.
 
int bytes() const
Returns the number of bytes in the field value.
 
std::vector< int > m_ivalues
Vector containing integer field values.
 
~TableField()
Destroys the TableField object.
 
QString m_svalue
String containing text value of field.
 
Type m_type
Field value type.
 
void operator=(const int value)
Sets field value equal to input if TableField::Type is Integer and size is 1.
 
This is free and unencumbered software released into the public domain.
 
QString toString(bool boolToConvert)
Global function to convert a boolean to a string.
 
Namespace for the standard library.