casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Public Member Functions | Private Member Functions | Private Attributes
casa::TBTable Class Reference

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

#include <TBTable.h>

List of all members.

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

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

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 156 of file TBTable.h.


Constructor & Destructor Documentation

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.


Member Function Documentation

Returns true if the underlying table allows for deletion of rows, false otherwise.

Returns true if the underlying table allows for insertion of rows, false otherwise.

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.

Returns the field at the given index, or NULL if there is none.

Returns the field with the given name, or NULL if there is none.

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

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.

Returns the fields for this table.

Returns the filename where this table is located.

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

Returns the number of columns in the table.

Returns the number of pages in the table.

Return the currently loaded page.

Returns the row headers (row numbers) for the loaded rows in this table.

Returns the first loaded row in the table.

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.

Returns the table keywords.

Returns the total number of rows in the table.

Inserts the given number of rows at the end of the table.

Returns a Result indicating the success of the operation.

Returns whether any of the columns in this table are editable or not.

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.

Indicates if the table is ready for access or not.

Returns whether this table is constructed from a TaQL query or not.

Returns the keyword at the given index, or NULL if there is none.

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.

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


Member Data Documentation

vector< vector<TBData*>* > casa::TBTable::data [private]

Holds the table data.

  

Definition at line 360 of file TBTable.h.

Driver parameters.

Definition at line 345 of file TBTable.h.

Table driver.

Definition at line 390 of file TBTable.h.

vector<TBField*> casa::TBTable::fields [private]

The table fields.

Definition at line 375 of file TBTable.h.

bool casa::TBTable::insertRow [private]

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

Definition at line 354 of file TBTable.h.

vector<TBKeyword*> casa::TBTable::keywords [private]

The table keywords.

Definition at line 378 of file TBTable.h.

The number of rows currently loaded in the table.

Definition at line 366 of file TBTable.h.

Location of the table.

Definition at line 348 of file TBTable.h.

bool casa::TBTable::ready [private]

Indicates whether the table is ready for access or not.

Definition at line 351 of file TBTable.h.

bool casa::TBTable::removeRow [private]

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

Definition at line 357 of file TBTable.h.

int casa::TBTable::rowIndex [private]

The index of the first row loaded in this table.

Definition at line 372 of file TBTable.h.

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

Definition at line 369 of file TBTable.h.

vector<int> casa::TBTable::subtableRows [private]

Cache of total number of rows for subtables.

Definition at line 381 of file TBTable.h.

bool casa::TBTable::taql [private]

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

Definition at line 387 of file TBTable.h.

int casa::TBTable::totalRows [private]

The total number of rows in the table.

Definition at line 363 of file TBTable.h.

vector<bool> casa::TBTable::writable [private]

Indicates whether this table is writable or not.

Definition at line 384 of file TBTable.h.


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