casa
$Rev:20696$
|
High-level interface to tables. More...
#include <TableProxy.h>
Public Member Functions | |
TableProxy () | |
Default constructor initializes to not open. | |
TableProxy (const Table &table) | |
Create the object from an existing table (used by some methods). | |
TableProxy (const String &tableName, const Record &lockOptions, int option) | |
Open the table with a given name. | |
TableProxy (const String &tableName, const Record &lockOptions, const String &endianFormat, const String &memType, int nrow, const Record &tableDesc, const Record &dmInfo) | |
Create a table with given name and description, etc. | |
TableProxy (const Vector< String > &tableNames, const Vector< String > &concatenateSubTableNames, const Record &lockOptions, int option) | |
Create a table object to concatenate a number of similar tables. | |
TableProxy (const std::vector< TableProxy > &tables, const Vector< String > &concatenateSubTableNames, int dummy1=0, int dummy2=0, int dummy3=0) | |
TableProxy (const String &command, const std::vector< TableProxy > &tables) | |
Create a table object from a table command (as defined in TableGram). | |
TableProxy (const String &fileName, const String &headerName, const String &tableName, Bool autoHeader, const IPosition &autoShape, const String &separator, const String &commentMarker, Int firstLine, Int lastLine, const Vector< String > &columnNames=Vector< String >(), const Vector< String > &dataTypes=Vector< String >()) | |
Create a table from an Ascii file. | |
TableProxy (const TableProxy &) | |
Copy constructor. | |
~TableProxy () | |
Close the table. | |
TableProxy & | operator= (const TableProxy &) |
Assignment. | |
TableProxy | selectRows (const Vector< Int > &rownrs, const String &outName) |
Select the given rows from the table and create a new (reference) table. | |
void | reopenRW () |
Reopen the table for read/write. | |
void | resync () |
Resync the table. | |
void | flush (Bool recursive) |
Flush the table and optionally all its subtables. | |
void | close () |
Flush and close the table and all its subtables. | |
String | endianFormat () const |
Get the endian format of the table. | |
void | lock (Bool mode, Int nattempts) |
Acquire a (read or write) lock on the table. | |
void | unlock () |
Release a lock on the table. | |
Bool | hasDataChanged () |
Determine if data in the table has changed. | |
Bool | hasLock (Bool mode) |
Determine if the process has a read or write lock on the table. | |
Record | lockOptions () |
Get the lock options of the table. | |
Bool | isMultiUsed (Bool checkSubTables) |
Determine if the table (and optionally its subtables) are in use in another process. | |
String | toAscii (const String &asciiFile, const String &headerFile, const Vector< String > &columns, const String &sep, const Vector< Int > &precision, Bool useBrackets) |
Write the table to an ASCII file (approximately the inverse of the from-ASCII-contructor). | |
void | rename (const String &newTableName) |
Rename the table. | |
TableProxy | copy (const String &newTableName, Bool toMemoryTable, Bool deepCopy, Bool valueCopy, const String &endianFormat, const Record &dminfo, Bool noRows) |
Copy the table (possibly a deep copy). | |
void | copyRows (TableProxy &out, Int startIn, Int startOut, Int nrow) |
Copy rows from one table to another. | |
void | deleteTable (Bool checkSubTables) |
Close and delete the table. | |
Record | tableInfo () |
Get the table info of the table. | |
void | putTableInfo (const Record &value) |
Put the table info of the table. | |
void | addReadmeLine (const String &line) |
Add a line to the TableInfo readme. | |
Bool | isReadable () const |
Test if a table is readable. | |
Bool | isWritable () const |
Test if a table is writable. | |
void | setMaximumCacheSize (const String &columnName, Int nbytes) |
Set the maximum cache size for the given column in the table. | |
void | addColumns (const Record &tableDesc, const Record &dminfo, Bool addToParent) |
Add one or more columns to the table. | |
void | renameColumn (const String &nameOld, const String &nameNew) |
Rename a column in the table. | |
void | removeColumns (const Vector< String > &columnNames) |
Remove one or more columns from the table. | |
void | addRow (Int nrow) |
Add rows to the table. | |
void | removeRow (const Vector< Int > &rownrs) |
Remove rows from the table. | |
ValueHolder | getColumn (const String &columnName, Int row, Int nrow, Int incr) |
Get some or all values from a column in the table. | |
Record | getVarColumn (const String &columnName, Int row, Int nrow, Int incr) |
ValueHolder | getColumnSlice (const String &columnName, Int row, Int nrow, Int incr, const Vector< Int > &blc, const Vector< Int > &trc, const Vector< Int > &inc) |
Get some or all value slices from a column in the table. | |
ValueHolder | getColumnSliceIP (const String &columnName, const IPosition &blc, const IPosition &trc, const IPosition &inc, Int row, Int nrow, Int incr) |
void | putColumn (const String &columnName, Int row, Int nrow, Int incr, const ValueHolder &) |
Put some or all values into a column in the table. | |
void | putVarColumn (const String &columnName, Int row, Int nrow, Int incr, const Record &values) |
void | putColumnSlice (const String &columnName, Int row, Int nrow, Int incr, const Vector< Int > &blc, const Vector< Int > &trc, const Vector< Int > &inc, const ValueHolder &) |
Put some or all value slices into a column in the table. | |
void | putColumnSliceIP (const String &columnName, const ValueHolder &, const IPosition &blc, const IPosition &trc, const IPosition &inc, Int row, Int nrow, Int incr) |
Bool | cellContentsDefined (const String &columnName, Int rownr) |
Tests if the contents of a cell are defined. | |
ValueHolder | getCell (const String &columnName, Int row) |
Get a value from a column in the table. | |
ValueHolder | getCellSlice (const String &columnName, Int row, const Vector< Int > &blc, const Vector< Int > &trc, const Vector< Int > &inc) |
Get a value slice from a column in the table. | |
ValueHolder | getCellSliceIP (const String &columnName, Int row, const IPosition &blc, const IPosition &trc, const IPosition &inc) |
void | putCell (const String &columnName, const Vector< Int > &rownrs, const ValueHolder &) |
Put a value into a column in the table. | |
void | putCellSlice (const String &columnName, Int row, const Vector< Int > &blc, const Vector< Int > &trc, const Vector< Int > &inc, const ValueHolder &) |
Put a value slice into a column in the table. | |
void | putCellSliceIP (const String &columnName, Int row, const ValueHolder &, const IPosition &blc, const IPosition &trc, const IPosition &inc) |
Vector< String > | getColumnShapeString (const String &columnName, Int rownr, Int nrow, Int incr, Bool cOrder=False) |
Get the shape of one or more cells in a column as a vector of Strings containing the shapes as [a,b,c]. | |
ValueHolder | getKeyword (const String &columnName, const String &keywordName, Int keywordIndex) |
Get a table or column keyword value in the table. | |
Record | getKeywordSet (const String &columnName) |
Get the table or column keyword values in the table. | |
void | putKeyword (const String &columnName, const String &keywordName, Int keywordIndex, Bool makeSubRecord, const ValueHolder &) |
Define a table or column keyword in the table. | |
void | putKeywordSet (const String &columnName, const Record &valueSet) |
Define multiple table or column keywords in the table. | |
void | removeKeyword (const String &columnName, const String &keywordName, Int keywordIndex) |
Remove a table or column keyword from the table. | |
Vector< String > | getFieldNames (const String &columnName, const String &keywordName, Int keywordIndex) |
Get the names of all field in a record in the table. | |
String | tableName () |
Get table name. | |
Vector< String > | getPartNames (Bool recursive) |
Get the names of the parts the table consists of (e.g. | |
Int | ncolumns () |
Get #columns of the table. | |
Int | nrows () |
Get #rows of the table. | |
Vector< Int > | shape () |
Get the shape (#columns, #rows) of the table. | |
Vector< Int > | rowNumbers (TableProxy &other) |
Get the row numbers of the table. | |
Vector< String > | columnNames () |
Get all column names in the table. | |
Bool | isScalarColumn (const String &columnName) |
Return in result if the column contains scalars. | |
String | columnDataType (const String &columnName) |
Return the data type of the column as: Bool, UChar, Short, UShort, Int, UInt, Float, Double, Complex, DComplex, String, Table, or unknown. | |
String | columnArrayType (const String &columnName) |
Return the type of array in the column as: Direct Undefined FixedShape Direct,Undefined Direct,FixedShape Undefined,FixedShape Direct,Undefined,FixedShape or Error -- unexpected column type. | |
Record | getDataManagerInfo () |
Get the data manager info of the table. | |
Record | getProperties (const String &name, Bool byColumn) |
Get the properties of a data manager given by column or data manager name. | |
void | setProperties (const String &name, Bool byColumn, const Record &properties) |
Set the properties of a data manager given by column or data manager name. | |
Record | getTableDescription (Bool actual, Bool cOrder=False) |
Get the table description of the table. | |
Record | getColumnDescription (const String &columnName, Bool actual, Bool cOrder=False) |
Get the column description of a column in the table. | |
String | getAsciiFormat () const |
Get ascii format string. | |
Record | getCalcResult () const |
Get result of possible CALC statement. | |
String | showStructure (Bool showDataMan=True, Bool showColumns=True, Bool showSubTables=False, Bool sortColumns=False) const |
Show the structure of a table. | |
Table & | table () |
Return the table object. | |
const Table & | table () const |
Static Public Member Functions | |
static Record | getKeyValues (const TableRecord &keySet) |
Get or put the values of all keywords. | |
static void | putKeyValues (TableRecord &keySet, const Record &valueSet) |
Private Member Functions | |
Bool | getColInfo (const String &colName, Bool useBrackets, String &type, String &message) |
Get the column info for toAscii. | |
void | printValueHolder (const ValueHolder &vh, ostream &os, const String &sep, Int prec, Bool useBrackets) const |
Print the data in a table cell for toAscii. | |
template<typename T > | |
void | printArray (const Array< T > &arr, ostream &os, const String &sep) const |
void | printArrayValue (ostream &os, Bool v, const String &) const |
void | printArrayValue (ostream &os, Int v, const String &) const |
void | printArrayValue (ostream &os, Int64 v, const String &) const |
void | printArrayValue (ostream &os, Double v, const String &) const |
void | printArrayValue (ostream &os, const DComplex &v, const String &) const |
void | printArrayValue (ostream &os, const String &v, const String &) const |
Int | checkRowColumn (Table &table, const String &colName, Int rownr, Int nrow, Int incr, const Char *caller) |
Check if the column name and row numbers are valid. | |
ValueHolder | getValueFromTable (const String &colName, Int rownr, Int nrow, Int incr, Bool isCell) |
Get values from the column. | |
ValueHolder | getValueSliceFromTable (const String &colName, const Slicer &slicer, Int rownr, Int nrow, Int incr, Bool isCell) |
Get value slices from the column. | |
void | putValueInTable (const String &colName, Int rownr, Int nrow, Int incr, Bool isCell, const ValueHolder &) |
Put values into the column. | |
void | putValueSliceInTable (const String &colName, const Slicer &slicer, Int rownr, Int nrow, Int incr, Bool isCell, const ValueHolder &) |
Put value slices into the column. | |
void | findKeyId (RecordFieldId &fieldid, const TableRecord *&keySet, const String &keyname, const String &column) |
Split the keyname into its separate parts (separator is .). | |
void | findKeyId (RecordFieldId &fieldid, TableRecord *&keySet, const String &keyname, const String &column, Bool mustExist, Bool change, Bool makeSubRecord) |
void | setDefaultForSlicer (IPosition &vec) const |
Replace the user-given default value (<0) by the default value used by Slicer (i.e. | |
void | syncTable (Table &table) |
Synchronize table if readlocking is in effect. | |
Static Private Member Functions | |
static TableLock | makeLockOptions (const Record &options) |
static Table::EndianFormat | makeEndianFormat (const String &endianFormat) |
Turn the string into the endian format option. | |
static Bool | makeHC (const Record &gdesc, TableDesc &tabdesc, String &message) |
Make hypercolumn definitions for the given hypercolumns. | |
static ValueHolder | getKeyValue (const TableRecord &keySet, const RecordFieldId &fieldId) |
Get the value of a keyword. | |
static void | putKeyValue (TableRecord &keySet, const RecordFieldId &fieldId, const ValueHolder &value) |
Put the value of a keyword. | |
static Bool | makeTableDesc (const Record &gdesc, TableDesc &tabdesc, String &message) |
Make a real table description from a table description in a record. | |
static Bool | addArrayColumnDesc (TableDesc &tableDesc, const String &valueType, const String &columnName, const String &comment, const String &dataManagerType, const String &dataManagerGroup, int options, Int ndim, const Vector< Int > &shape, Bool cOrder, String &message) |
Add an array column description to the table description. | |
static Record | recordColumnDesc (const ColumnDesc &, Bool cOrder) |
Make a record containing the column description. | |
static Record | recordHCDesc (const TableDesc &tableDesc) |
Make a record containing the description of all hypercolumns. | |
static void | calcValues (Record &rec, const TableExprNode &expr) |
Calculate the values of a CALC expression and store them in field 'values' in rec. | |
static String | getTypeStr (DataType) |
Get the type string as used externally (in e.g. | |
static IPosition | fillAxes (const IPosition &, Bool cOrder) |
Optionally reverse the axes. | |
Private Attributes | |
Table | table_p |
String | asciiFormat_p |
Record | calcResult_p |
High-level interface to tables.
Public interface
TableProxy is a proxy for access to tables from any script.
TableProxy gives access to most of the functionality in the Table System. It is primarily meant to be used in classes that wrap access to it from scripting languages (like Glish and Python). However, it can also be used directly from other C++ code.
It has functions to open, create, read, write, and query tables. Accompying proxy classes give access to other functionality. They are:
TableProxy does not have the TableRecord type in its interface, because such a type cannot be handled by e.g. Glish or Python. Instead it converts TableRecords to/from Records. If a TableRecord contains a field with a Table object, it is represented in the Record as a string with the value "Table: NAME" where NAME is the table name.
TableProxy is the Tasking-independent high-level table interface. Different front-ends (e.g. GlishTableProxy) can be put on top of it.
Definition at line 108 of file TableProxy.h.
Default constructor initializes to not open.
This constructor is only needed for containers.
casa::TableProxy::TableProxy | ( | const Table & | table | ) | [inline] |
Create the object from an existing table (used by some methods).
Definition at line 116 of file TableProxy.h.
casa::TableProxy::TableProxy | ( | const String & | tableName, |
const Record & | lockOptions, | ||
int | option | ||
) |
Open the table with a given name.
casa::TableProxy::TableProxy | ( | const String & | tableName, |
const Record & | lockOptions, | ||
const String & | endianFormat, | ||
const String & | memType, | ||
int | nrow, | ||
const Record & | tableDesc, | ||
const Record & | dmInfo | ||
) |
Create a table with given name and description, etc.
casa::TableProxy::TableProxy | ( | const Vector< String > & | tableNames, |
const Vector< String > & | concatenateSubTableNames, | ||
const Record & | lockOptions, | ||
int | option | ||
) |
Create a table object to concatenate a number of similar tables.
The keyword set of the first table is take as the keyword set of the entire concatenation. However, it can be specified which subtables have to be concatenated as well which means that for each subtable name the subtable in the keywordsets are concatenated.
Note: For Boost-Python the constructors must have different nr of arguments; Hence some dummy arguments are added;
casa::TableProxy::TableProxy | ( | const std::vector< TableProxy > & | tables, |
const Vector< String > & | concatenateSubTableNames, | ||
int | dummy1 = 0 , |
||
int | dummy2 = 0 , |
||
int | dummy3 = 0 |
||
) |
casa::TableProxy::TableProxy | ( | const String & | command, |
const std::vector< TableProxy > & | tables | ||
) |
Create a table object from a table command (as defined in TableGram).
If a CALC command was given, the resulting values are stored in the a record and a null TableProxy object is returned. The result can be obtained using getCalcResult.
Note: If the command string contains no GIVING part, the resulting table is temporary and its name is blank;
casa::TableProxy::TableProxy | ( | const String & | fileName, |
const String & | headerName, | ||
const String & | tableName, | ||
Bool | autoHeader, | ||
const IPosition & | autoShape, | ||
const String & | separator, | ||
const String & | commentMarker, | ||
Int | firstLine, | ||
Int | lastLine, | ||
const Vector< String > & | columnNames = Vector< String >() , |
||
const Vector< String > & | dataTypes = Vector< String >() |
||
) |
Create a table from an Ascii file.
It fills a string containing the names and types of the columns (in the form COL1=R, COL2=D, ...). The string can be obtained using getAsciiFormat.
casa::TableProxy::TableProxy | ( | const TableProxy & | ) |
Copy constructor.
Close the table.
static Bool casa::TableProxy::addArrayColumnDesc | ( | TableDesc & | tableDesc, |
const String & | valueType, | ||
const String & | columnName, | ||
const String & | comment, | ||
const String & | dataManagerType, | ||
const String & | dataManagerGroup, | ||
int | options, | ||
Int | ndim, | ||
const Vector< Int > & | shape, | ||
Bool | cOrder, | ||
String & | message | ||
) | [static, private] |
Add an array column description to the table description.
It is used by the function makeDesc.
void casa::TableProxy::addColumns | ( | const Record & | tableDesc, |
const Record & | dminfo, | ||
Bool | addToParent | ||
) |
Add one or more columns to the table.
void casa::TableProxy::addReadmeLine | ( | const String & | line | ) |
Add a line to the TableInfo readme.
void casa::TableProxy::addRow | ( | Int | nrow | ) |
Add rows to the table.
static void casa::TableProxy::calcValues | ( | Record & | rec, |
const TableExprNode & | expr | ||
) | [static, private] |
Calculate the values of a CALC expression and store them in field 'values' in rec.
Bool casa::TableProxy::cellContentsDefined | ( | const String & | columnName, |
Int | rownr | ||
) |
Tests if the contents of a cell are defined.
Only a column with variable shaped arrays can have an empty cell.
Int casa::TableProxy::checkRowColumn | ( | Table & | table, |
const String & | colName, | ||
Int | rownr, | ||
Int | nrow, | ||
Int | incr, | ||
const Char * | caller | ||
) | [private] |
Check if the column name and row numbers are valid.
Return the recalculated nrow so that it does not exceed #rows.
void casa::TableProxy::close | ( | ) |
Flush and close the table and all its subtables.
String casa::TableProxy::columnArrayType | ( | const String & | columnName | ) |
Return the type of array in the column as: Direct Undefined FixedShape Direct,Undefined Direct,FixedShape Undefined,FixedShape Direct,Undefined,FixedShape or Error -- unexpected column type.
String casa::TableProxy::columnDataType | ( | const String & | columnName | ) |
Get all column names in the table.
TableProxy casa::TableProxy::copy | ( | const String & | newTableName, |
Bool | toMemoryTable, | ||
Bool | deepCopy, | ||
Bool | valueCopy, | ||
const String & | endianFormat, | ||
const Record & | dminfo, | ||
Bool | noRows | ||
) |
Copy the table (possibly a deep copy).
If noRows=True, an empty table is created.
void casa::TableProxy::copyRows | ( | TableProxy & | out, |
Int | startIn, | ||
Int | startOut, | ||
Int | nrow | ||
) |
Copy rows from one table to another.
If startOut<0, it is set to the end of the output table.
void casa::TableProxy::deleteTable | ( | Bool | checkSubTables | ) |
Close and delete the table.
String casa::TableProxy::endianFormat | ( | ) | const |
Get the endian format of the table.
It fills the result with value "big" or "little".
static IPosition casa::TableProxy::fillAxes | ( | const IPosition & | , |
Bool | cOrder | ||
) | [static, private] |
Optionally reverse the axes.
void casa::TableProxy::findKeyId | ( | RecordFieldId & | fieldid, |
const TableRecord *& | keySet, | ||
const String & | keyname, | ||
const String & | column | ||
) | [private] |
Split the keyname into its separate parts (separator is .).
Check if each part exists and is a subrecord (except last part). When putting, subrecords are created if undefined and if makeSubRecord is set. On return it fills in the fieldid with the latest keyword part. KeySet is set to the last subrecord.
void casa::TableProxy::findKeyId | ( | RecordFieldId & | fieldid, |
TableRecord *& | keySet, | ||
const String & | keyname, | ||
const String & | column, | ||
Bool | mustExist, | ||
Bool | change, | ||
Bool | makeSubRecord | ||
) | [private] |
void casa::TableProxy::flush | ( | Bool | recursive | ) |
Flush the table and optionally all its subtables.
String casa::TableProxy::getAsciiFormat | ( | ) | const |
Get ascii format string.
Record casa::TableProxy::getCalcResult | ( | ) | const |
Get result of possible CALC statement.
ValueHolder casa::TableProxy::getCell | ( | const String & | columnName, |
Int | row | ||
) |
Get a value from a column in the table.
ValueHolder casa::TableProxy::getCellSlice | ( | const String & | columnName, |
Int | row, | ||
const Vector< Int > & | blc, | ||
const Vector< Int > & | trc, | ||
const Vector< Int > & | inc | ||
) |
Get a value slice from a column in the table.
If the inc vector is empty, it defaults to all 1.
ValueHolder casa::TableProxy::getCellSliceIP | ( | const String & | columnName, |
Int | row, | ||
const IPosition & | blc, | ||
const IPosition & | trc, | ||
const IPosition & | inc | ||
) |
Bool casa::TableProxy::getColInfo | ( | const String & | colName, |
Bool | useBrackets, | ||
String & | type, | ||
String & | message | ||
) | [private] |
Get the column info for toAscii.
ValueHolder casa::TableProxy::getColumn | ( | const String & | columnName, |
Int | row, | ||
Int | nrow, | ||
Int | incr | ||
) |
Get some or all values from a column in the table.
row is the starting row number (0-relative). nrow=-1 means until the end of the table. incr is the step in row number.
Record casa::TableProxy::getColumnDescription | ( | const String & | columnName, |
Bool | actual, | ||
Bool | cOrder = False |
||
) |
Get the column description of a column in the table.
It returns a record containing the description.
Vector<String> casa::TableProxy::getColumnShapeString | ( | const String & | columnName, |
Int | rownr, | ||
Int | nrow, | ||
Int | incr, | ||
Bool | cOrder = False |
||
) |
Get the shape of one or more cells in a column as a vector of Strings containing the shapes as [a,b,c].
If the shape is fixed, a single String is returned.
ValueHolder casa::TableProxy::getColumnSlice | ( | const String & | columnName, |
Int | row, | ||
Int | nrow, | ||
Int | incr, | ||
const Vector< Int > & | blc, | ||
const Vector< Int > & | trc, | ||
const Vector< Int > & | inc | ||
) |
Get some or all value slices from a column in the table.
If the inc vector is empty, it defaults to all 1.
ValueHolder casa::TableProxy::getColumnSliceIP | ( | const String & | columnName, |
const IPosition & | blc, | ||
const IPosition & | trc, | ||
const IPosition & | inc, | ||
Int | row, | ||
Int | nrow, | ||
Int | incr | ||
) |
Get the data manager info of the table.
Vector<String> casa::TableProxy::getFieldNames | ( | const String & | columnName, |
const String & | keywordName, | ||
Int | keywordIndex | ||
) |
Get the names of all field in a record in the table.
If the column name is empty, the table keywords are used. If the keyword name is empty, the names of all keywords are returned. Otherwise the names of all fields in the keyword value are returned. In that case the value has to be a record.
static ValueHolder casa::TableProxy::getKeyValue | ( | const TableRecord & | keySet, |
const RecordFieldId & | fieldId | ||
) | [static, private] |
Get the value of a keyword.
static Record casa::TableProxy::getKeyValues | ( | const TableRecord & | keySet | ) | [static] |
Get or put the values of all keywords.
Thus convert from TableRecord to/from Record. Keywords containing a table are converted to a string containing the table name preceeded by 'Table: '.
ValueHolder casa::TableProxy::getKeyword | ( | const String & | columnName, |
const String & | keywordName, | ||
Int | keywordIndex | ||
) |
Get a table or column keyword value in the table.
If the columnName is empty, a given keyword is a table keyword. The keyword can be given as a name or a 0-based index.
Record casa::TableProxy::getKeywordSet | ( | const String & | columnName | ) |
Get the table or column keyword values in the table.
If the columnName is empty, the table keyword values are returned.
Vector<String> casa::TableProxy::getPartNames | ( | Bool | recursive | ) |
Get the names of the parts the table consists of (e.g.
for a ConcatTable).
Record casa::TableProxy::getProperties | ( | const String & | name, |
Bool | byColumn | ||
) |
Get the properties of a data manager given by column or data manager name.
Record casa::TableProxy::getTableDescription | ( | Bool | actual, |
Bool | cOrder = False |
||
) |
Get the table description of the table.
It returns a record containing the description.
static String casa::TableProxy::getTypeStr | ( | DataType | ) | [static, private] |
Get the type string as used externally (in e.g.
glish).
ValueHolder casa::TableProxy::getValueFromTable | ( | const String & | colName, |
Int | rownr, | ||
Int | nrow, | ||
Int | incr, | ||
Bool | isCell | ||
) | [private] |
Get values from the column.
Nrow<0 means till the end of the column.
ValueHolder casa::TableProxy::getValueSliceFromTable | ( | const String & | colName, |
const Slicer & | slicer, | ||
Int | rownr, | ||
Int | nrow, | ||
Int | incr, | ||
Bool | isCell | ||
) | [private] |
Get value slices from the column.
Nrow<0 means till the end of the column.
Determine if data in the table has changed.
Bool casa::TableProxy::hasLock | ( | Bool | mode | ) |
Determine if the process has a read or write lock on the table.
Bool casa::TableProxy::isMultiUsed | ( | Bool | checkSubTables | ) |
Determine if the table (and optionally its subtables) are in use in another process.
Bool casa::TableProxy::isReadable | ( | ) | const |
Test if a table is readable.
Bool casa::TableProxy::isScalarColumn | ( | const String & | columnName | ) |
Return in result if the column contains scalars.
Bool casa::TableProxy::isWritable | ( | ) | const |
Test if a table is writable.
void casa::TableProxy::lock | ( | Bool | mode, |
Int | nattempts | ||
) |
Acquire a (read or write) lock on the table.
Get the lock options of the table.
It fills the record with the fields option, interval and maxwait.
static Table::EndianFormat casa::TableProxy::makeEndianFormat | ( | const String & | endianFormat | ) | [static, private] |
Turn the string into the endian format option.
An exception is thrown if the string is invalid.
static Bool casa::TableProxy::makeHC | ( | const Record & | gdesc, |
TableDesc & | tabdesc, | ||
String & | message | ||
) | [static, private] |
Make hypercolumn definitions for the given hypercolumns.
static TableLock casa::TableProxy::makeLockOptions | ( | const Record & | options | ) | [static, private] |
Get the lock options from the fields in the record. If the record or lockoption is invalid, an exception is thrown.
static Bool casa::TableProxy::makeTableDesc | ( | const Record & | gdesc, |
TableDesc & | tabdesc, | ||
String & | message | ||
) | [static, private] |
Make a real table description from a table description in a record.
An exception is thrown if the record table description is invalid. A record table description is a Record object as returned by getDesc.
Get #columns of the table.
Get #rows of the table.
TableProxy& casa::TableProxy::operator= | ( | const TableProxy & | ) |
Assignment.
void casa::TableProxy::printArray | ( | const Array< T > & | arr, |
ostream & | os, | ||
const String & | sep | ||
) | const [private] |
void casa::TableProxy::printArrayValue | ( | ostream & | os, |
Bool | v, | ||
const String & | |||
) | const [inline, private] |
Definition at line 600 of file TableProxy.h.
void casa::TableProxy::printArrayValue | ( | ostream & | os, |
Int | v, | ||
const String & | |||
) | const [inline, private] |
Definition at line 602 of file TableProxy.h.
void casa::TableProxy::printArrayValue | ( | ostream & | os, |
Int64 | v, | ||
const String & | |||
) | const [inline, private] |
Definition at line 604 of file TableProxy.h.
void casa::TableProxy::printArrayValue | ( | ostream & | os, |
Double | v, | ||
const String & | |||
) | const [inline, private] |
Definition at line 606 of file TableProxy.h.
void casa::TableProxy::printArrayValue | ( | ostream & | os, |
const DComplex & | v, | ||
const String & | |||
) | const [inline, private] |
Definition at line 608 of file TableProxy.h.
void casa::TableProxy::printArrayValue | ( | ostream & | os, |
const String & | v, | ||
const String & | |||
) | const [inline, private] |
Definition at line 610 of file TableProxy.h.
void casa::TableProxy::printValueHolder | ( | const ValueHolder & | vh, |
ostream & | os, | ||
const String & | sep, | ||
Int | prec, | ||
Bool | useBrackets | ||
) | const [private] |
Print the data in a table cell for toAscii.
void casa::TableProxy::putCell | ( | const String & | columnName, |
const Vector< Int > & | rownrs, | ||
const ValueHolder & | |||
) |
Put a value into a column in the table.
void casa::TableProxy::putCellSlice | ( | const String & | columnName, |
Int | row, | ||
const Vector< Int > & | blc, | ||
const Vector< Int > & | trc, | ||
const Vector< Int > & | inc, | ||
const ValueHolder & | |||
) |
Put a value slice into a column in the table.
If the inc vector is empty, it defaults to all 1.
void casa::TableProxy::putCellSliceIP | ( | const String & | columnName, |
Int | row, | ||
const ValueHolder & | , | ||
const IPosition & | blc, | ||
const IPosition & | trc, | ||
const IPosition & | inc | ||
) |
void casa::TableProxy::putColumn | ( | const String & | columnName, |
Int | row, | ||
Int | nrow, | ||
Int | incr, | ||
const ValueHolder & | |||
) |
Put some or all values into a column in the table.
row is the starting row number (0-relative). nrow=-1 means until the end of the table. incr is the step in row number.
void casa::TableProxy::putColumnSlice | ( | const String & | columnName, |
Int | row, | ||
Int | nrow, | ||
Int | incr, | ||
const Vector< Int > & | blc, | ||
const Vector< Int > & | trc, | ||
const Vector< Int > & | inc, | ||
const ValueHolder & | |||
) |
Put some or all value slices into a column in the table.
void casa::TableProxy::putColumnSliceIP | ( | const String & | columnName, |
const ValueHolder & | , | ||
const IPosition & | blc, | ||
const IPosition & | trc, | ||
const IPosition & | inc, | ||
Int | row, | ||
Int | nrow, | ||
Int | incr | ||
) |
static void casa::TableProxy::putKeyValue | ( | TableRecord & | keySet, |
const RecordFieldId & | fieldId, | ||
const ValueHolder & | value | ||
) | [static, private] |
Put the value of a keyword.
static void casa::TableProxy::putKeyValues | ( | TableRecord & | keySet, |
const Record & | valueSet | ||
) | [static] |
void casa::TableProxy::putKeyword | ( | const String & | columnName, |
const String & | keywordName, | ||
Int | keywordIndex, | ||
Bool | makeSubRecord, | ||
const ValueHolder & | |||
) |
Define a table or column keyword in the table.
If the column name is empty, a table keyword is defined. The keyword can be given as a name or a 0-based number. The value should be a record containing the value of the keyword. The value can be any type (including a record).
void casa::TableProxy::putKeywordSet | ( | const String & | columnName, |
const Record & | valueSet | ||
) |
Define multiple table or column keywords in the table.
If the column name is empty, a table keywords are defined. The value should be a record containing the values of the keywords. The values can be any type (including a record). The field names are the keyword names.
void casa::TableProxy::putTableInfo | ( | const Record & | value | ) |
Put the table info of the table.
void casa::TableProxy::putValueInTable | ( | const String & | colName, |
Int | rownr, | ||
Int | nrow, | ||
Int | incr, | ||
Bool | isCell, | ||
const ValueHolder & | |||
) | [private] |
Put values into the column.
Nrow<0 means till the end of the column.
void casa::TableProxy::putValueSliceInTable | ( | const String & | colName, |
const Slicer & | slicer, | ||
Int | rownr, | ||
Int | nrow, | ||
Int | incr, | ||
Bool | isCell, | ||
const ValueHolder & | |||
) | [private] |
Put value slices into the column.
Nrow<0 means till the end of the column.
void casa::TableProxy::putVarColumn | ( | const String & | columnName, |
Int | row, | ||
Int | nrow, | ||
Int | incr, | ||
const Record & | values | ||
) |
static Record casa::TableProxy::recordColumnDesc | ( | const ColumnDesc & | , |
Bool | cOrder | ||
) | [static, private] |
Make a record containing the column description.
static Record casa::TableProxy::recordHCDesc | ( | const TableDesc & | tableDesc | ) | [static, private] |
Make a record containing the description of all hypercolumns.
void casa::TableProxy::removeColumns | ( | const Vector< String > & | columnNames | ) |
Remove one or more columns from the table.
void casa::TableProxy::removeKeyword | ( | const String & | columnName, |
const String & | keywordName, | ||
Int | keywordIndex | ||
) |
Remove a table or column keyword from the table.
If the column name is empty, a table keyword is removed.
void casa::TableProxy::removeRow | ( | const Vector< Int > & | rownrs | ) |
Remove rows from the table.
void casa::TableProxy::rename | ( | const String & | newTableName | ) |
Rename the table.
void casa::TableProxy::renameColumn | ( | const String & | nameOld, |
const String & | nameNew | ||
) |
Rename a column in the table.
void casa::TableProxy::reopenRW | ( | ) |
Reopen the table for read/write.
void casa::TableProxy::resync | ( | ) |
Resync the table.
Vector<Int> casa::TableProxy::rowNumbers | ( | TableProxy & | other | ) |
Get the row numbers of the table.
TableProxy casa::TableProxy::selectRows | ( | const Vector< Int > & | rownrs, |
const String & | outName | ||
) |
Select the given rows from the table and create a new (reference) table.
If outName is not empty, the new table is made persistent with that name.
void casa::TableProxy::setDefaultForSlicer | ( | IPosition & | vec | ) | const [private] |
Replace the user-given default value (<0) by the default value used by Slicer (i.e.
by Slicer::MimicSource).
void casa::TableProxy::setMaximumCacheSize | ( | const String & | columnName, |
Int | nbytes | ||
) |
Set the maximum cache size for the given column in the table.
void casa::TableProxy::setProperties | ( | const String & | name, |
Bool | byColumn, | ||
const Record & | properties | ||
) |
Set the properties of a data manager given by column or data manager name.
Get the shape (#columns, #rows) of the table.
String casa::TableProxy::showStructure | ( | Bool | showDataMan = True , |
Bool | showColumns = True , |
||
Bool | showSubTables = False , |
||
Bool | sortColumns = False |
||
) | const |
Show the structure of a table.
void casa::TableProxy::syncTable | ( | Table & | table | ) | [private] |
Synchronize table if readlocking is in effect.
In this way the number of rows is up-to-date.
Table& casa::TableProxy::table | ( | ) | [inline] |
const Table& casa::TableProxy::table | ( | ) | const [inline] |
Definition at line 562 of file TableProxy.h.
References table_p.
Get the table info of the table.
Get table name.
String casa::TableProxy::toAscii | ( | const String & | asciiFile, |
const String & | headerFile, | ||
const Vector< String > & | columns, | ||
const String & | sep, | ||
const Vector< Int > & | precision, | ||
Bool | useBrackets | ||
) |
Write the table to an ASCII file (approximately the inverse of the from-ASCII-contructor).
If headerFile
is empty or equal to asciiFile
, the headers are written in the same file as the data, otherwise in a separate file. If no columns are given (or if the first column name is empty), all table columns are written. Columns containing records are also printed (enclosed in {}), but a warning message is returned.
Argument sep
is used as separator between columns and array values. If it is empty, a blank is used.
For each column the precision can be given. It is only used for columns containing floating point numbers. A value <=0 means using the default which is 9 for single and 18 for double precision.
If useBrackets=True
, arrays are enclosed in [] (for each dimension), so variable shaped arrays can be read back unambiguously. The type in the header will be something like D[4,64]. If the column is variable shaped, the type is like D[]. If useBracket=False
, arrays are written linearly where a shape [4,64] is given in the header like D4,64. If the column is variable shaped, the shape of the first cell is used and a warning message is returned.
void casa::TableProxy::unlock | ( | ) |
Release a lock on the table.
String casa::TableProxy::asciiFormat_p [private] |
Definition at line 721 of file TableProxy.h.
Record casa::TableProxy::calcResult_p [private] |
Definition at line 722 of file TableProxy.h.
Table casa::TableProxy::table_p [private] |
Definition at line 720 of file TableProxy.h.
Referenced by table().