casa
$Rev:20696$
|
Primary interface for the rest of the browser to a table. More...
#include <TBTable.h>
Public Member Functions | |
TBTable (String filename, DriverParams *dp, bool taql=false) | |
Constructor that takes the filename and driver parameters. | |
~TBTable () | |
String | getFile () |
Returns the filename where this table is located. | |
String | getName () |
Returns the name of this table (which the last the part of the filename). | |
DriverParams * | getDriverParams () |
Returns the driver parameters for this table. | |
vector< TBField * > * | getFields () |
Returns the fields for this table. | |
TBField * | field (int i) |
Returns the field at the given index, or NULL if there is none. | |
TBField * | field (String name) |
Returns the field with the given name, or NULL if there is none. | |
vector< TBKeyword * > * | getTableKeywords () |
Returns the table keywords. | |
TBKeyword * | keyword (int i) |
Returns the keyword at the given index, or NULL if there is none. | |
TBKeyword * | keyword (String name) |
Returns the keyword with the given name, or NULL if there is none. | |
bool | isReady () |
Indicates if the table is ready for access or not. | |
bool | canInsertRows () |
Returns true if the underlying table allows for insertion of rows, false otherwise. | |
bool | canDeleteRows () |
Returns true if the underlying table allows for deletion of rows, false otherwise. | |
int | getTotalRows () |
Returns the total number of rows in the table. | |
int | getLoadedRows () |
Returns the number of rows loaded into the table. | |
int | getSelectedRows () |
Returns the number of selected rows. | |
int | getNumPages () |
Returns the number of pages in the table. | |
int | getPage () |
Return the currently loaded page. | |
int | getRowIndex () |
Returns the first loaded row in the table. | |
int | getNumFields () |
Returns the number of columns in the table. | |
void | setPrintDebug (bool pdb) |
Sets whether the table should print debug information or not. | |
TBData * | dataAt (unsigned int row, unsigned int col) |
Returns the data at the given indices, or NULL if they are invalid. | |
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. | |
bool | isEditable () |
Returns whether all the columns in this table are editable or not. | |
bool | isAnyEditable () |
Returns whether any of the columns in this table are editable or not. | |
bool | isEditable (int index) |
Returns whether the column at the given index is editable or not. | |
bool | isTaQL () |
Returns whether this table is constructed from a TaQL query or not. | |
bool | canRead () |
See TBTableDriver::canRead(). | |
bool | canWrite () |
See TBTableDriver::canWrite(). | |
bool | tryWriteLock () |
See TBTableDriver::tryWriteLock(). | |
bool | releaseWriteLock () |
See TBTableDriver::releaseWriteLock(). | |
Result | loadRows (int start=0, int number=TBConstants::DEFAULT_SELECT_NUM, bool full=false, vector< 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. | |
vector< String > | getColumnHeaders () |
Returns the column headers (field names) for this table. | |
vector< String > | getRowHeaders () |
Returns the row headers (row numbers) for the loaded rows in this table. | |
TBArrayData * | loadArray (unsigned int row, unsigned int col) |
Loads and returns the array at the given indices. | |
bool | releaseArray (unsigned int row, unsigned int col) |
Release the array at the given indices and returns whether the release succeeded. | |
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. | |
Result | editArrayData (unsigned int row, unsigned int col, 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. | |
void | exportVOTable (String file, ProgressHelper *progressPanel=NULL) |
Exports the entirety of this table to VOTable XML format to the given file. | |
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. | |
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. | |
int | totalRowsOf (String location) |
Returns the total number of rows for the table at the given location, or -1 for an invalid location or other problem. | |
String | fieldToolTip (int i) |
Returns a tooltip for the field at index i. | |
String | tableToolTip () |
Returns a tooltip for this table. | |
Result | insertRows (int n) |
Inserts the given number of rows at the end of the table. | |
Result | deleteRows (vector< int > r) |
Deletes the given rows from the table. | |
Private Member Functions | |
double | getDouble (TBData *d, vector< int > *slice, bool complex, bool amp) |
Helper method for plotRows(). | |
void | filter (TBPlotData *data, TBTable &table, TBFilterRuleSequence *rules, int rowFrom, int rowTo, int rowInterval) |
Helper method for plotRows(). | |
Private Attributes | |
DriverParams * | dParams |
Driver parameters. | |
String | location |
Location of the table. | |
bool | ready |
Indicates whether the table is ready for access or not. | |
bool | insertRow |
Indicates whether this table allows for the insertion of rows or not. | |
bool | removeRow |
Indicates whether this table allows for the deletion of rows or not. | |
vector< vector< TBData * > * > | data |
Holds the table data. | |
int | totalRows |
The total number of rows in the table. | |
int | loadedRows |
The number of rows currently loaded in the table. | |
int | selectedRows |
The last number of rows selected for loading during the last load. | |
int | rowIndex |
The index of the first row loaded in this table. | |
vector< TBField * > | fields |
The table fields. | |
vector< TBKeyword * > | keywords |
The table keywords. | |
vector< int > | subtableRows |
Cache of total number of rows for subtables. | |
vector< bool > | writable |
Indicates whether this table is writable or not. | |
bool | taql |
Indates whether this table was constructed from a TaQL command or not. | |
TBTableDriver * | driver |
Table driver. |
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 | ( | 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.
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.
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 | ( | 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, | ||
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.
Result casa::TBTable::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.
void casa::TBTable::exportVOTable | ( | 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 | ( | String | name | ) |
Returns the field with the given name, or NULL if there is none.
String casa::TBTable::fieldToolTip | ( | int | i | ) |
Returns a tooltip for the field at index i.
void casa::TBTable::filter | ( | TBPlotData * | data, |
TBTable & | table, | ||
TBFilterRuleSequence * | rules, | ||
int | rowFrom, | ||
int | rowTo, | ||
int | rowInterval | ||
) | [private] |
Helper method for plotRows().
vector<String> casa::TBTable::getColumnHeaders | ( | ) |
Returns the column headers (field names) for this table.
double casa::TBTable::getDouble | ( | TBData * | d, |
vector< int > * | slice, | ||
bool | complex, | ||
bool | amp | ||
) | [private] |
Helper method for plotRows().
Returns the driver parameters for this table.
vector<TBField*>* casa::TBTable::getFields | ( | ) |
Returns the fields for this table.
Returns the filename where this table is located.
int casa::TBTable::getLoadedRows | ( | ) |
Returns the number of rows loaded into the table.
Returns the name of this table (which the last the part of the filename).
If this is a TaQL table, returns "TaQL 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.
vector<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.
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 | ( | 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 , |
||
vector< 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.
void casa::TBTable::setPrintDebug | ( | bool | pdb | ) |
Sets whether the table should print debug information or not.
Returns a tooltip for this table.
int casa::TBTable::totalRowsOf | ( | 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 | ( | ) |
vector< vector<TBData*>* > casa::TBTable::data [private] |
DriverParams* casa::TBTable::dParams [private] |
TBTableDriver* casa::TBTable::driver [private] |
vector<TBField*> casa::TBTable::fields [private] |
bool casa::TBTable::insertRow [private] |
vector<TBKeyword*> casa::TBTable::keywords [private] |
int casa::TBTable::loadedRows [private] |
String casa::TBTable::location [private] |
bool casa::TBTable::ready [private] |
bool casa::TBTable::removeRow [private] |
int casa::TBTable::rowIndex [private] |
int casa::TBTable::selectedRows [private] |
vector<int> casa::TBTable::subtableRows [private] |
bool casa::TBTable::taql [private] |
int casa::TBTable::totalRows [private] |
vector<bool> casa::TBTable::writable [private] |