Go to the documentation of this file.
28 #ifndef TABLES_BASETABLE_H
29 #define TABLES_BASETABLE_H
33 #include <casacore/casa/aips.h>
34 #include <casacore/tables/Tables/TableInfo.h>
35 #include <casacore/tables/Tables/TableDesc.h>
36 #include <casacore/tables/Tables/StorageOption.h>
37 #include <casacore/casa/Utilities/Compare.h>
38 #include <casacore/casa/Utilities/CountedPtr.h>
39 #include <casacore/casa/BasicSL/String.h>
40 #include <casacore/casa/IO/FileLocker.h>
57 class BaseTableIterator;
60 template<
class T>
class Vector;
61 template<
class T>
class Block;
62 template<
class T>
class PtrBlock;
351 Bool byColumn)
const = 0;
429 Bool throwException)
const;
436 const String& oldName) = 0;
440 const String& oldName) = 0;
467 Bool determineOrder)
const;
BaseTable * tabNot()
take complement
virtual BaseTable * doSort(PtrBlock< BaseColumn * > &, const Block< CountedPtr< BaseCompare > > &, const Block< Int > &sortOrder, int sortOption)
Do the actual sort.
virtual void addColumn(const TableDesc &tableDesc, const DataManager &dataManager, Bool addToParent)
BaseTableIterator * makeIterator(const Block< String > &columnNames, const Block< CountedPtr< BaseCompare > > &, const Block< Int > &orders, int option)
Create an iterator.
Base class for table iterator.
void throwIfTableExists()
Check if the table already exists.
Define the structure of a Casacore table.
static TableInfo tableInfo(const String &tableName)
Get the table info of the table with the given name.
Bool openedForWrite() const
Test if the table is opened for write.
Bool isMarkedForDelete() const
Test if the table is marked for delete.
virtual void addColumn(const ColumnDesc &columnDesc, const String &dataManager, Bool byName, Bool addToParent)
virtual TableDesc actualTableDesc() const =0
Get the actual table description.
String makeAbsoluteName(const String &name) const
Make the name absolute.
virtual DataManager * findDataManager(const String &name, Bool byColumn) const =0
Find the data manager with the given name or for the given column.
BaseTable * select(uInt maxRow, uInt offset)
Select maxRow rows and skip first offset rows.
virtual void getPartNames(Block< String > &names, Bool recursive) const
Get the names of the tables this table consists of.
virtual BaseTable * root()
Get pointer to root table (i.e.
void addColumns(const TableDesc &tableDesc, const Record &dmInfo, Bool addToParent)
Add one or more columns to the table.
virtual Bool rowOrder() const
Tell if the table is in row order.
void showStructure(std::ostream &, Bool showDataMan, Bool showColumns, Bool showSubTables, Bool sortColumns, Bool cOrder)
Show the table structure (implementation of Table::showStructure).
virtual TableRecord & rwKeywordSet()=0
Get read/write access to the table keyword set.
Bool isColumnStored(const String &columnName) const
Test if the given column is stored (otherwise it is virtual).
AipsIO is the object persistency mechanism of Casacore
Abstract base class for a data manager.
BaseTable * sort(const Block< String > &columnNames, const Block< CountedPtr< BaseCompare > > &compareObjects, const Block< Int > &sortOrder, int sortOption)
Sort a table on one or more columns of scalars.
Bool isColumnWritable(const String &columnName) const
Test if the given column is writable.
virtual void addColumn(const ColumnDesc &columnDesc, Bool addToParent)
Add one or more columns to the table.
A drop-in replacement for Block<T*>.
virtual Bool canRemoveRow() const
Test if it is possible to remove a row from this table.
virtual Record dataManagerInfo() const =0
Get the data manager info.
virtual void reopenRW()=0
Reopen the table for read/write.
A hierarchical collection of named fields of various types.
virtual Bool canAddRow() const
Test if it is possible to add a row to this table.
virtual void unlock()=0
Unlock the table.
Referenced counted pointer for constant data.
virtual TableRecord & keywordSet()=0
Get readonly access to the table keyword set.
void scratchCallback(Bool isScratch, const String &oldName) const
Do the callback for scratch tables (if callback is set).
virtual void renameHypercolumn(const String &newName, const String &oldName)=0
Rename a hypercolumn.
virtual void addRow(uInt nrrow=1, Bool initialize=True)
Add one or more rows and possibly initialize them.
BaseTable * tabXor(BaseTable *)
xor with another table
BaseTable * select(const TableExprNode &, uInt maxRow, uInt offset)
Select rows using the given expression (which can be null).
virtual void rename(const String &newName, int tableOption)
Rename the table.
LockType
Define the possible lock types.
virtual uInt getModifyCounter() const =0
Get the modify counter.
virtual void renameSubTables(const String &newName, const String &oldName)
Rename the subtables (used by rename function).
void writeEnd(AipsIO &)
End writing a table.
virtual Bool canRemoveColumn(const Vector< String > &columnNames) const =0
Test if columns can be removed.
BaseTable * tabSub(BaseTable *)
subtract another table
virtual void deepCopy(const String &newName, const Record &dataManagerInfo, const StorageOption &, int tableOption, Bool valueCopy, int endianFormat, Bool noRows) const
Abstract base class for tables.
uInt logicRows(uInt *&rownrs, Bool &allocated)
Get the rownrs of the table in ascending order to be used in the logical operation on the table.
virtual void resync()=0
Resync the Table object with the table file.
Bool checkRemoveColumn(const Vector< String > &columnNames, Bool throwException) const
Check if the set of columns can be removed.
virtual void copy(const String &newName, int tableOption) const
Copy the table and all its subtables.
uInt nrow() const
Get number of rows.
virtual void mergeLock(const TableLock &lockOptions)=0
Merge the given lock info with the existing one.
virtual void removeColumn(const Vector< String > &columnNames)=0
Remove columns.
virtual void removeRow(uInt rownr)
Remove rows.
void BaseTableCommon(const String &tableName, int tableOption, uInt nrrow)
Common code shared by the MPI constructor and non-MPI constructor.
const TableDesc & makeTableDesc() const
Make an empty table description.
virtual Bool isMultiUsed(Bool checkSubTables) const =0
Is the table in use (i.e.
const TableDesc & tableDesc() const
Get the table description.
virtual Vector< uInt > rowNumbers() const
Get a vector of row numbers.
virtual BaseColumn * getColumn(uInt columnIndex) const =0
Get a column object using its index.
Abstract base class for a table column.
void removeRow(const Vector< uInt > &rownrs)
virtual void flush(Bool fsync, Bool recursive)=0
Flush the table, i.e.
BaseTable * select(const Vector< uInt > &rownrs)
Select rows using a vector of row numbers.
static void unlink(BaseTable *)
Unlink from a BaseTable.
virtual Bool lock(FileLocker::LockType, uInt nattempts)=0
Try to lock the table for read or write access.
TableInfo & tableInfo()
Get access to the TableInfo object.
virtual Bool isNull() const
Is the table a null table? By default it is not.
void checkRowNumber(uInt rownr) const
Check if the row number is valid.
Bool makeTableDir()
Create the table directory when needed (and possible).
virtual Bool isWritable() const =0
Test if this table is writable.
virtual Bool asBigEndian() const =0
Is the table stored in big or little endian format?
Table type, subtype and further info.
BaseTable(MPI_Comm mpiComm, const String &tableName, int tableOption, uInt nrrow)
MPI version of the constructor.
virtual Bool adjustRownrs(uInt nrrow, Vector< uInt > &rownrs, Bool determineOrder) const
Adjust the row numbers to be the actual row numbers in the root table.
BaseTable * project(const Block< String > &columnNames)
Project the given columns (i.e.
BaseTable(const BaseTable &)
Copy constructor is forbidden, because copying a table requires some more knowledge (like table name ...
Class to hold table lock options.
Bool isColumnWritable(uInt columnIndex) const
this file contains all the compiler specific defines
void writeStart(AipsIO &, Bool bigEndian)
Start writing a table.
virtual void renameColumn(const String &newName, const String &oldName)=0
Rename a column.
void trueDeepCopy(const String &newName, const Record &dataManagerInfo, const StorageOption &, int tableOption, int endianFormat, Bool noRows) const
Make a true deep copy of the table.
virtual BaseColumn * getColumn(const String &columnName) const =0
Get a column object using its name.
void checkRowNumberThrow(uInt rownr) const
Throw an exception for checkRowNumber.
virtual const StorageOption & storageOption() const =0
Get the storage option used for the table.
void unmarkForDelete(Bool callback, const String &oldName)
Unmark the table for delete.
BaseTable & operator=(const BaseTable &)
Assignment is forbidden, because copying a table requires some more knowledge (like table name of res...
BaseTable * tabOr(BaseTable *)
union with another table
virtual void showStructureExtra(std::ostream &) const
Show a possible extra table structure header.
Handle class for a table column expression tree.
virtual const TableLock & lockOptions() const =0
Get the locking info.
BaseTable * select(const Block< Bool > &mask)
Select rows using a mask block.
virtual int tableType() const
Get the table type.
void showColumnInfo(ostream &os, const TableDesc &, uInt maxNameLength, const Array< String > &columnNames, Bool sort, Bool cOrder) const
Show the info of the given columns.
RefTable * makeRefTable(Bool rowOrder, uInt initialNrrow)
Create a RefTable object.
void getTableInfo()
Read the TableInfo object.
LatticeExprNode mask(const LatticeExprNode &expr)
This function returns the mask of the given expression.
void doNotWrite()
Do not write the table (used in in case of exceptions).
int tableOption() const
Get the table option.
MPI_Comm itsMpiComm
MPI communicator for parallel I/O Set the default to MPI_COMM_WORLD to keep the compatibility for non...
template <class T, class U> class vector;
BaseTable * tabAnd(BaseTable *)
Do logical operations on a table.
Bool isColumnStored(uInt columnIndex) const
const String & tableName() const
Get the table name.
String: the storage and methods of handling collections of characters.
virtual void flushTableInfo()
Write the TableInfo object.
bool Bool
Define the standard types used by Casacore.
virtual Vector< uInt > * rowStorage()
By the default the table cannot return the storage of rownrs.
Bool shouldNotWrite() const
Should the table be written.
A hierarchical collection of named fields of various types.
virtual void addColumn(const ColumnDesc &columnDesc, const DataManager &dataManager, Bool addToParent)
Options defining how table files are organized.
void markForDelete(Bool callback, const String &oldName)
Mark the table for delete.
void link()
Link to this BaseTable object (i.e.
void prepareCopyRename(const String &newName, int tableOption) const
Prepare for copying or renaming a table.
Class for a table as a view of another table.
virtual Bool canRenameColumn(const String &columnName) const =0
Test if a column can be renamed.
Envelope class for the description of a table column.
virtual void setTableChanged()
Set the table to being changed.
int traceId() const
Get the table's trace-id.
BaseTable(const String &tableName, int tableOption, uInt nrrow)
Initialize the object.
virtual Bool hasLock(FileLocker::LockType) const =0
Has this process the read or write lock, thus can the table be read or written safely?
void logicCheck(BaseTable *that)
Check if the tables combined in a logical operation have the same root.