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