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