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;
121 const Record& lockOptions,
139 const Record& lockOptions,
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,
260 const String& endianFormat,
476 const String& keywordName,
489 const String& keywordName,
505 const String& keywordName,
514 const String& keywordName,
565 const Record& properties);
641 {os <<
'"' << v <<
'"';}
741 const String& dataManagerType,
742 const String& dataManagerGroup,
791 for (
uInt i=0; i<rec.
size(); ++i, iter.next()) {
792 rec.
get (i, iter.array());
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 getCellVH(const String &columnName, Int row, const ValueHolder &vh)
TableProxy()
Default constructor initializes to not open.
A 1-D Specialization of the Array class.
long long Int64
Define the extra non-standard types used by Casacore (like proposed uSize, Size)
void putCellSliceIP(const String &columnName, Int row, const ValueHolder &, const IPosition &blc, const IPosition &trc, const IPosition &inc)
Bool hasDataChanged()
Determine if data in the table has changed.
void syncTable(Table &table)
Synchronize table if readlocking is in effect.
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 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 removeKeyword(const String &columnName, const String &keywordName, Int keywordIndex)
Remove a table or column keyword from the table.
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 removeRow(const Vector< Int > &rownrs)
Remove rows from the table.
Main interface class to a read/write table.
Record getTableDescription(Bool actual, Bool cOrder=False)
Get the table description of the table.
void putColumnSliceIP(const String &columnName, const ValueHolder &, const IPosition &blc, const IPosition &trc, const IPosition &inc, Int row, Int nrow, Int incr)
~TableProxy()
Close the 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.
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
Envelope class for the description of a table column.
void reopenRW()
Reopen the table for read/write.
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.
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...
void unlock()
Release a lock on the table.
void getCellSliceVH(const String &columnName, Int row, const Vector< Int > &blc, const Vector< Int > &trc, const Vector< Int > &inc, const ValueHolder &vh)
Bool getColInfo(const String &colName, Bool useBrackets, String &type, String &message)
Get the column info for toAscii.
void putColumn(const String &columnName, Int row, Int nrow, Int incr, const ValueHolder &)
Put some or all values into a column in the table.
ValueHolder getColumn(const String &columnName, Int row, Int nrow, Int incr)
Get some or all values from a column in the table.
String tableName()
Get table name.
void putValueSliceInTable(const String &colName, const Slicer &slicer, Int rownr, Int nrow, Int incr, Bool isCell, const ValueHolder &)
Put value slices into the column.
Record getColumnDescription(const String &columnName, Bool actual, Bool cOrder=False)
Get the column description of a column in the table.
void copyRows(TableProxy &out, Int startIn, Int startOut, Int nrow)
Copy rows from one table to another.
Record getCalcResult() const
Get result of possible CALC statement.
bool empty() const
Is the record empty?
ValueHolder getCellSliceIP(const String &columnName, Int row, const IPosition &blc, const IPosition &trc, const IPosition &inc)
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.
void putVarColumn(const String &columnName, Int row, Int nrow, Int incr, const Record &values)
void putValueInTable(const String &colName, Int rownr, Int nrow, Int incr, Bool isCell, const ValueHolder &)
Put values into the column.
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.
Vector< Int > shape()
Get the shape (#columns, #rows) of the table.
void setMaximumCacheSize(const String &columnName, Int nbytes)
Set the maximum cache size for the given column in the table.
Record getKeywordSet(const String &columnName)
Get the table or column keyword values in the table.
ValueHolder getValueFromTable(const String &colName, Int rownr, Int nrow, Int incr, Bool isCell)
Get values from the column.
Iterate an Array cursor through another Array.
void append(const IPosition &other)
Append this IPosition with another one (causing a resize).
void findKeyId(RecordFieldId &fieldid, const TableRecord *&keySet, const String &keyname, const String &column)
Split the keyname into its separate parts (separator is .).
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)
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, 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.
uInt ndim() const
The dimensionality of this array.
Record getVarColumn(const String &columnName, Int row, Int nrow, Int incr)
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.
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.
std::complex< Double > DComplex
A holder for a value of any basic Casacore data type.
void setProperties(const String &name, Bool byColumn, const Record &properties)
Set the properties of a data manager given by column or data manager name.
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.
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).
void printArrayValue(ostream &os, Bool v, const String &) const
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 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 flush(Bool recursive)
Flush the table and optionally all its subtables.
Class to hold table lock options.
static ValueHolder getKeyValue(const TableRecord &keySet, const RecordFieldId &fieldId)
Get the value of a keyword.
Int nrows()
Get #rows of the table.
A hierarchical collection of named fields of various types.
template <class T, class U> class vector;
static String getTypeStr(DataType)
Get the type string as used externally (in e.g.
Bool cellContentsDefined(const String &columnName, Int rownr)
Tests if the contents of a cell are defined.
void removeColumns(const Vector< String > &columnNames)
Remove one or more columns from the table.
void printArrayValue(ostream &os, const String &v, const String &) const
static Record recordColumnDesc(const ColumnDesc &, Bool cOrder)
Make a record containing the column description.
void deleteTable(Bool checkSubTables)
Close and delete 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.
Specify which elements to extract from an n-dimensional array.
static void putKeyValues(TableRecord &keySet, const Record &valueSet)
static Table::EndianFormat makeEndianFormat(const String &endianFormat)
Turn the string into the endian format option.
TableProxy selectRows(const Vector< Int > &rownrs, const String &outName)
Select the given rows from the table and create a new (reference) table.
Bool isReadable() const
Test if a table is readable.
void getColumnSliceVHIP(const String &columnName, const IPosition &blc, const IPosition &trc, const IPosition &inc, Int row, Int nrow, Int incr, const ValueHolder &vh)
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.
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.
TableProxy(const Table &table)
Create the object from an existing table (used by some methods).
void printArrayValue(ostream &os, const DComplex &v, const String &) const
ValueHolder getColumnSliceIP(const String &columnName, const IPosition &blc, const IPosition &trc, const IPosition &inc, Int row, Int nrow, Int incr)
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 getColumnVH(const String &columnName, Int row, Int nrow, Int incr, const ValueHolder &vh)
void getCellSliceVHIP(const String &columnName, Int row, const IPosition &blc, const IPosition &trc, const IPosition &inc, const ValueHolder &vh)
void printArrayValue(ostream &os, Int64 v, const String &) const
TableProxy & operator=(const TableProxy &)
Assignment.
Vector< Int > rowNumbers(TableProxy &other)
Get the row numbers of the table.
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.
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.
this file contains all the compiler specific defines
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 addRow(Int nrow)
Add rows to the 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.
void printArrayValue(ostream &os, Double v, const String &) const
const IPosition & shape() const
The length of each axis.
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 addReadmeLine(const String &line)
Add a line to the TableInfo readme.