casacore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
casacore::TableProxy Class Reference

High-level interface to tables. More...

#include <TableProxy.h>

Public Member Functions

 TableProxy ()
 Default constructor initializes to not open. More...
 
 TableProxy (const Table &table)
 Create the object from an existing table (used by some methods). More...
 
 TableProxy (const String &tableName, const Record &lockOptions, int option)
 Open the table with a given name. More...
 
 TableProxy (const String &tableName, const Record &lockOptions, const String &endianFormat, const String &memType, Int64 nrow, const Record &tableDesc, const Record &dmInfo)
 Create a table with given name and description, etc. More...
 
 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. More...
 
 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). More...
 
 TableProxy (const String &fileName, const String &headerName, const String &tableName, Bool autoHeader, const IPosition &autoShape, const String &separator, const String &commentMarker, Int64 firstLine, Int64 lastLine, const Vector< String > &columnNames=Vector< String >(), const Vector< String > &dataTypes=Vector< String >())
 Create a table from an Ascii file. More...
 
 TableProxy (const TableProxy &)
 Copy constructor. More...
 
 ~TableProxy ()
 Close the table. More...
 
TableProxyoperator= (const TableProxy &)
 Assignment. More...
 
TableProxy selectRows (const Vector< Int64 > &rownrs, const String &outName)
 Select the given rows from the table and create a new (reference) table. More...
 
void reopenRW ()
 Reopen the table for read/write. More...
 
void resync ()
 Resync the table. More...
 
void flush (Bool recursive)
 Flush the table and optionally all its subtables. More...
 
void close ()
 Flush and close the table and all its subtables. More...
 
String endianFormat () const
 Get the endian format of the table. More...
 
void lock (Bool mode, Int nattempts)
 Acquire a (read or write) lock on the table. More...
 
void unlock ()
 Release a lock on the table. More...
 
Bool hasDataChanged ()
 Determine if data in the table has changed. More...
 
Bool hasLock (Bool mode)
 Determine if the process has a read or write lock on the table. More...
 
Record lockOptions ()
 Get the lock options of the table. More...
 
Bool isMultiUsed (Bool checkSubTables)
 Determine if the table (and optionally its subtables) are in use in another process. More...
 
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). More...
 
void rename (const String &newTableName)
 Rename the table. More...
 
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). More...
 
void copyRows (TableProxy &out, Int64 startIn, Int64 startOut, Int64 nrow)
 Copy rows from one table to another. More...
 
void deleteTable (Bool checkSubTables)
 Close and delete the table. More...
 
Record tableInfo ()
 Get the table info of the table. More...
 
void putTableInfo (const Record &value)
 Put the table info of the table. More...
 
void addReadmeLine (const String &line)
 Add a line to the TableInfo readme. More...
 
Bool isReadable () const
 Test if a table is readable. More...
 
Bool isWritable () const
 Test if a table is writable. More...
 
void setMaximumCacheSize (const String &columnName, Int nbytes)
 Set the maximum cache size for the given column in the table. More...
 
void addColumns (const Record &tableDesc, const Record &dminfo, Bool addToParent)
 Add one or more columns to the table. More...
 
void renameColumn (const String &nameOld, const String &nameNew)
 Rename a column in the table. More...
 
void removeColumns (const Vector< String > &columnNames)
 Remove one or more columns from the table. More...
 
void addRow (Int64 nrow)
 Add rows to the table. More...
 
void removeRow (const Vector< Int64 > &rownrs)
 Remove rows from the table. More...
 
ValueHolder getColumn (const String &columnName, Int64 row, Int64 nrow, Int64 incr)
 Get some or all values from a column in the table. More...
 
void getColumnVH (const String &columnName, Int64 row, Int64 nrow, Int64 incr, const ValueHolder &vh)
 
Record getVarColumn (const String &columnName, Int64 row, Int64 nrow, Int64 incr)
 
