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> 53 class BaseTableIterator;
56 template<
class T>
class Vector;
57 template<
class T>
class Block;
58 template<
class T>
class PtrBlock;
148 virtual void unlock() = 0;
154 virtual void resync() = 0;
211 virtual void rename (
const String& newName,
int tableOption);
226 virtual void copy (
const String& newName,
int tableOption)
const;
337 Bool byColumn)
const = 0;
415 Bool throwException)
const;
422 const String& oldName) = 0;
426 const String& oldName) = 0;
453 Bool determineOrder)
const;
500 const Record& dataManagerInfo,
BaseTable * select(const TableExprNode &, uInt maxRow, uInt offset)
Select rows using the given expression (which can be null).
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.
const String & tableName() const
Get the table name.
Bool openedForWrite() const
Test if the table is opened for write.
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.
virtual Bool rowOrder() const
Tell if the table is in row order.
virtual void copy(const String &newName, int tableOption) const
Copy the table and all its subtables.
LatticeExprNode mask(const LatticeExprNode &expr)
This function returns the mask of the given expression.
virtual void mergeLock(const TableLock &lockOptions)=0
Merge the given lock info with the existing one.
AipsIO is the object persistency mechanism of Casacore.
virtual Bool canRenameColumn(const String &columnName) const =0
Test if a column can be renamed.
void prepareCopyRename(const String &newName, int tableOption) const
Prepare for copying or renaming a table.
void showColumnInfo(ostream &os, const TableDesc &, uInt maxNameLength, const Array< String > &columnNames, Bool sort) const
Show the info of the given columns.
int traceId() const
Get the table's trace-id.
virtual void reopenRW()=0
Reopen the table for read/write.
Handle class for a table column expression tree.
BaseTable * tabXor(BaseTable *)
xor with another table
Envelope class for the description of a table column.
void checkRowNumber(uInt rownr) const
Check if the row number is valid.
virtual const TableLock & lockOptions() const =0
Get the locking info.
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.
Base class for table iterator.
BaseTable * tabOr(BaseTable *)
union with another table
virtual uInt getModifyCounter() const =0
Get the modify counter.
virtual TableDesc actualTableDesc() const =0
Get the actual table description.
BaseTable * tabSub(BaseTable *)
subtract another table
Bool shouldNotWrite() const
Should the table be written.
virtual void rename(const String &newName, int tableOption)
Rename the table.
void getTableInfo()
Read the TableInfo object.
virtual Bool lock(FileLocker::LockType, uInt nattempts)=0
Try to lock the table for read or write access.
virtual void renameSubTables(const String &newName, const String &oldName)
Rename the subtables (used by rename function).
void writeEnd(AipsIO &)
End writing a table.
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...
Bool checkRemoveColumn(const Vector< String > &columnNames, Bool throwException) const
Check if the set of columns can be removed.
virtual void deepCopy(const String &newName, const Record &dataManagerInfo, int tableOption, Bool valueCopy, int endianFormat, Bool noRows) const
int tableOption() const
Get the table option.
Bool makeTableDir()
Create the table directory when needed (and possible).
void markForDelete(Bool callback, const String &oldName)
Mark the table for delete.
String makeAbsoluteName(const String &name) const
Make the name absolute.
Options defining how table files are organized.
RefTable * makeRefTable(Bool rowOrder, uInt initialNrrow)
Create a RefTable object.
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.
virtual Vector< uInt > * rowStorage()
By the default the table cannot return the storage of rownrs.
BaseTableIterator * makeIterator(const Block< String > &columnNames, const Block< CountedPtr< BaseCompare > > &, const Block< Int > &orders, int option)
Create an iterator.
BaseTable & operator=(const BaseTable &)
Assignment is forbidden, because copying a table requires some more knowledge (like table name of res...
void checkRowNumberThrow(uInt rownr) const
Throw an exception for checkRowNumber.
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 BaseTable * doSort(PtrBlock< BaseColumn *> &, const Block< CountedPtr< BaseCompare > > &, const Block< Int > &sortOrder, int sortOption)
Do the actual sort.
virtual TableRecord & rwKeywordSet()=0
Get read/write access to the table keyword set.
virtual int tableType() const
Get the table type.
static void unlink(BaseTable *)
Unlink from a BaseTable.
virtual void removeColumn(const Vector< String > &columnNames)=0
Remove columns.
uInt nrow() const
Get number of rows.
BaseTable * tabAnd(BaseTable *)
Do logical operations on a table.
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.
BaseTable * project(const Block< String > &columnNames)
Project the given columns (i.e.
Bool isColumnStored(const String &columnName) const
Test if the given column is stored (otherwise it is virtual).
Bool isColumnWritable(const String &columnName) const
Test if the given column is writable.
void logicCheck(BaseTable *that)
Check if the tables combined in a logical operation have the same root.
Table type, subtype and further info.
virtual BaseColumn * getColumn(uInt columnIndex) const =0
Get a column object using its index.
Class to hold table lock options.
A drop-in replacement for Block<T*>.
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;
virtual Bool canRemoveColumn(const Vector< String > &columnNames) const =0
Test if columns can be removed.
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.
void showStructure(std::ostream &, Bool showDataMan, Bool showColumns, Bool showSubTables, Bool sortColumns)
Show the table structure (implementation of Table::showStructure).
virtual Bool isNull() const
Is the table a null table? By default it is not.
Abstract base class for a data manager.
virtual Bool canRemoveRow() const
Test if it is possible to remove a row from this table.
void trueDeepCopy(const String &newName, const Record &dataManagerInfo, int tableOption, int endianFormat, Bool noRows) const
Make a true deep copy of the table.
virtual Record dataManagerInfo() const =0
Get the data manager info.
BaseTable * tabNot()
take complement
virtual void flushTableInfo()
Write the TableInfo object.
void writeStart(AipsIO &, Bool bigEndian)
Start writing a table.
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.
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.
virtual void renameColumn(const String &newName, const String &oldName)=0
Rename a column.
virtual Vector< uInt > rowNumbers() const
Get a vector of row numbers.
Define the structure of a Casacore table.
virtual void addColumn(const ColumnDesc &columnDesc, Bool addToParent)
Add one or more columns to the table.
LockType
Define the possible lock types.
virtual void showStructureExtra(std::ostream &) const
Show a possible extra table structure header.
void link()
Link to this BaseTable object (i.e.
const TableDesc & makeTableDesc() const
Make an empty table description.
virtual Bool canAddRow() const
Test if it is possible to add a row to this table.
virtual Bool asBigEndian() const =0
Is the table stored in big or little endian format?
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.
virtual void setTableChanged()
Set the table to being changed.
void doNotWrite()
Do not write the table (used in in case of exceptions).
BaseTable(const String &tableName, int tableOption, uInt nrrow)
Initialize the object.
void throwIfTableExists()
Check if the table already exists.
Abstract base class for a table column.
virtual TableRecord & keywordSet()=0
Get readonly access to the table keyword set.