File failed to load: https://isis.astrogeology.usgs.gov/dev/Object/assets/jax/output/NativeMML/config.js
Isis Developer Reference
Table.h
Go to the documentation of this file.
1#ifndef Table_h
2#define Table_h
7
8/* SPDX-License-Identifier: CC0-1.0 */
9#include "Pvl.h"
10#include <vector>
11#include "TableRecord.h"
12
13namespace Isis {
14 class Blob;
61 class Table {
62 public:
72
73 // Constructors and Destructors
75 Table(Blob &blob);
76 Table(const QString &tableName, TableRecord &rec);
77 Table(const QString &tableName);// Only use this constructor for reading in an existing table
78 Table(const QString &tableName, const QString &file);
79 Table(const QString &tableName, const QString &file,
80 const Pvl &fileHeader);
81 Table(const Table &other);
82 Table(const QString &tableName, const std::string &tableString, const char &fieldDelimiter, const std::vector<PvlKeyword> &tableAttrs={});
83 Table &operator=(const Isis::Table &other);
84
85 ~Table();
86
87
88 void Write(const QString &file);
89
90 QString Name() const;
92
93 void SetAssociation(const Table::Association assoc);
94 bool IsSampleAssociated();
95 bool IsLineAssociated();
96 bool IsBandAssociated();
97
98 int Records() const;
99 int RecordFields() const;
100 int RecordSize() const;
101
102 // Read a record
103 TableRecord &operator[](const int index);
104
105 // Add a record
106 void operator+=(TableRecord &rec);
107
108 // Update a record
109 void Update(const TableRecord &rec, const int index);
110
111 // Delete a record
112 void Delete(const int index);
113
114 void Clear();
115
116 Blob toBlob() const;
117
118
119 static QString toString(Table table, QString fieldDelimiter=",");
120
121
122 protected:
123
124 void initFromBlob(Blob &blob);
125
127 std::vector<char *> p_recbufs;
128
131
133 bool p_swap;
134
135 QString p_name;
137 };
138};
139
140#endif
Definition Blob.h:53
Container for cube-like labels.
Definition Pvl.h:122
Contains Pvl Groups and Pvl Objects.
Definition PvlObject.h:61
Class for storing Table blobs information.
Definition Table.h:61
~Table()
Destroys the Table object.
Definition Table.cpp:291
QString p_name
The name of the Table.
Definition Table.h:135
int RecordSize() const
Returns the number of bytes per record.
Definition Table.cpp:400
int RecordFields() const
Returns the number of fields per record.
Definition Table.cpp:390
bool IsSampleAssociated()
Checks to see if association is Samples.
Definition Table.cpp:348
Association p_assoc
Association Type of the table.
Definition Table.h:132
void Delete(const int index)
Deletes a TableRecord from the Table.
Definition Table.cpp:459
int p_records
Holds record count read from labels, may differ from the size of p_recbufs.
Definition Table.h:129
int Records() const
Returns the number of records.
Definition Table.cpp:380
PvlObject & Label()
The Table's label.
Definition Table.cpp:327
void Write(const QString &file)
Write the Table to a file.
Definition Table.cpp:303
bool p_swap
Only used for reading.
Definition Table.h:133
void operator+=(TableRecord &rec)
Adds a TableRecord to the Table.
Definition Table.cpp:423
void SetAssociation(const Table::Association assoc)
Sets the association to the input parameter.
Definition Table.cpp:337
TableRecord & operator[](const int index)
Reads a TableRecord from the Table.
Definition Table.cpp:412
QString Name() const
The Table's name.
Definition Table.cpp:314
std::vector< char * > p_recbufs
Buffers containing record values.
Definition Table.h:127
TableRecord p_record
The current table record.
Definition Table.h:126
bool IsBandAssociated()
Checks to see if association is Bands.
Definition Table.cpp:370
bool IsLineAssociated()
Checks to see if association is Lines.
Definition Table.cpp:359
Table(const QString &tableName, const std::string &tableString, const char &fieldDelimiter, const std::vector< PvlKeyword > &tableAttrs={})
Table & operator=(const Isis::Table &other)
Sets the Table equal to the input Table object.
Definition Table.cpp:267
void Clear()
Clear the table of all records.
Definition Table.cpp:470
Association
Definition Table.h:66
@ Lines
Definition Table.h:69
@ Samples
Definition Table.h:68
@ Bands
Definition Table.h:70
@ None
Definition Table.h:67
void Update(const TableRecord &rec, const int index)
Updates a TableRecord.
Definition Table.cpp:449
void initFromBlob(Blob &blob)
Initialize a Table from a Blob that has been read from a file.
Definition Table.cpp:213
static QString toString(Table table, QString fieldDelimiter=",")
Convert the data from a Table into a string.
Definition Table.cpp:547
PvlObject p_label
The label for storing additional information.
Definition Table.h:136
Blob toBlob() const
Serialze the Table to a Blob that can be written to a file.
Definition Table.cpp:481
Definition TableRecord.h:38
This is free and unencumbered software released into the public domain.
Definition Apollo.h:16