casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Private Member Functions | Private Attributes | List of all members
casa::TBTable Class Reference

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...
 
DriverParamsgetDriverParams ()
 Returns the driver parameters for this table. More...
 
std::vector< TBField * > * getFields ()
 Returns the fields for this table. More...
 
TBFieldfield (int i)
 Returns the field at the given index, or NULL if there is none. More...
 
TBFieldfield (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...
 
TBKeywordkeyword (int i)
 Returns the keyword at the given index, or NULL if there is none. More...
 
TBKeywordkeyword (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...
 
TBDatadataAt (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::StringgetColumnHeaders ()
 Returns the column headers (field names) for this table. More...
 
std::vector< casacore::StringgetRowHeaders ()
 Returns the row headers (row numbers) for the loaded rows in this table. More...
 
TBArrayDataloadArray (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...
 
TBPlotDataplotRows (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...
 
TBPlotDataplotIndices (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

DriverParamsdParams
 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...
 
TBTableDriverdriver
 casacore::Table driver. More...
 

Detailed Description

Primary interface for the rest of the browser to a table.

Synopsis

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.

Definition at line 152 of file TBTable.h.

Constructor & Destructor Documentation

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 ( )

Member Function Documentation

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.

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 ( 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.

void casa::TBTable::filter ( TBPlotData data,
TBTable table,
TBFilterRuleSequence rules,
int  rowFrom,
int  rowTo,
int  rowInterval 
)
private

Helper method for plotRows().

std::vector<casacore::String> casa::TBTable::getColumnHeaders ( )

Returns the column headers (field names) for this table.

double casa::TBTable::getDouble ( TBData d,
std::vector< int > *  slice,
bool  complex,
bool  amp 
)
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 ( )

Member Data Documentation

std::vector< std::vector<TBData*>* > casa::TBTable::data
private

Holds the table data.

Definition at line 356 of file TBTable.h.

DriverParams* casa::TBTable::dParams
private

Driver parameters.

Definition at line 341 of file TBTable.h.

TBTableDriver* casa::TBTable::driver
private

casacore::Table driver.

Definition at line 386 of file TBTable.h.

std::vector<TBField*> casa::TBTable::fields
private

The table fields.

Definition at line 371 of file TBTable.h.

bool casa::TBTable::insertRow
private

Indicates whether this table allows for the insertion of rows or not.

Definition at line 350 of file TBTable.h.

std::vector<TBKeyword*> casa::TBTable::keywords
private

The table keywords.

Definition at line 374 of file TBTable.h.

int casa::TBTable::loadedRows
private

The number of rows currently loaded in the table.

Definition at line 362 of file TBTable.h.

casacore::String casa::TBTable::location
private

Location of the table.

Definition at line 344 of file TBTable.h.

bool casa::TBTable::ready
private

Indicates whether the table is ready for access or not.

Definition at line 347 of file TBTable.h.

bool casa::TBTable::removeRow
private

Indicates whether this table allows for the deletion of rows or not.

Definition at line 353 of file TBTable.h.

int casa::TBTable::rowIndex
private

The index of the first row loaded in this table.

Definition at line 368 of file TBTable.h.

int casa::TBTable::selectedRows
private

The last number of rows selected for loading during the last load.

Definition at line 365 of file TBTable.h.

std::vector<int> casa::TBTable::subtableRows
private

Cache of total number of rows for subtables.

Definition at line 377 of file TBTable.h.

bool casa::TBTable::taql
private

Indates whether this table was constructed from a TaQL command or not.

Definition at line 383 of file TBTable.h.

int casa::TBTable::totalRows
private

The total number of rows in the table.

Definition at line 359 of file TBTable.h.

std::vector<bool> casa::TBTable::writable
private

Indicates whether this table is writable or not.

Definition at line 380 of file TBTable.h.


The documentation for this class was generated from the following file: