28 #ifndef TABLES_TABLE_H 29 #define TABLES_TABLE_H 33 #include <casacore/casa/aips.h> 34 #include <casacore/tables/Tables/BaseTable.h> 35 #include <casacore/tables/Tables/TableLock.h> 36 #include <casacore/tables/DataMan/TSMOption.h> 37 #include <casacore/casa/Utilities/DataType.h> 38 #include <casacore/casa/Utilities/Sort.h> 51 template<
class T>
class Vector;
52 template<
class T>
class Block;
53 template<
class T>
class CountedPtr;
555 Int maxVal=25)
const;
982 const Record& dataManagerInfo,
1160 endianFormat, noRows); }
1170 endianFormat, noRows); }
1240 Bool byColumn)
const 1252 showSubTables, sortColumns, cOrder); }
void showKeywords(std::ostream &, Bool showSubTables=False, Bool showTabKey=True, Bool showColKey=False, Int maxVal=25) const
Show the table and/or column keywords, possibly also of all subtables.
virtual void renameHypercolumn(const String &newName, const String &oldName)=0
Rename a hypercolumn.
void markForDelete()
Mark the table for delete.
const String & tableName() const
Get the table name.
void addRow(uInt nrrow=1, Bool initialize=False)
Add one or more rows at the end of the table.
Table & operator=(const Table &)
Assignment (reference semantics).
A 1-D Specialization of the Array class.
Block< String > getPartNames(Bool recursive=False) const
Get the names of the tables this table consists of.
void removeColumn(const String &columnName)
Remove columns.
void copy(const String &newName, TableOption, Bool noRows=False) const
Copy the table and all its subtables.
Bool isSameRoot(const Table &other) const
Is the root table of this table the same as that of the other one?
void renameColumn(const String &newName, const String &oldName)
Rename a column.
LockOption
Define the possible table locking options.
Table project(const Block< String > &columnNames) const
Project the given columns (i.e.
Create a new table - define shapes, data managers, etc.
friend AipsIO & operator>>(AipsIO &, Table &)
Read a table from AipsIO (for TypedKeywords<Table>).
virtual const StorageOption & storageOption() const =0
Get the storage option used for the table.
virtual DataManager * findDataManager(const String &name, Bool byColumn) const =0
Find the data manager with the given name or for the given column.
const TableDesc & tableDesc() const
Get the table description.
EndianFormat
Define the possible endian formats in which table data can be stored.
void open(const String &name, const String &type, int tableOption, const TableLock &lockOptions, const TSMOption &tsmOpt)
Open an existing table.
Table()
Create a null Table object (i.e.
Class defining a plain regular table.
static Vector< String > getLockedTables(FileLocker::LockType=FileLocker::Read, int lockOption=-1)
Get the names of tables locked in this process.
Vector< uInt > rowNumbers() const
Get a vector of row numbers in the root table of rows in this table.
Bool isColumnStored(const String &columnName) const
Test if the given column is stored (otherwise it is virtual).
Table operator()(const TableExprNode &, uInt maxRow=0, uInt offset=0) const
Select rows from a table using an select expression consisting of TableExprNode objects.
Main interface class to a read/write table.
LatticeExprNode mask(const LatticeExprNode &expr)
This function returns the mask of the given expression.
new table, which gets marked for delete
Bool isColumnWritable(const String &columnName) const
Test if the given column is writable.
AipsIO is the object persistency mechanism of Casacore.
virtual Bool canRenameColumn(const String &columnName) const =0
Test if a column can be renamed.
virtual void reopenRW()=0
Reopen the table for read/write.
Handle class for a table column expression tree.
Class for a table held in memory.
TableExprNode keyCol(const String &name, const Vector< String > &fieldNames) const
Envelope class for the description of a table column.
virtual const TableLock & lockOptions() const =0
Get the locking info.
void showKeywordSets(std::ostream &, Bool showTabKey, Bool showColKey, Int maxVal) const
Show the table and/or column keywords of this table.
virtual void addRow(uInt nrrow=1, Bool initialize=True)
Add one or more rows and possibly initialize them.
void unmarkForDelete(Bool callback, const String &oldName)
Unmark the table for delete.
Table sort(const String &columnName, int=Sort::Ascending, int=Sort::ParSort) const
Sort a table on one or more columns of scalars.
int tableOption() const
Get the table option.
Table copyToMemoryTable(const String &name, Bool noRows=False) const
Make a copy of a table to a MemoryTable object.
TableDesc actualTableDesc() const
const TableDesc & tableDesc() const
Get the table description.
static Vector< String > nonWritableFiles(const String &tableName)
Find the non-writable files in a table.
Bool canRemoveColumn(const String &columnName) const
Test if columns can be removed.
virtual void rename(const String &newName, int tableOption)
Rename the table.
void deepCopy(const String &newName, TableOption, Bool valueCopy=False, EndianFormat=AipsrcEndian, Bool noRows=False) const
virtual Bool lock(FileLocker::LockType, uInt nattempts)=0
Try to lock the table for read or write access.
store table data in big endian (e.g.
TableExprNode key(const String &keywordName) const
Create a TableExprNode object for a column or for a keyword in the table keyword set.
Bool hasLock(FileLocker::LockType=FileLocker::Write) const
Has this process the read or write lock, thus can the table be read or written safely?
Abstract base class for a node in a table column expression tree.
static ScratchCallback * scratchCallback_p
void ScratchCallback(const String &name, Bool isScratch, const String &oldName)
Define the signature of the function being called when the state of a scratch table changes (i...
void removeRow(uInt rownr)
Remove the given row(s).
Record dataManagerInfo() const
Return all data managers used and the columns served by them.
Bool canRemoveRow() const
Test if it is possible to remove a row from this table.
Table operator^(const Table &) const
Xor with another table.
Table operator &(const Table &) const
Do logical operations on a table.
int tableOption() const
Get the table option.
virtual ~Table()
The destructor flushes (i.e.
void flushTableInfo() const
Write the TableInfo object.
void markForDelete(Bool callback, const String &oldName)
Mark the table for delete.
void rename(const String &newName, TableOption)
Rename the table and all its subtables.
Bool canRenameColumn(const String &columnName) const
Test if a column can be renamed.
BaseTable * baseTablePtr() const
Get the pointer to the underlying BaseTable.
Options defining how table files are organized.
use endian format defined in the aipsrc variable table.endianformat If undefined, it defaults to Loca...
void getTableKeyword(AipsIO &, Bool openWritable)
Read a table from AipsIO (for TableKeywords).
virtual BaseTable * root()
Get pointer to root table (i.e.
create table (may not exist)
void renameHypercolumn(const String &newName, const String &oldName)
static uInt getLayout(TableDesc &desc, const String &tableName)
Return the layout of a table (i.e.
Memory related information and utilities. use visibility=export>
Referenced counted pointer for constant data.
Abstract base class for tables.
Class for a table as a view of another table.
Bool isMarkedForDelete() const
Test if the table is marked for delete.
virtual void deepCopy(const String &newName, const Record &dataManagerInfo, const StorageOption &, int tableOption, Bool valueCopy, int endianFormat, Bool noRows) const
TableType tableType() const
Get the table type.
const TableLock & lockOptions() const
Get the locking options.
void resync()
Resynchronize the Table object with the table file.
virtual int tableType() const
Get the table type.
static Bool canDeleteTable(const String &tableName, Bool checkSubTables=False)
Can the table be deleted? If true, function deleteTable can safely be called.
plain table (stored on disk)
Bool isWritable() const
Test if this table is opened as writable.
friend AipsIO & operator<<(AipsIO &, const Table &)
Write a table to AipsIO (for TypedKeywords<Table>).
void closeSubTables() const
Close all open subtables.
void unmarkForDelete()
Unmark the table for delete.
Bool fastRowNumbers(const Vector< uInt > &v1, const Vector< uInt > &v2, Vector< uInt > &rows) const
Try if v1 is a subset of v2 and fill rows with its indices in v2.
virtual void removeColumn(const Vector< String > &columnNames)=0
Remove columns.
static void deleteTable(const String &tableName, Bool checkSubTables=False)
Delete the table.
TableExprNode nodeRownr(uInt origin=0) const
Create a TableExprNode object for the rownumber function.
uInt nrow() const
Get number of rows.
Options for the Tiled Storage Manager Access.
virtual void unlock()=0
Unlock the table.
A hierarchical collection of named fields of various types.
bool Bool
Define the standard types used by Casacore.
virtual Bool isWritable() const =0
Test if this table is writable.
virtual void removeRow(uInt rownr)
Remove rows.
Bool lock(FileLocker::LockType=FileLocker::Write, uInt nattempts=0)
Try to lock the table for read or write access (default is write).
Bool isColumnStored(const String &columnName) const
Test if the given column is stored (otherwise it is virtual).
DataManager * findDataManager(const String &name, Bool byColumn=False) const
Find the data manager with the given name or for the given column name.
TableRecord & rwKeywordSet()
Get read/write access to the table keyword set.
Bool isColumnWritable(const String &columnName) const
Test if the given column is writable.
Read/write access to a table column.
Table type, subtype and further info.
Table operator!() const
Take complement.
static Bool isOpened(const String &tableName)
Is the table used (i.e.
Class to hold table lock options.
BaseTable * lookCache(const String &name, int tableOption, const TableLock &tableInfo)
Look in the cache if the table is already open.
virtual void resync()=0
Resync the Table object with the table file.
A hierarchical collection of named fields of various types.
template <class T, class U> class vector;
static uInt nAutoLocks()
Determine the number of locked tables opened with the AutoLock option (Locked table means locked for ...
static String fileName(const String &tableName)
Make the table file name.
TableExprNode col(const String &columnName) const
Table operator-(const Table &) const
Subtract another table.
virtual Bool canRemoveColumn(const Vector< String > &columnNames) const =0
Test if columns can be removed.
static Bool isNativeDataType(DataType dtype)
Test if the given data type is native to the table system.
Bool isMultiUsed(Bool checkSubTables=False) const
Is the table used (i.e.
virtual Bool isNull() const
Is the table a null table? By default it is not.
Bool isMarkedForDelete() const
Test if the table is marked for delete.
Base class for the Data Manager Accessor classes.
uInt nrow() const
Get the number of rows.
Bool canAddRow() const
Test if it is possible to add a row to this table.
Abstract base class for a data manager.
void throwIfNull() const
Throw an exception if the object is null, i.e.
virtual Bool canRemoveRow() const
Test if it is possible to remove a row from this table.
const StorageOption & storageOption() const
Get the storage option used for the table.
static ScratchCallback * setScratchCallback(ScratchCallback *)
Set the pointer to the ScratchCallback function.
virtual void flushTableInfo()
Write the TableInfo object.
const TableRecord & keywordSet() const
Get readonly access to the table keyword set.
Table operator|(const Table &) const
Union with another table.
virtual void flush(Bool fsync, Bool recursive)=0
Flush the table, i.e.
String: the storage and methods of handling collections of characters.
virtual Bool isMultiUsed(Bool checkSubTables) const =0
Is the table in use (i.e.
void addColumns(const TableDesc &tableDesc, const Record &dmInfo, Bool addToParent)
Add one or more columns to the table.
void showStructure(std::ostream &, Bool showDataMans=True, Bool showColumns=True, Bool showSubTables=False, Bool sortColumns=False, Bool cOrder=False) const
Show the structure of the table.
virtual void renameColumn(const String &newName, const String &oldName)=0
Rename a column.
static void relinquishAutoLocks(Bool all=False)
Unlock locked tables opened with the AutoLock option.
const TableInfo & tableInfo() const
Get access to the TableInfo object.
TableExprNode nodeRandom() const
Create a TableExprNode object for the rand function.
Define the structure of a Casacore table.
Bool isRootTable() const
Test if this table is the root table (ie.
virtual void addColumn(const ColumnDesc &columnDesc, Bool addToParent)
Add one or more columns to the table.
void showStructure(std::ostream &, Bool showDataMan, Bool showColumns, Bool showSubTables, Bool sortColumns, Bool cOrder)
Show the table structure (implementation of Table::showStructure).
void showColumnInfo(ostream &os, const TableDesc &, uInt maxNameLength, const Array< String > &columnNames, Bool sort) const
Show the info of the given columns.
const String & tableName() const
Get the table name.
LockType
Define the possible lock types.
TableType
Define the possible table types.
Class to view a concatenation of tables as a single table.
void reopenRW()
Try to reopen the table for read/write access.
store data in the endian format of the machine used
LatticeExprNode all(const LatticeExprNode &expr)
Bool isNull() const
Test if the object is null, i.e.
void addColumn(const ColumnDesc &columnDesc, Bool addToParent=True)
Add a column to the table.
Bool hasDataChanged()
Determine if column or keyword table data have changed (or is being changed) since the last time this...
virtual Bool canAddRow() const
Test if it is possible to add a row to this table.
static Table openTable(const String &tableName, TableOption=Table::Old, const TSMOption &=TSMOption())
Try to open a table.
virtual Bool hasLock(FileLocker::LockType) const =0
Has this process the read or write lock, thus can the table be read or written safely?
this file contains all the compiler specific defines
TableInfo & tableInfo()
Get access to the TableInfo object.
void flush(Bool fsync=False, Bool recursive=False)
Flush the table, i.e.
store table data in little endian (e.g.
TableOption
Define the possible options how a table can be opened.
void unlock()
Unlock the table.
static BaseTable * makeBaseTable(const String &name, const String &type, int tableOption, const TableLock &lockOptions, const TSMOption &tsmOpt, Bool addToCache, uInt locknr)
Construct a BaseTable object from the table file.
Table::EndianFormat endianFormat() const
Get the endian format in which the table is stored.
virtual TableRecord & keywordSet()=0
Get readonly access to the table keyword set.
static Bool isReadable(const String &tableName, bool throwIf=False)
Test if a table with the given name exists and is readable.