ValueHolder getColumnSlice (const String &columnName, Int64 row, Int64 nrow, Int64 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. More...
 
ValueHolder getColumnSliceIP (const String &columnName, const IPosition &blc, const IPosition &trc, const IPosition &inc, Int64 row, Int64 nrow, Int64 incr)
 
void getColumnSliceVH (const String &columnName, Int64 row, Int64 nrow, Int64 incr, const Vector< Int > &blc, const Vector< Int > &trc, const Vector< Int > &inc, const ValueHolder &vh)
 
void getColumnSliceVHIP (const String &columnName, const IPosition &blc, const IPosition &trc, const IPosition &inc, Int64 row, Int64 nrow, Int64 incr, const ValueHolder &vh)
 
void putColumn (const String &columnName, Int64 row, Int64 nrow, Int64 incr, const ValueHolder &)
 Put some or all values into a column in the table. More...
 
void putVarColumn (const String &columnName, Int64 row, Int64 nrow, Int64 incr, const Record &values)
 
void putColumnSlice (const String &columnName, Int64 row, Int64 nrow, Int64 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. More...
 
void putColumnSliceIP (const String &columnName, const ValueHolder &, const IPosition &blc, const IPosition &trc, const IPosition &inc, Int64 row, Int64 nrow, Int64 incr)
 
Bool cellContentsDefined (const String &columnName, Int64 rownr)
 Tests if the contents of a cell are defined. More...
 
ValueHolder getCell (const String &columnName, Int64 row)
 Get a value from a column in the table. More...
 
void getCellVH (const String &columnName, Int64 row, const ValueHolder &vh)
 
ValueHolder getCellSlice (const String &columnName, Int64 row, const Vector< Int > &blc, const Vector< Int > &trc, const Vector< Int > &inc)
 Get a value slice from a column in the table. More...
 
ValueHolder getCellSliceIP (const String &columnName, Int64 row, const IPosition &blc, const IPosition &trc, const IPosition &inc)
 
void getCellSliceVH (const String &columnName, Int64 row, const Vector< Int > &blc, const Vector< Int > &trc, const Vector< Int > &inc, const ValueHolder &vh)
 
void getCellSliceVHIP (const String &columnName, Int64 row, const IPosition &blc, const IPosition &trc, const IPosition &inc, const ValueHolder &vh)
 
void putCell (const String &columnName, const Vector< Int64 > &rownrs, const ValueHolder &)
 Put a value into a column in the table. More...
 
void putCellSlice (const String &columnName, Int64 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. More...
 
void putCellSliceIP (const String &columnName, Int64 row, const ValueHolder &, const IPosition &blc, const IPosition &trc, const IPosition &inc)
 
Vector< StringgetColumnShapeString (const String &columnName, Int64 rownr, Int64 nrow, Int64 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]. More...
 
ValueHolder getKeyword (const String &columnName, const String &keywordName, Int keywordIndex)
 Get a table or column keyword value in the table. More...
 
Record getKeywordSet (const String &columnName)
 Get the table or column keyword values in the table. More...
 
void putKeyword (const String &columnName, const String &keywordName, Int keywordIndex, Bool makeSubRecord, const ValueHolder &)
 Define a table or column keyword in the table. More...
 
void putKeywordSet (const String &columnName, const Record &valueSet)
 Define multiple table or column keywords in the table. More...
 
void removeKeyword (const String &columnName, const String &keywordName, Int keywordIndex)
 Remove a table or column keyword from the table. More...
 
Vector< StringgetFieldNames (const String &columnName, const String &keywordName, Int keywordIndex)
 Get the names of all field in a record in the table. More...
 
String tableName ()
 Get table name. More...
 
Vector< StringgetPartNames (Bool recursive)
 Get the names of the parts the table consists of (e.g. More...
 
Int ncolumns ()
 Get #columns of the table. More...
 
Int64 nrows ()
 Get #rows of the table. More...
 
Vector< Int64shape ()
 Get the shape (#columns, #rows) of the table. More...
 
Vector< Int64rowNumbers (TableProxy &other)
 Get the row numbers of the table. More...
 
Vector< StringcolumnNames ()
 Get all column names in the table. More...
 
Bool isScalarColumn (const String &columnName)
 Return in result if the column contains scalars. More...
 
String columnDataType (const String &columnName)
 Return the data type of the column as: Bool, UChar, Short, UShort, Int, UInt, Int64, Float, Double, Complex, DComplex, String, Table, or unknown. More...
 
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. More...
 
Record getDataManagerInfo ()
 Get the data manager info of the table. More...
 
Record getProperties (const String &name, Bool byColumn)
 Get the properties of a data manager given by column or data manager name. More...
 
void setProperties (const String &name, const Record &properties, Bool byColumn)
 Set the properties of a data manager given by column or data manager name. More...
 
Record getTableDescription (Bool actual, Bool cOrder=False)
 Get the table description of the table. More...
 
Record getColumnDescription (const String &columnName, Bool actual, Bool cOrder=False)
 Get the column description of a column in the table. More...
 
String getAsciiFormat () const
 Get ascii format string. More...
 
Record getCalcResult () const
 Get result of possible CALC statement. More...
 
String showStructure (Bool showDataMan=True, Bool showColumns=True, Bool showSubTables=False, Bool sortColumns=False) const
 Show the structure of a table. More...
 
Tabletable ()
 Return the table object. More...
 
const Tabletable () const
 

Static Public Member Functions

static Record getTableDesc (const TableDesc &tabdesc, Bool cOrder=False)
 Create a Record table description from a TableDesc object. More...
 
static Record getKeyValues (const TableRecord &keySet)
 Get or put the values of all keywords. More...
 
static void putKeyValues (TableRecord &keySet, const Record &valueSet)
 
static TableLock makeLockOptions (const Record &options)
 Get the lock options from the fields in the record. More...
 
static Table::EndianFormat makeEndianFormat (const String &endianFormat)
 Turn the string into the endian format option. More...
 
static Bool makeHC (const Record &gdesc, TableDesc &tabdesc, String &message)
 Make hypercolumn definitions for the given hypercolumns. More...
 
static ValueHolder getKeyValue (const TableRecord &keySet, const RecordFieldId &fieldId)
 Get the value of a keyword. More...
 
static void putKeyValue (TableRecord &keySet, const RecordFieldId &fieldId, const ValueHolder &value)
 Put the value of a keyword. More...
 
static Bool makeTableDesc (const Record &gdesc, TableDesc &tabdesc, String &message)
 Make a real table description from a table description in a record. More...
 
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< Int64 > &shape, Bool cOrder, String &message)
 Add an array column description to the table description. More...
 
static Record recordColumnDesc (const ColumnDesc &, Bool cOrder)
 Make a record containing the column description. More...
 
static Record recordHCDesc (const TableDesc &tableDesc)
 Make a record containing the description of all hypercolumns. More...
 
static void calcValues (Record &rec, const TableExprNode &expr)
 Calculate the values of a CALC expression and store them in field 'values' in rec. More...
 
static String getTypeStr (DataType)
 Get the type string as used externally (in e.g. More...
 
static IPosition fillAxes (const IPosition &, Bool cOrder)
 Optionally reverse the axes. More...
 
static void stillSameShape (Int &same, IPosition &shape, const IPosition &newShape)
 Check if the new shape is still the same. More...
 
template<typename T >
static Array< T > record2Array (const Record &rec)
 Copy the array contents of the record fields to a single array. More...
 

Private Member Functions

Bool getColInfo (const String &colName, Bool useBrackets, String &type, String &message)
 Get the column info for toAscii. More...
 
void printValueHolder (const ValueHolder &vh, ostream &os, const String &sep, Int prec, Bool useBrackets) const
 Print the data in a table cell for toAscii. More...
 
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
 
Int64 getRowsCheck (const String &columnName, Int64 row, Int64 nrow, Int64 incr, const String &caller)
 Sync table to get correct nr of rows and check the row number. More...
 
Int64 getRowsSliceCheck (Slicer &slicer, const String &columnName, Int64 row, Int64 nrow, Int64 incr, const IPosition &blc, const IPosition &trc, const IPosition &inc, const String &caller)
 Sync table to get correct nr of rows and check the row number. More...
 
Int64 checkRowColumn (Table &table, const String &colName, Int64 rownr, Int64 nrow, Int64 incr, const String &caller)
 Check if the column name and row numbers are valid. More...
 
ValueHolder makeEmptyArray (DataType dtype)
 Make an empty array (with 1 axis) of the correct datatype. More...
 
ValueHolder getValueFromTable (const String &colName, Int64 rownr, Int64 nrow, Int64 incr, Bool isCell)
 Get values from the column. More...
 
void getValueFromTable (const String &colName, Int64 rownr, Int64 nrow, Int64 incr, Bool isCell, const ValueHolder &vh)
 
ValueHolder getValueSliceFromTable (const String &colName, const Slicer &slicer, Int64 rownr, Int64 nrow, Int64 incr, Bool isCell)
 Get value slices from the column. More...
 
void getValueSliceFromTable (const String &colName, const Slicer &slicer, Int64 rownr, Int64 nrow, Int64 incr, Bool isCell, const ValueHolder &vh)
 
void putValueInTable (const String &colName, Int64 rownr, Int64 nrow, Int64 incr, Bool isCell, const ValueHolder &)
 Put values into the column. More...
 
void putValueSliceInTable (const String &colName, const Slicer &slicer, Int64 rownr, Int64 nrow, Int64 incr, Bool isCell, const ValueHolder &)
 Put value slices into the column. More...
 
void findKeyId (RecordFieldId &fieldid, const TableRecord *&keySet, const String &keyname, const String &column)
 Split the keyname into its separate parts (separator is.). More...
 
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. More...
 
void syncTable (Table &table)
 Synchronize table if readlocking is in effect. More...
 

Private Attributes

Table table_p
 
String asciiFormat_p
 
Record calcResult_p
 

Detailed Description

High-level interface to tables.

Intended use:

Public interface

Review Status

Reviewed By:
Paul Shannon
Date Reviewed:
1995/09/15
Test programs:
ttable.py

Prerequisite

Etymology

TableProxy is a proxy for access to tables from any script.

Synopsis

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.

Motivation

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 102 of file TableProxy.h.

Constructor & Destructor Documentation

casacore::TableProxy::TableProxy ( )

Default constructor initializes to not open.

This constructor is only needed for containers.

casacore::TableProxy::TableProxy ( const Table table)
inline

Create the object from an existing table (used by some methods).

Definition at line 110 of file TableProxy.h.

casacore::TableProxy::TableProxy ( const String tableName,
const Record lockOptions,
int  option 
)

Open the table with a given name.

casacore::TableProxy::TableProxy ( const String tableName,
const Record lockOptions,
const String endianFormat,
const String memType,
Int64  nrow,
const Record tableDesc,
const Record dmInfo 
)

Create a table with given name and description, etc.

casacore::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;

casacore::TableProxy::TableProxy ( const std::vector< TableProxy > &  tables,
const Vector< String > &  concatenateSubTableNames,
int  dummy1 = 0,
int  dummy2 = 0,
int  dummy3 = 0 
)
casacore::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;

casacore::TableProxy::TableProxy ( const String fileName,
const String headerName,
const String tableName,
Bool  autoHeader,
const IPosition autoShape,
const String separator,
const String commentMarker,
Int64  firstLine,
Int64  lastLine,
const Vector< String > &  columnNames = VectorString >(),
const Vector< String > &  dataTypes = VectorString >() 
)

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.

casacore::TableProxy::TableProxy ( const TableProxy )

Copy constructor.

casacore::TableProxy::~TableProxy ( )

Close the table.

Member Function Documentation

static Bool casacore::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< Int64 > &  shape,
Bool  cOrder,
String message 
)
static

Add an array column description to the table description.

It is used by the function makeDesc.

void casacore::TableProxy::addColumns ( const Record tableDesc,
const Record dminfo,
Bool  addToParent 
)

Add one or more columns to the table.

void casacore::TableProxy::addReadmeLine ( const String line)

Add a line to the TableInfo readme.

void casacore::TableProxy::addRow ( Int64  nrow)

Add rows to the table.

static void casacore::TableProxy::calcValues ( Record rec,
const TableExprNode expr 
)
static

Calculate the values of a CALC expression and store them in field 'values' in rec.

Bool casacore::TableProxy::cellContentsDefined ( const String columnName,
Int64  rownr 
)

Tests if the contents of a cell are defined.

Only a column with variable shaped arrays can have an empty cell.

Int64 casacore::TableProxy::checkRowColumn ( Table table,
const String colName,
Int64  rownr,
Int64  nrow,
Int64  incr,
const String caller 
)
private

Check if the column name and row numbers are valid.

Return the recalculated nrow so that it does not exceed #rows.

void casacore::TableProxy::close ( )

Flush and close the table and all its subtables.

String casacore::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 casacore::TableProxy::columnDataType ( const String columnName)

Return the data type of the column as: Bool, UChar, Short, UShort, Int, UInt, Int64, Float, Double, Complex, DComplex, String, Table, or unknown.

Vector<String> casacore::TableProxy::columnNames ( )

Get all column names in the table.

TableProxy casacore::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 casacore::TableProxy::copyRows ( TableProxy out,
Int64  startIn,
Int64  startOut,
Int64  nrow 
)

Copy rows from one table to another.

If startOut<0, it is set to the end of the output table.

void casacore::TableProxy::deleteTable ( Bool  checkSubTables)

Close and delete the table.

String casacore::TableProxy::endianFormat ( ) const

Get the endian format of the table.

It fills the result with value "big" or "little".

static IPosition casacore::TableProxy::fillAxes ( const IPosition ,
Bool  cOrder 
)
static

Optionally reverse the axes.

void casacore::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 casacore::TableProxy::findKeyId ( RecordFieldId fieldid,
TableRecord *&  keySet,
const String keyname,
const String column,
Bool  mustExist,
Bool  change,
Bool  makeSubRecord 
)
private
void casacore::TableProxy::flush ( Bool  recursive)

Flush the table and optionally all its subtables.

String casacore::TableProxy::getAsciiFormat ( ) const

Get ascii format string.

Record casacore::TableProxy::getCalcResult ( ) const

Get result of possible CALC statement.

ValueHolder casacore::TableProxy::getCell ( const String columnName,
Int64  row 
)

Get a value from a column in the table.

ValueHolder casacore::TableProxy::getCellSlice ( const String columnName,
Int64  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 casacore::TableProxy::getCellSliceIP ( const String columnName,
Int64  row,
const IPosition blc,
const IPosition trc,
const IPosition inc 
)
void casacore::TableProxy::getCellSliceVH ( const String columnName,
Int64  row,
const Vector< Int > &  blc,
const Vector< Int > &  trc,
const Vector< Int > &  inc,
const ValueHolder vh 
)
void casacore::TableProxy::getCellSliceVHIP ( const String columnName,
Int64  row,
const IPosition blc,
const IPosition trc,
const IPosition inc,
const ValueHolder vh 
)
void casacore::TableProxy::getCellVH ( const String columnName,
Int64  row,
const ValueHolder vh 
)
Bool casacore::TableProxy::getColInfo ( const String colName,
Bool  useBrackets,
String type,
String message 
)
private

Get the column info for toAscii.

ValueHolder casacore::TableProxy::getColumn ( const String columnName,
Int64  row,
Int64  nrow,
Int64  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 casacore::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> casacore::TableProxy::getColumnShapeString ( const String columnName,
Int64  rownr,
Int64  nrow,
Int64  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 casacore::TableProxy::getColumnSlice ( const String columnName,
Int64  row,
Int64  nrow,
Int64  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 casacore::TableProxy::getColumnSliceIP ( const String columnName,
const IPosition blc,
const IPosition trc,
const IPosition inc,
Int64  row,
Int64  nrow,
Int64  incr 
)
void casacore::TableProxy::getColumnSliceVH ( const String columnName,
Int64  row,
Int64  nrow,
Int64  incr,
const Vector< Int > &  blc,
const Vector< Int > &  trc,
const Vector< Int > &  inc,
const ValueHolder vh 
)
void casacore::TableProxy::getColumnSliceVHIP ( const String columnName,
const IPosition blc,
const IPosition trc,
const IPosition inc,
Int64  row,
Int64  nrow,
Int64  incr,
const ValueHolder vh 
)
void casacore::TableProxy::getColumnVH ( const String columnName,
Int64  row,
Int64  nrow,
Int64  incr,
const ValueHolder vh 
)
Record casacore::TableProxy::getDataManagerInfo ( )

Get the data manager info of the table.

Vector<String> casacore::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 casacore::TableProxy::getKeyValue ( const TableRecord keySet,
const RecordFieldId fieldId 
)
static

Get the value of a keyword.

static Record casacore::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 casacore::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 casacore::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> casacore::TableProxy::getPartNames ( Bool  recursive)

Get the names of the parts the table consists of (e.g.

for a ConcatTable).

Record casacore::TableProxy::getProperties ( const String name,
Bool  byColumn 
)

Get the properties of a data manager given by column or data manager name.

Int64 casacore::TableProxy::getRowsCheck ( const String columnName,
Int64  row,
Int64  nrow,
Int64  incr,
const String caller 
)
private

Sync table to get correct nr of rows and check the row number.

It returns the nr of table rows.

Int64 casacore::TableProxy::getRowsSliceCheck ( Slicer slicer,
const String columnName,
Int64  row,
Int64  nrow,
Int64  incr,
const IPosition blc,
const IPosition trc,
const IPosition inc,
const String caller 
)
private

Sync table to get correct nr of rows and check the row number.

Fill the slicer with the possibly expanded blc,trc,inc. It returns the nr of table rows.

static Record casacore::TableProxy::getTableDesc ( const TableDesc tabdesc,
Bool  cOrder = False 
)
static

Create a Record table description from a TableDesc object.

Record casacore::TableProxy::getTableDescription ( Bool  actual,
Bool  cOrder = False 
)

Get the table description of the table.

It returns a record containing the description.

static String casacore::TableProxy::getTypeStr ( DataType  )
static

Get the type string as used externally (in e.g.

glish).

ValueHolder casacore::TableProxy::getValueFromTable ( const String colName,
Int64  rownr,
Int64  nrow,
Int64  incr,
Bool  isCell 
)
private

Get values from the column.

Nrow<0 means till the end of the column.

void casacore::TableProxy::getValueFromTable ( const String colName,
Int64  rownr,
Int64  nrow,
Int64  incr,
Bool  isCell,
const ValueHolder vh 
)
private
ValueHolder casacore::TableProxy::getValueSliceFromTable ( const String colName,
const Slicer slicer,
Int64  rownr,
Int64  nrow,
Int64  incr,
Bool  isCell 
)
private

Get value slices from the column.

Nrow<0 means till the end of the column.

void casacore::TableProxy::getValueSliceFromTable ( const String colName,
const Slicer slicer,
Int64  rownr,
Int64  nrow,
Int64  incr,
Bool  isCell,
const ValueHolder vh 
)
private
Record casacore::TableProxy::getVarColumn ( const String columnName,
Int64  row,
Int64  nrow,
Int64  incr 
)
Bool casacore::TableProxy::hasDataChanged ( )

Determine if data in the table has changed.

Bool casacore::TableProxy::hasLock ( Bool  mode)

Determine if the process has a read or write lock on the table.

Bool casacore::TableProxy::isMultiUsed ( Bool  checkSubTables)

Determine if the table (and optionally its subtables) are in use in another process.

Bool casacore::TableProxy::isReadable ( ) const

Test if a table is readable.

Bool casacore::TableProxy::isScalarColumn ( const String columnName)

Return in result if the column contains scalars.

Bool casacore::TableProxy::isWritable ( ) const

Test if a table is writable.

void casacore::TableProxy::lock ( Bool  mode,
Int  nattempts 
)

Acquire a (read or write) lock on the table.

Record casacore::TableProxy::lockOptions ( )

Get the lock options of the table.

It fills the record with the fields option, interval and maxwait.

ValueHolder casacore::TableProxy::makeEmptyArray ( DataType  dtype)
private

Make an empty array (with 1 axis) of the correct datatype.

static Table::EndianFormat casacore::TableProxy::makeEndianFormat ( const String endianFormat)
static

Turn the string into the endian format option.

An exception is thrown if the string is invalid.

static Bool casacore::TableProxy::makeHC ( const Record gdesc,
TableDesc tabdesc,
String message 
)
static

Make hypercolumn definitions for the given hypercolumns.

static TableLock casacore::TableProxy::makeLockOptions ( const Record options)
static

Get the lock options from the fields in the record.

If the record or lockoption is invalid, an exception is thrown.

static Bool casacore::TableProxy::makeTableDesc ( const Record gdesc,
TableDesc tabdesc,
String message 
)
static

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.

Int casacore::TableProxy::ncolumns ( )

Get #columns of the table.

Int64 casacore::TableProxy::nrows ( )

Get #rows of the table.

TableProxy& casacore::TableProxy::operator= ( const TableProxy )

Assignment.

template<typename T >
void casacore::TableProxy::printArray ( const Array< T > &  arr,
ostream &  os,
const String sep 
) const
private
void casacore::TableProxy::printArrayValue ( ostream &  os,
Bool  v,
const String  
) const
inlineprivate

Definition at line 702 of file TableProxy.h.

void casacore::TableProxy::printArrayValue ( ostream &  os,
Int  v,
const String  
) const
inlineprivate

Definition at line 704 of file TableProxy.h.

void casacore::TableProxy::printArrayValue ( ostream &  os,
Int64  v,
const String  
) const
inlineprivate

Definition at line 706 of file TableProxy.h.

void casacore::TableProxy::printArrayValue ( ostream &  os,
Double  v,
const String  
) const
inlineprivate

Definition at line 708 of file TableProxy.h.

void casacore::TableProxy::printArrayValue ( ostream &  os,
const DComplex &  v,
const String  
) const
inlineprivate

Definition at line 710 of file TableProxy.h.

void casacore::TableProxy::printArrayValue ( ostream &  os,
const String v,
const String  
) const
inlineprivate

Definition at line 712 of file TableProxy.h.

void casacore::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 casacore::TableProxy::putCell ( const String columnName,
const Vector< Int64 > &  rownrs,
const ValueHolder  
)

Put a value into a column in the table.

void casacore::TableProxy::putCellSlice ( const String columnName,
Int64  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 casacore::TableProxy::putCellSliceIP ( const String columnName,
Int64  row,
const ValueHolder ,
const IPosition blc,
const IPosition trc,
const IPosition inc 
)
void casacore::TableProxy::putColumn ( const String columnName,
Int64  row,
Int64  nrow,
Int64  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 casacore::TableProxy::putColumnSlice ( const String columnName,
Int64  row,
Int64  nrow,
Int64  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 casacore::TableProxy::putColumnSliceIP ( const String columnName,
const ValueHolder ,
const IPosition blc,
const IPosition trc,
const IPosition inc,
Int64  row,
Int64  nrow,
Int64  incr 
)
static void casacore::TableProxy::putKeyValue ( TableRecord keySet,
const RecordFieldId fieldId,
const ValueHolder value 
)
static

Put the value of a keyword.

static void casacore::TableProxy::putKeyValues ( TableRecord keySet,
const Record valueSet 
)
static
void casacore::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 casacore::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 casacore::TableProxy::putTableInfo ( const Record value)

Put the table info of the table.

void casacore::TableProxy::putValueInTable ( const String colName,
Int64  rownr,
Int64  nrow,
Int64  incr,
Bool  isCell,
const ValueHolder  
)
private

Put values into the column.

Nrow<0 means till the end of the column.

void casacore::TableProxy::putValueSliceInTable ( const String colName,
const Slicer slicer,
Int64  rownr,
Int64  nrow,
Int64  incr,
Bool  isCell,
const ValueHolder  
)
private

Put value slices into the column.

Nrow<0 means till the end of the column.

void casacore::TableProxy::putVarColumn ( const String columnName,
Int64  row,
Int64  nrow,
Int64  incr,
const Record values 
)
template<typename T >
static Array<T> casacore::TableProxy::record2Array ( const Record rec)
inlinestatic

Copy the array contents of the record fields to a single array.

This can only be done if the shape is constant.

Definition at line 672 of file TableProxy.h.

References casacore::IPosition::append(), casacore::RecordInterface::empty(), casacore::RecordInterface::get(), casacore::ArrayBase::ndim(), casacore::ArrayBase::shape(), and casacore::RecordInterface::size().

static Record casacore::TableProxy::recordColumnDesc ( const ColumnDesc ,
Bool  cOrder 
)
static

Make a record containing the column description.

static Record casacore::TableProxy::recordHCDesc ( const TableDesc tableDesc)
static

Make a record containing the description of all hypercolumns.

void casacore::TableProxy::removeColumns ( const Vector< String > &  columnNames)

Remove one or more columns from the table.

void casacore::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 casacore::TableProxy::removeRow ( const Vector< Int64 > &  rownrs)

Remove rows from the table.

void casacore::TableProxy::rename ( const String newTableName)

Rename the table.

void casacore::TableProxy::renameColumn ( const String nameOld,
const String nameNew 
)

Rename a column in the table.

void casacore::TableProxy::reopenRW ( )

Reopen the table for read/write.

void casacore::TableProxy::resync ( )

Resync the table.

Vector<Int64> casacore::TableProxy::rowNumbers ( TableProxy other)

Get the row numbers of the table.

TableProxy casacore::TableProxy::selectRows ( const Vector< Int64 > &  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 casacore::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 casacore::TableProxy::setMaximumCacheSize ( const String columnName,
Int  nbytes 
)

Set the maximum cache size for the given column in the table.

void casacore::TableProxy::setProperties ( const String name,
const Record properties,
Bool  byColumn 
)

Set the properties of a data manager given by column or data manager name.

Vector<Int64> casacore::TableProxy::shape ( )

Get the shape (#columns, #rows) of the table.

String casacore::TableProxy::showStructure ( Bool  showDataMan = True,
Bool  showColumns = True,
Bool  showSubTables = False,
Bool  sortColumns = False 
) const

Show the structure of a table.

static void casacore::TableProxy::stillSameShape ( Int same,
IPosition shape,
const IPosition newShape 
)
static

Check if the new shape is still the same.


same: 0=first time; 1=still the same; 2=different

void casacore::TableProxy::syncTable ( Table table)
private

Synchronize table if readlocking is in effect.

In this way the number of rows is up-to-date.

Table& casacore::TableProxy::table ( )
inline

Return the table object.

Definition at line 592 of file TableProxy.h.

References table_p.

Referenced by casacore::ImageAttrGroupCasa::isNull().

const Table& casacore::TableProxy::table ( ) const
inline

Definition at line 594 of file TableProxy.h.

References table_p.

Record casacore::TableProxy::tableInfo ( )

Get the table info of the table.

String casacore::TableProxy::tableName ( )

Get table name.

String casacore::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 casacore::TableProxy::unlock ( )

Release a lock on the table.

Member Data Documentation

String casacore::TableProxy::asciiFormat_p
private

Definition at line 804 of file TableProxy.h.

Record casacore::TableProxy::calcResult_p
private

Definition at line 805 of file TableProxy.h.

Table casacore::TableProxy::table_p
private

Definition at line 803 of file TableProxy.h.

Referenced by table().


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