casa
5.7.0-16
|
Primary interface for the rest of the browser to a table. More...
#include <TBTable.h>
Public Member Functions | |
TBTable (casacore::String filename, DriverParams *dp, bool taql=false) | |
Constructor that takes the filename and driver parameters. More... | |
~TBTable () | |
casacore::String | getFile () |
Returns the filename where this table is located. More... | |
casacore::String | getName () |
Returns the name of this table (which the last the part of the filename). More... | |
DriverParams * | getDriverParams () |
Returns the driver parameters for this table. More... | |
std::vector< TBField * > * | getFields () |
Returns the fields for this table. More... | |
TBField * | field (int i) |
Returns the field at the given index, or NULL if there is none. More... | |
TBField * | field (casacore::String name) |
Returns the field with the given name, or NULL if there is none. More... | |
std::vector< TBKeyword * > * | getTableKeywords () |
Returns the table keywords. More... | |
TBKeyword * | keyword (int i) |
Returns the keyword at the given index, or NULL if there is none. More... | |
TBKeyword * | keyword (casacore::String name) |
Returns the keyword with the given name, or NULL if there is none. More... | |
bool | isReady () |
Indicates if the table is ready for access or not. More... | |
bool | canInsertRows () |
Returns true if the underlying table allows for insertion of rows, false otherwise. More... | |
bool | canDeleteRows () |
Returns true if the underlying table allows for deletion of rows, false otherwise. More... | |
int | getTotalRows () |
Returns the total number of rows in the table. More... | |
int | getLoadedRows () |
Returns the number of rows loaded into the table. More... | |
int | getSelectedRows () |
Returns the number of selected rows. More... | |
int | getNumPages () |
Returns the number of pages in the table. More... | |
int | getPage () |
Return the currently loaded page. More... | |
int | getRowIndex () |
Returns the first loaded row in the table. More... | |
int | getNumFields () |
Returns the number of columns in the table. More... | |
void | setPrintDebug (bool pdb) |
Sets whether the table should print debug information or not. More... | |
TBData * | dataAt (unsigned int row, unsigned int col) |
Returns the data at the given indices, or NULL if they are invalid. More... | |
std::vector< int > | dataDimensionsAt (unsigned int col) |
Returns the shape of the array for the given field, or an empty list if the field is not an array. More... | |
bool | isEditable () |
Returns whether all the columns in this table are editable or not. More... | |
bool | isAnyEditable () |
Returns whether any of the columns in this table are editable or not. More... | |
bool | isEditable (int index) |
Returns whether the column at the given index is editable or not. More... | |
bool | isTaQL () |
Returns whether this table is constructed from a TaQL query or not. More... | |
bool | canRead () |
See TBTableDriver::canRead(). More... | |
bool | canWrite () |
See TBTableDriver::canWrite(). More... | |
bool | tryWriteLock () |
See TBTableDriver::tryWriteLock(). More... | |
bool | releaseWriteLock () |
See TBTableDriver::releaseWriteLock(). More... | |
Result | loadRows (int start=0, int number=TBConstants::DEFAULT_SELECT_NUM, bool full=false, std::vector< casacore::String > *columns=NULL, bool parsedata=true, ProgressHelper *progressPanel=NULL) |
Loads the given rows into the table and returns a Result indicating the success of the loading. More... | |
std::vector< casacore::String > | getColumnHeaders () |
Returns the column headers (field names) for this table. More... | |
std::vector< casacore::String > | getRowHeaders () |
Returns the row headers (row numbers) for the loaded rows in this table. More... | |
TBArrayData * | loadArray (unsigned int row, unsigned int col) |
Loads and returns the array at the given indices. More... | |
bool | releaseArray (unsigned int row, unsigned int col) |
Release the array at the given indices and returns whether the release succeeded. More... | |
Result | editData (unsigned int row, unsigned int col, TBData *newVal) |
Edits the data at the given indices to have the new value and returns whether the operation succeeded. More... | |
Result | editArrayData (unsigned int row, unsigned int col, std::vector< int > coords, TBData *newVal, bool oneDim) |
Updates the table on disk with the new value at the given coordinates in the array at the given row and column. More... | |
void | exportVOTable (casacore::String file, ProgressHelper *progressPanel=NULL) |
Exports the entirety of this table to VOTable XML format to the given file. More... | |
TBPlotData * | plotRows (PlotParams &x, PlotParams &y, int rowFrom, int rowTo, int rowInterval, TBFilterRuleSequence *rule=NULL, ProgressHelper *ph=NULL) |
Returns data used for plotting, using the given plot parameters and row information. More... | |
TBPlotData * | plotIndices (PlotParams &dp, int axis, bool x, int row, TBFilterRuleSequence *rule=NULL, ProgressHelper *ph=NULL) |
Returns data used for plotting (an 1-D array and its indices), using the given plot parameters, slice axis, and row number. More... | |
int | totalRowsOf (casacore::String location) |
Returns the total number of rows for the table at the given location, or -1 for an invalid location or other problem. More... | |
casacore::String | fieldToolTip (int i) |
Returns a tooltip for the field at index i. More... | |
casacore::String | tableToolTip () |
Returns a tooltip for this table. More... | |
Result | insertRows (int n) |
Inserts the given number of rows at the end of the table. More... | |
Result | deleteRows (std::vector< int > r) |
Deletes the given rows from the table. More... | |
Private Member Functions | |
double | getDouble (TBData *d, std::vector< int > *slice, bool complex, bool amp) |
Helper method for plotRows(). More... | |
void | filter (TBPlotData *data, TBTable &table, TBFilterRuleSequence *rules, int rowFrom, int rowTo, int rowInterval) |
Helper method for plotRows(). More... | |
Private Attributes | |
DriverParams * | dParams |
Driver parameters. More... | |
casacore::String | location |
Location of the table. More... | |
bool | ready |
Indicates whether the table is ready for access or not. More... | |
bool | insertRow |
Indicates whether this table allows for the insertion of rows or not. More... | |
bool | removeRow |
Indicates whether this table allows for the deletion of rows or not. More... | |
std::vector< std::vector < TBData * > * > | data |
Holds the table data. More... | |
int | totalRows |
The total number of rows in the table. More... | |
int | loadedRows |
The number of rows currently loaded in the table. More... | |
int | selectedRows |
The last number of rows selected for loading during the last load. More... | |
int | rowIndex |
The index of the first row loaded in this table. More... | |
std::vector< TBField * > | fields |
The table fields. More... | |
std::vector< TBKeyword * > | keywords |
The table keywords. More... | |
std::vector< int > | subtableRows |
Cache of total number of rows for subtables. More... | |
std::vector< bool > | writable |
Indicates whether this table is writable or not. More... | |
bool | taql |
Indates whether this table was constructed from a TaQL command or not. More... | |
TBTableDriver * | driver |
casacore::Table driver. More... | |
Primary interface for the rest of the browser to a table.
Although TBTable is considered the table backend, it is actually more like an interface over a TBTableDriver. However, since there may be multiple implementations of the driver, the table provides a unified interface over the driver as well as other useful operations. Generally speaking, the driver handles dealing with the table on disk while the TBTable handles dealing with the data represented in memory.
casa::TBTable::TBTable | ( | casacore::String | filename, |
DriverParams * | dp, | ||
bool | taql = false |
||
) |
Constructor that takes the filename and driver parameters.
If taql is true, then this table is a table constructed from a TaQL command stored in filename; otherwise filename holds the location on disk of the table.
casa::TBTable::~TBTable | ( | ) |
bool casa::TBTable::canDeleteRows | ( | ) |
Returns true if the underlying table allows for deletion of rows, false otherwise.
bool casa::TBTable::canInsertRows | ( | ) |
Returns true if the underlying table allows for insertion of rows, false otherwise.
bool casa::TBTable::canRead | ( | ) |
bool casa::TBTable::canWrite | ( | ) |
TBData* casa::TBTable::dataAt | ( | unsigned int | row, |
unsigned int | col | ||
) |
Returns the data at the given indices, or NULL if they are invalid.
std::vector<int> casa::TBTable::dataDimensionsAt | ( | unsigned int | col | ) |
Returns the shape of the array for the given field, or an empty list if the field is not an array.
Result casa::TBTable::deleteRows | ( | std::vector< int > | r | ) |
Deletes the given rows from the table.
Each element in the vector should be a row number. Returns a Result indicating the success of the operation.
Result casa::TBTable::editArrayData | ( | unsigned int | row, |
unsigned int | col, | ||
std::vector< int > | coords, | ||
TBData * | newVal, | ||
bool | oneDim | ||
) |
Updates the table on disk with the new value at the given coordinates in the array at the given row and column.
oneDim must be true for a one-dimensional array, false otherwise. Returns a result indicating the success of the editing.
Edits the data at the given indices to have the new value and returns whether the operation succeeded.
void casa::TBTable::exportVOTable | ( | casacore::String | file, |
ProgressHelper * | progressPanel = NULL |
||
) |
Exports the entirety of this table to VOTable XML format to the given file.
If a ProgressHelper is provided, progress information is updated periodically.
TBField* casa::TBTable::field | ( | int | i | ) |
Returns the field at the given index, or NULL if there is none.
TBField* casa::TBTable::field | ( | casacore::String | name | ) |
Returns the field with the given name, or NULL if there is none.
casacore::String casa::TBTable::fieldToolTip | ( | int | i | ) |
Returns a tooltip for the field at index i.
|
private |
Helper method for plotRows().
std::vector<casacore::String> casa::TBTable::getColumnHeaders | ( | ) |
Returns the column headers (field names) for this table.
|
private |
Helper method for plotRows().
DriverParams* casa::TBTable::getDriverParams | ( | ) |
Returns the driver parameters for this table.
std::vector<TBField*>* casa::TBTable::getFields | ( | ) |
Returns the fields for this table.
casacore::String casa::TBTable::getFile | ( | ) |
Returns the filename where this table is located.
int casa::TBTable::getLoadedRows | ( | ) |
Returns the number of rows loaded into the table.
casacore::String casa::TBTable::getName | ( | ) |
Returns the name of this table (which the last the part of the filename).
If this is a TaQL table, returns "TaQL casacore::Table".
int casa::TBTable::getNumFields | ( | ) |
Returns the number of columns in the table.
int casa::TBTable::getNumPages | ( | ) |
Returns the number of pages in the table.
int casa::TBTable::getPage | ( | ) |
Return the currently loaded page.
std::vector<casacore::String> casa::TBTable::getRowHeaders | ( | ) |
Returns the row headers (row numbers) for the loaded rows in this table.
int casa::TBTable::getRowIndex | ( | ) |
Returns the first loaded row in the table.
int casa::TBTable::getSelectedRows | ( | ) |
Returns the number of selected rows.
Note: this may be different than the number of loaded rows. For example, if you load rows [0 - 1000] but the table has only 20 rows, getSelectedRows() would return 1000 while getLoadedRows() would return 20.
std::vector<TBKeyword*>* casa::TBTable::getTableKeywords | ( | ) |
Returns the table keywords.
int casa::TBTable::getTotalRows | ( | ) |
Returns the total number of rows in the table.
Result casa::TBTable::insertRows | ( | int | n | ) |
Inserts the given number of rows at the end of the table.
Returns a Result indicating the success of the operation.
bool casa::TBTable::isAnyEditable | ( | ) |
Returns whether any of the columns in this table are editable or not.
bool casa::TBTable::isEditable | ( | ) |
Returns whether all the columns in this table are editable or not.
bool casa::TBTable::isEditable | ( | int | index | ) |
Returns whether the column at the given index is editable or not.
bool casa::TBTable::isReady | ( | ) |
Indicates if the table is ready for access or not.
bool casa::TBTable::isTaQL | ( | ) |
Returns whether this table is constructed from a TaQL query or not.
TBKeyword* casa::TBTable::keyword | ( | int | i | ) |
Returns the keyword at the given index, or NULL if there is none.
TBKeyword* casa::TBTable::keyword | ( | casacore::String | name | ) |
Returns the keyword with the given name, or NULL if there is none.
TBArrayData* casa::TBTable::loadArray | ( | unsigned int | row, |
unsigned int | col | ||
) |
Loads and returns the array at the given indices.
Result casa::TBTable::loadRows | ( | int | start = 0 , |
int | number = TBConstants::DEFAULT_SELECT_NUM , |
||
bool | full = false , |
||
std::vector< casacore::String > * | columns = NULL , |
||
bool | parsedata = true , |
||
ProgressHelper * | progressPanel = NULL |
||
) |
Loads the given rows into the table and returns a Result indicating the success of the loading.
The rows loaded will be from start to start + number (inclusive). If full is true, array data will be included; otherwise only the shapes of the array will be included. If columns is a non-NULL, non-empty list, then only those fields will be loaded into the table. If parsedata is true, the table data will be loaded; otherwise only the meta-data will be loaded. If a ProgressHelper is provided, the label and progress meter will be periodically updated as progress is made.
TBPlotData* casa::TBTable::plotIndices | ( | PlotParams & | dp, |
int | axis, | ||
bool | x, | ||
int | row, | ||
TBFilterRuleSequence * | rule = NULL , |
||
ProgressHelper * | ph = NULL |
||
) |
Returns data used for plotting (an 1-D array and its indices), using the given plot parameters, slice axis, and row number.
If a ProgressHelperis provided, progress information is updated periodically.
TBPlotData* casa::TBTable::plotRows | ( | PlotParams & | x, |
PlotParams & | y, | ||
int | rowFrom, | ||
int | rowTo, | ||
int | rowInterval, | ||
TBFilterRuleSequence * | rule = NULL , |
||
ProgressHelper * | ph = NULL |
||
) |
Returns data used for plotting, using the given plot parameters and row information.
If a ProgressHelper is provided, progress information is updated periodically.
bool casa::TBTable::releaseArray | ( | unsigned int | row, |
unsigned int | col | ||
) |
Release the array at the given indices and returns whether the release succeeded.
bool casa::TBTable::releaseWriteLock | ( | ) |
void casa::TBTable::setPrintDebug | ( | bool | pdb | ) |
Sets whether the table should print debug information or not.
casacore::String casa::TBTable::tableToolTip | ( | ) |
Returns a tooltip for this table.
int casa::TBTable::totalRowsOf | ( | casacore::String | location | ) |
Returns the total number of rows for the table at the given location, or -1 for an invalid location or other problem.
TBTable caches the total rows of all subtables (i.e., tables pointed to in the table keywords).
bool casa::TBTable::tryWriteLock | ( | ) |
|
private |
|
private |
|
private |
casacore::Table driver.
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |