Go to the documentation of this file.
28 #ifndef TABLES_TABLEPROXY_H
29 #define TABLES_TABLEPROXY_H
33 #include <casacore/casa/aips.h>
34 #include <casacore/tables/Tables/Table.h>
35 #include <casacore/casa/Containers/Record.h>
36 #include <casacore/casa/Arrays/Vector.h>
48 template<
class T>
class Vector;
141 TableProxy (
const std::vector<TableProxy>& tables,
143 int dummy1=0,
int dummy2=0,
int dummy3=0);
155 const std::vector<TableProxy>& tables);
167 const String& commentMarker,
476 const String& keywordName,
489 const String& keywordName,
505 const String& keywordName,
514 const String& keywordName,
642 const String& dataManagerType,
643 const String& dataManagerGroup,
684 for (
uInt i=0; i<rec.
size(); ++i, iter.next()) {
685 rec.
get (i, iter.array());
714 {os <<
'"' << v <<
'"';}
Define the structure of a Casacore table.
Specify which elements to extract from an n-dimensional array.
ValueHolder getKeyword(const String &columnName, const String &keywordName, Int keywordIndex)
Get a table or column keyword value in the table.
static void putKeyValue(TableRecord &keySet, const RecordFieldId &fieldId, const ValueHolder &value)
Put the value of a keyword.
void syncTable(Table &table)
Synchronize table if readlocking is in effect.
Bool hasDataChanged()
Determine if data in the table has changed.
Record getCalcResult() const
Get result of possible CALC statement.
Iterate an Array cursor through another Array.
A Vector of integers, for indexing into Array<T> objects.
void reopenRW()
Reopen the table for read/write.
static Record recordColumnDesc(const ColumnDesc &, Bool cOrder)
Make a record containing the column description.
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).
Record getProperties(const String &name, Bool byColumn)
Get the properties of a data manager given by column or data manager name.
String showStructure(Bool showDataMan=True, Bool showColumns=True, Bool showSubTables=False, Bool sortColumns=False) const
Show the structure of a table.
Int 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.
void renameColumn(const String &nameOld, const String &nameNew)
Rename a column in the table.
void getColumnSliceVH(const String &columnName, Int row, Int nrow, Int incr, const Vector< Int > &blc, const Vector< Int > &trc, const Vector< Int > &inc, const ValueHolder &vh)
void addReadmeLine(const String &line)
Add a line to the TableInfo readme.
EndianFormat
Define the possible endian formats in which table data can be stored.
Vector< String > getFieldNames(const String &columnName, const String &keywordName, Int keywordIndex)
Get the names of all field in a record in the table.
std::complex< Double > DComplex
ValueHolder getValueSliceFromTable(const String &colName, const Slicer &slicer, Int rownr, Int nrow, Int incr, Bool isCell)
Get value slices from the column.
ValueHolder getCell(const String &columnName, Int row)
Get a value from a column in the table.
A hierarchical collection of named fields of various types.
void putKeyword(const String &columnName, const String &keywordName, Int keywordIndex, Bool makeSubRecord, const ValueHolder &)
Define a table or column keyword in the table.
Vector< Int > shape()
Get the shape (#columns, #rows) of the table.
Record getKeywordSet(const String &columnName)
Get the table or column keyword values in the table.
uInt ndim() const
The dimensionality of this array.
Bool isMultiUsed(Bool checkSubTables)
Determine if the table (and optionally its subtables) are in use in another process.
static Array< T > record2Array(const Record &rec)
Copy the array contents of the record fields to a single array.
LatticeExprNode ndim(const LatticeExprNode &expr)
1-argument function to get the dimensionality of a lattice.
ValueHolder getColumn(const String &columnName, Int row, Int nrow, Int incr)
Get some or all values from a column in the table.
void printArrayValue(ostream &os, const DComplex &v, const String &) const
void getCellSliceVH(const String &columnName, Int row, const Vector< Int > &blc, const Vector< Int > &trc, const Vector< Int > &inc, const ValueHolder &vh)
Bool isWritable() const
Test if a table is writable.
void printArrayValue(ostream &os, const String &v, const String &) const
static void stillSameShape(Int &same, IPosition &shape, const IPosition &newShape)
Check if the new shape is still the same.
Bool isReadable() const
Test if a table is readable.
static ValueHolder getKeyValue(const TableRecord &keySet, const RecordFieldId &fieldId)
Get the value of a keyword.
void printValueHolder(const ValueHolder &vh, ostream &os, const String &sep, Int prec, Bool useBrackets) const
Print the data in a table cell for toAscii.
void putValueInTable(const String &colName, Int rownr, Int nrow, Int incr, Bool isCell, const ValueHolder &)
Put values into the column.
Vector< String > getPartNames(Bool recursive)
Get the names of the parts the table consists of (e.g.
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).
bool empty() const
Is the record empty?
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.
void lock(Bool mode, Int nattempts)
Acquire a (read or write) lock on the table.
void printArrayValue(ostream &os, Int v, const String &) const
void findKeyId(RecordFieldId &fieldid, const TableRecord *&keySet, const String &keyname, const String &column)
Split the keyname into its separate parts (separator is.).
void rename(const String &newTableName)
Rename the table.
void putCell(const String &columnName, const Vector< Int > &rownrs, const ValueHolder &)
Put a value into a column in the table.
const IPosition & shape() const
The length of each axis.
static Table::EndianFormat makeEndianFormat(const String &endianFormat)
Turn the string into the endian format option.
Main interface class to a read/write table.
LatticeExprNode value(const LatticeExprNode &expr)
This function returns the value of the expression without a mask.
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 getValueFromTable(const String &colName, Int rownr, Int nrow, Int incr, Bool isCell)
Get values from the column.
void putTableInfo(const Record &value)
Put the table info of the table.
void printArrayValue(ostream &os, Int64 v, const String &) const
void putColumn(const String &columnName, Int row, Int nrow, Int incr, const ValueHolder &)
Put some or all values into a column in the table.
String columnDataType(const String &columnName)
Return the data type of the column as: Bool, UChar, Short, UShort, Int, UInt, Int64,...
String tableName()
Get table name.
TableProxy selectRows(const Vector< Int > &rownrs, const String &outName)
Select the given rows from the table and create a new (reference) table.
Record getVarColumn(const String &columnName, Int row, Int nrow, Int incr)
~TableProxy()
Close the table.
Record getDataManagerInfo()
Get the data manager info of the table.
Int nrows()
Get #rows of the table.
ValueHolder makeEmptyArray(DataType dtype)
Make an empty array (with 1 axis) of the correct datatype.
void close()
Flush and close the table and all its subtables.
static Record recordHCDesc(const TableDesc &tableDesc)
Make a record containing the description of all hypercolumns.
void unlock()
Release a lock on the table.
Vector< String > columnNames()
Get all column names in the table.
String columnArrayType(const String &columnName)
Return the type of array in the column as: Direct Undefined FixedShape Direct,Undefined Direct,...
Vector< Int > rowNumbers(TableProxy &other)
Get the row numbers of the table.
void setDefaultForSlicer(IPosition &vec) const
Replace the user-given default value (<0) by the default value used by Slicer (i.e.
Class to hold table lock options.
this file contains all the compiler specific defines
static void putKeyValues(TableRecord &keySet, const Record &valueSet)
static Bool makeHC(const Record &gdesc, TableDesc &tabdesc, String &message)
Make hypercolumn definitions for the given hypercolumns.
static String getTypeStr(DataType)
Get the type string as used externally (in e.g.
void flush(Bool recursive)
Flush the table and optionally all its subtables.
ValueHolder getCellSliceIP(const String &columnName, Int row, const IPosition &blc, const IPosition &trc, const IPosition &inc)
void resync()
Resync the table.
void get(const RecordFieldId &, Bool &value) const
Get the value of the given field.
void printArrayValue(ostream &os, Bool v, const String &) const
Handle class for a table column expression tree.
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.
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.
String endianFormat() const
Get the endian format of the table.
static Record getTableDesc(const TableDesc &tabdesc, Bool cOrder=False)
Create a Record table description from a TableDesc object.
TableProxy & operator=(const TableProxy &)
Assignment.
void deleteTable(Bool checkSubTables)
Close and delete the table.
static void calcValues(Record &rec, const TableExprNode &expr)
Calculate the values of a CALC expression and store them in field 'values' in rec.
void putKeywordSet(const String &columnName, const Record &valueSet)
Define multiple table or column keywords in the table.
Bool hasLock(Bool mode)
Determine if the process has a read or write lock on the table.
void removeRow(const Vector< Int > &rownrs)
Remove rows from the table.
long long Int64
Define the extra non-standard types used by Casacore (like proposed uSize, Size)
TableProxy(const Table &table)
Create the object from an existing table (used by some methods).
void getCellVH(const String &columnName, Int row, const ValueHolder &vh)
void getColumnSliceVHIP(const String &columnName, const IPosition &blc, const IPosition &trc, const IPosition &inc, Int row, Int nrow, Int incr, const ValueHolder &vh)
Record lockOptions()
Get the lock options of the table.
template <class T, class U> class vector;
void getCellSliceVHIP(const String &columnName, Int row, const IPosition &blc, const IPosition &trc, const IPosition &inc, const ValueHolder &vh)
String: the storage and methods of handling collections of characters.
void addRow(Int nrow)
Add rows to the table.
Bool cellContentsDefined(const String &columnName, Int rownr)
Tests if the contents of a cell are defined.
bool Bool
Define the standard types used by Casacore.
A holder for a value of any basic Casacore data type.
ValueHolder getColumnSliceIP(const String &columnName, const IPosition &blc, const IPosition &trc, const IPosition &inc, Int row, Int nrow, Int incr)
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,...
High-level interface to tables.
static IPosition fillAxes(const IPosition &, Bool cOrder)
Optionally reverse the axes.
void putColumnSliceIP(const String &columnName, const ValueHolder &, const IPosition &blc, const IPosition &trc, const IPosition &inc, Int row, Int nrow, Int incr)
A hierarchical collection of named fields of various types.
Bool isScalarColumn(const String &columnName)
Return in result if the column contains scalars.
void addColumns(const Record &tableDesc, const Record &dminfo, Bool addToParent)
Add one or more columns to the table.
void append(const IPosition &other)
Append this IPosition with another one (causing a resize).
void printArrayValue(ostream &os, Double v, const String &) const
static Bool makeTableDesc(const Record &gdesc, TableDesc &tabdesc, String &message)
Make a real table description from a table description in a record.
static TableLock makeLockOptions(const Record &options)
Get the lock options from the fields in the record.
void setProperties(const String &name, const Record &properties, Bool byColumn)
Set the properties of a data manager given by column or data manager name.
A 1-D Specialization of the Array class.
void putValueSliceInTable(const String &colName, const Slicer &slicer, Int rownr, Int nrow, Int incr, Bool isCell, const ValueHolder &)
Put value slices into the column.
Table & table()
Return the table object.
Record tableInfo()
Get the table info of the table.
String getAsciiFormat() const
Get ascii format string.
Int ncolumns()
Get #columns of the table.
Bool getColInfo(const String &colName, Bool useBrackets, String &type, String &message)
Get the column info for toAscii.
Record getColumnDescription(const String &columnName, Bool actual, Bool cOrder=False)
Get the column description of a column in the table.
const Table & table() const
void copyRows(TableProxy &out, Int startIn, Int startOut, Int nrow)
Copy rows from one table to another.
void removeColumns(const Vector< String > &columnNames)
Remove one or more columns from the table.
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.
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.
Envelope class for the description of a table column.
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.
void getColumnVH(const String &columnName, Int row, Int nrow, Int incr, const ValueHolder &vh)
The identification of a record field.
void printArray(const Array< T > &arr, ostream &os, const String &sep) const
static Record getKeyValues(const TableRecord &keySet)
Get or put the values of all keywords.
void putVarColumn(const String &columnName, Int row, Int nrow, Int incr, const Record &values)
Record getTableDescription(Bool actual, Bool cOrder=False)
Get the table description of the table.
TableProxy()
Default constructor initializes to not open.
void removeKeyword(const String &columnName, const String &keywordName, Int keywordIndex)
Remove a table or column keyword from the table.
void setMaximumCacheSize(const String &columnName, Int nbytes)
Set the maximum cache size for the given column in the table.
void putCellSliceIP(const String &columnName, Int row, const ValueHolder &, const IPosition &blc, const IPosition &trc, const IPosition &inc)