Isis 3 Programmer Reference
TableField.h
1 #ifndef TableField_h
2 #define TableField_h
3 
8 /* SPDX-License-Identifier: CC0-1.0 */
9 #include <vector>
10 
11 #include <QString>
12 
13 namespace Isis {
14  class PvlGroup;
47  class TableField {
48  public:
52  enum Type {
55  Text,
57  Real
58  };
59 
60  //Constructors and Destructor
61  TableField(const QString &name, Type type, int size = 1);
62  TableField(PvlGroup &field);
63  ~TableField();
64 
65 
66  QString name() const;
67  Type type() const;
68  bool isInteger() const;
69  bool isDouble() const;
70  bool isText() const;
71  bool isReal() const;
72  int bytes() const;
73  int size() const;
74 
75  operator int() const;
76  operator double() const;
77  operator float() const;
78  operator QString() const;
79  operator std::vector<int>() const;
80  operator std::vector<double>() const;
81  operator std::vector<float>() const;
82 
83  void operator=(const int value);
84  void operator=(const double value);
85  void operator=(const float value);
86  void operator=(const QString &value);
87  void operator=(const std::vector<int> &values);
88  void operator=(const std::vector<double> &values);
89  void operator=(const std::vector<float> &value);
90  void operator=(const char *buf);
91  void operator=(const void *buf);
92 
94 
95  static QString toString(const TableField &field, QString delimiter = ",");
96 
97  private:
98  QString m_name;
100  int m_size;
102  int m_bytes;
103  std::vector<int> m_ivalues;
106  std::vector<double> m_dvalues;
109  std::vector<float> m_rvalues;
112  QString m_svalue;
115  };
116 };
117 
118 #endif
Isis::TableField::type
Type type() const
Returns the enumerated value of the TableField value's type.
Definition: TableField.cpp:112
Isis::TableField::m_type
Type m_type
Field value type.
Definition: TableField.h:99
Isis::TableField::m_size
int m_size
Field size.
Definition: TableField.h:100
Isis::TableField::isInteger
bool isInteger() const
Determines whether the field type is Integer.
Definition: TableField.cpp:122
Isis::TableField::TableField
TableField(const QString &name, Type type, int size=1)
Constructs a TableField object with the given field name, field value type, and field size.
Definition: TableField.cpp:25
Isis::PvlGroup
Contains multiple PvlContainers.
Definition: PvlGroup.h:41
Isis::TableField::isReal
bool isReal() const
Determines whether the field type is Text.
Definition: TableField.cpp:150
Isis::TableField::bytes
int bytes() const
Returns the number of bytes in the field value.
Definition: TableField.cpp:159
Isis::TableField::Integer
@ Integer
The values in the field are 4 byte integers.
Definition: TableField.h:53
Isis::TableField::m_name
QString m_name
Field name.
Definition: TableField.h:98
Isis::TableField::m_ivalues
std::vector< int > m_ivalues
Vector containing integer field values.
Definition: TableField.h:103
Isis::TableField::Double
@ Double
The values in the field are 8 byte doubles.
Definition: TableField.h:54
Isis::TableField::~TableField
~TableField()
Destroys the TableField object.
Definition: TableField.cpp:89
Isis::TableField::m_svalue
QString m_svalue
String containing text value of field.
Definition: TableField.h:112
Isis::TableField::isDouble
bool isDouble() const
Determines whether the field type is Double.
Definition: TableField.cpp:132
Isis::TableField::size
int size() const
Returns the number of values stored for the field at each record.
Definition: TableField.cpp:168
Isis::TableField::name
QString name() const
Returns the name of the TableField.
Definition: TableField.cpp:97
Isis::TableField::pvlGroup
PvlGroup pvlGroup()
Creates and returns a PvlGroup named "Field" containing the following keywords and their respective v...
Definition: TableField.cpp:589
Isis::TableField::m_dvalues
std::vector< double > m_dvalues
Vector containing double field values.
Definition: TableField.h:106
Isis::TableField::isText
bool isText() const
Determines whether the field type is Text.
Definition: TableField.cpp:141
Isis::TableField::m_rvalues
std::vector< float > m_rvalues
Vector containing Real field values.
Definition: TableField.h:109
Isis::TableField::Real
@ Real
The values in the field are 4 byte reals or floats.
Definition: TableField.h:57
Isis::TableField::Text
@ Text
The values in the field are text strings with 1 byte per character.
Definition: TableField.h:55
Isis::TableField::operator=
void operator=(const int value)
Sets field value equal to input if TableField::Type is Integer and size is 1.
Definition: TableField.cpp:350
Isis::TableField::Type
Type
This enum describes the value type for the TableField.
Definition: TableField.h:52
Isis::TableField::m_bytes
int m_bytes
Number of bytes in field.
Definition: TableField.h:102
Isis
This is free and unencumbered software released into the public domain.
Definition: Apollo.h:16
Isis::TableField
Class for storing an Isis::Table's field information.
Definition: TableField.h:47