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;
962 const Record& dataManagerInfo,
1139 endianFormat, noRows); }
1209 Bool byColumn)
const 1218 Bool sortColumns)
const 1220 showSubTables, sortColumns); }
void showStructure(std::ostream &, Bool showDataMans=True, Bool showColumns=True, Bool showSubTables=False, Bool sortColumns=False) const
Show the structure of the table.
BaseTable * baseTablePtr() const
Get the pointer to the underlying BaseTable.
virtual void renameHypercolumn(const String &newName, const String &oldName)=0
Rename a hypercolumn.
void markForDelete()
Mark the table for delete.
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).
DataManager * findDataManager(const String &name, Bool byColumn=False) const
Find the data manager with the given name or for the given column name.
A 1-D Specialization of the Array class.
void removeColumn(const String &columnName)
Remove columns.
void renameColumn(const String &newName, const String &oldName)
Rename a column.
LockOption
Define the possible table locking options.
Create a new table - define shapes, data managers, etc.
friend AipsIO & operator>>(AipsIO &, Table &)
Read a table from AipsIO (for TypedKeywords<Table>).
Vector< uInt > rowNumbers() const
Get a vector of row numbers in the root table of rows in this 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.
int tableOption() const
Get the table option.
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.
Bool isColumnWritable(const String &columnName) const
Test if the given column is writable.
Class defining a plain regular table.
virtual Bool isNull() const
Is the table a null table? By default it is not.
static Vector< String > getLockedTables(FileLocker::LockType=FileLocker::Read, int lockOption=-1)
Get the names of tables locked in this process.
Main interface class to a read/write table.
LatticeExprNode mask(const LatticeExprNode &expr)
This function returns the mask of the given expression.
Table operator()(const TableExprNode &, uInt maxRow=0, uInt offset=0) const
Select rows from a table using an select expression consisting of TableExprNode objects.
new table, which gets marked for delete
virtual int tableType() const
Get the table type.
AipsIO is the object persistency mechanism of Casacore.
virtual Bool canRenameColumn(const String &columnName) const =0
Test if a column can be renamed.
int tableOption() const
Get the table option.
Bool isColumnStored(const String &columnName) const
Test if the given column is stored (otherwise it is virtual).
virtual void reopenRW()=0
Reopen the table for read/write.
Bool canAddRow() const
Test if it is possible to add a row to this table.
Handle class for a table column expression tree.
Class for a table held in memory.
Table project(const Block< String > &columnNames) const
Project the given columns (i.e.
Bool isMarkedForDelete() const
Test if the table is marked for delete.
Envelope class for the description of a table column.
Table::EndianFormat endianFormat() const
Get the endian format in which the table is stored.
virtual const TableLock & lockOptions() const =0
Get the locking info.
void showColumnInfo(ostream &os, const TableDesc &, uInt maxNameLength, const Array< String > &columnNames, Bool sort) const
Show the info of the given columns.
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.
static Vector< String > nonWritableFiles(const String &tableName)
Find the non-writable files in a table.
virtual void rename(const String &newName, int tableOption)
Rename the table.
Bool isColumnWritable(const String &columnName) const
Test if the given column is writable.
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.
void throwIfNull() const
Throw an exception if the object is null, i.e.
TableType tableType() const
Get the table type.
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).
Bool isWritable() const
Test if this table is opened as writable.
Table operator-(const Table &) const
Subtract another table.
const String & tableName() const
Get the table name.
virtual ~Table()
The destructor flushes (i.e.
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.
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.
TableDesc actualTableDesc() const
Bool isMultiUsed(Bool checkSubTables=False) const
Is the table used (i.e.
Memory related information and utilities. use visibility=export>
Table operator^(const Table &) const
Xor with another table.
Referenced counted pointer for constant data.
Abstract base class for tables.
Class for a table as a view of another table.
void resync()
Resynchronize the Table object with the table file.
static Bool canDeleteTable(const String &tableName, Bool checkSubTables=False)
Can the table be deleted? If true, function deleteTable can safely be called.
const String & tableName() const
Get the table name.
plain table (stored on disk)
TableExprNode nodeRownr(uInt origin=0) const
Create a TableExprNode object for the rownumber function.
friend AipsIO & operator<<(AipsIO &, const Table &)
Write a table to AipsIO (for TypedKeywords<Table>).
Record dataManagerInfo() const
Return all data managers used and the columns served by them.
void unmarkForDelete()
Unmark the table for delete.
virtual void removeColumn(const Vector< String > &columnNames)=0
Remove columns.
static void deleteTable(const String &tableName, Bool checkSubTables=False)
Delete the table.
Options for the Tiled Storage Manager Access.
const TableLock & lockOptions() const
Get the locking options.
virtual void unlock()=0
Unlock the table.
TableExprNode keyCol(const String &name, const Vector< String > &fieldNames) const
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.
Table sort(const String &columnName, int=Sort::Ascending, int=Sort::ParSort) const
Sort a table on one or more columns of scalars.
TableExprNode key(const String &keywordName) const
Create a TableExprNode object for a column or for a keyword in the table keyword set.
Bool lock(FileLocker::LockType=FileLocker::Write, uInt nattempts=0)
Try to lock the table for read or write access (default is write).
uInt nrow() const
Get the number of rows.
TableRecord & rwKeywordSet()
Get read/write access to the table keyword set.
Read/write access to a table column.
Table type, subtype and further info.
static Bool isOpened(const String &tableName)
Is the table used (i.e.
Class to hold table lock options.
TableExprNode col(const String &columnName) const
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.
virtual Bool canAddRow() const
Test if it is possible to add a row to this table.
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 ...
uInt nrow() const
Get number of rows.
Bool canRemoveRow() const
Test if it is possible to remove a row from this table.
Bool isMarkedForDelete() const
Test if the table is marked for delete.
static String fileName(const String &tableName)
Make the table file name.
void copy(const String &newName, TableOption, Bool noRows=False) const
Copy the table and all its subtables.
const TableDesc & tableDesc() const
Get the table description.
Bool hasLock(FileLocker::LockType=FileLocker::Write) const
Has this process the read or write lock, thus can the table be read or written safely?
virtual Bool canRemoveColumn(const Vector< String > &columnNames) const =0
Test if columns can be removed.
Table operator!() const
Take complement.
static Bool isNativeDataType(DataType dtype)
Test if the given data type is native to the table system.
Bool isNull() const
Test if the object is null, i.e.
void showStructure(std::ostream &, Bool showDataMan, Bool showColumns, Bool showSubTables, Bool sortColumns)
Show the table structure (implementation of Table::showStructure).
Bool isSameRoot(const Table &other) const
Is the root table of this table the same as that of the other one?
TableExprNode nodeRandom() const
Create a TableExprNode object for the rand function.
Table operator&(const Table &) const
Do logical operations on a table.
Base class for the Data Manager Accessor classes.
Abstract base class for a data manager.
const TableRecord & keywordSet() const
Get readonly access to the table keyword set.
Bool canRemoveColumn(const String &columnName) const
Test if columns can be removed.
const StorageOption & storageOption() const
Get the storage option used for the table.
virtual Bool canRemoveRow() const
Test if it is possible to remove a row from this table.
static ScratchCallback * setScratchCallback(ScratchCallback *)
Set the pointer to the ScratchCallback function.
virtual void flushTableInfo()
Write the TableInfo object.
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.
Block< String > getPartNames(Bool recursive=False) const
Get the names of the tables this table consists of.
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.
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.
const TableInfo & tableInfo() const
Get access to the TableInfo object.
LockType
Define the possible lock types.
TableType
Define the possible table types.
const TableDesc & tableDesc() const
Get the table description.
Class to view a concatenation of tables as a single table.
void reopenRW()
Try to reopen the table for read/write access.
void closeSubTables() const
Close all open subtables.
Table copyToMemoryTable(const String &name, Bool noRows=False) const
Make a copy of a table to a MemoryTable object.
store data in the endian format of the machine used
Bool isColumnStored(const String &columnName) const
Test if the given column is stored (otherwise it is virtual).
LatticeExprNode all(const LatticeExprNode &expr)
Table operator|(const Table &) const
Union with another table.
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...
static Table openTable(const String &tableName, TableOption=Table::Old, const TSMOption &=TSMOption())
Try to open a table.
Bool canRenameColumn(const String &columnName) const
Test if a column can be renamed.
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
void deepCopy(const String &newName, TableOption, Bool valueCopy=False, EndianFormat=AipsrcEndian, Bool noRows=False) const
TableInfo & tableInfo()
Get access to the TableInfo object.
void flush(Bool fsync=False, Bool recursive=False)
Flush the table, i.e.
void flushTableInfo() const
Write the TableInfo object.
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.
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 TableRecord & keywordSet()=0
Get readonly access to the table keyword set.
virtual void deepCopy(const String &newName, const Record &dataManagerInfo, int tableOption, Bool valueCopy, int endianFormat, Bool noRows) const
static Bool isReadable(const String &tableName, bool throwIf=False)
Test if a table with the given name exists and is readable.