28 #ifndef TABLES_BASETABLE_H
29 #define TABLES_BASETABLE_H
58 class BaseTableIterator;
61 template<
class T>
class Block;
62 template<
class T>
class PtrBlock;
160 virtual void unlock() = 0;
166 virtual void resync() = 0;
223 virtual void rename (
const String& newName,
int tableOption);
238 virtual void copy (
const String& newName,
int tableOption)
const;
352 Bool byColumn)
const = 0;
402 bool cacheIterationBoundaries =
false);
433 Bool throwException)
const;
440 const String& oldName) = 0;
444 const String& oldName) = 0;
471 Bool determineOrder)
const;
virtual Bool adjustRownrs(rownr_t nrrow, Vector< rownr_t > &rownrs, Bool determineOrder) const
Adjust the row numbers to be the actual row numbers in the root table.
virtual void renameHypercolumn(const String &newName, const String &oldName)=0
Rename a hypercolumn.
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.
BaseTable * sort(const Block< String > &columnNames, const Block< CountedPtr< BaseCompare > > &compareObjects, const Block< Int > &sortOrder, int sortOption, std::shared_ptr< Vector< rownr_t >> sortIterBoundaries=nullptr, std::shared_ptr< Vector< size_t >> sortIterKeyIdxChange=nullptr)
Sort a table on one or more columns of scalars.
int tableOption() const
Get the table option.
Bool isColumnWritable(const String &columnName) const
Test if the given column is writable.
virtual Bool isNull() const
Is the table a null table? By default it is not.
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.
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.
CountedPtr< TableDesc > tdescPtr_p
BaseTable(const String &tableName, int tableOption, rownr_t nrrow)
Initialize the object.
void BaseTableCommon(const String &tableName, int tableOption, rownr_t nrrow)
Common code shared by the MPI constructor and non-MPI constructor.
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.
Handle class for a table column expression tree.
BaseTable * tabXor(BaseTable *)
xor with another table
Envelope class for the description of a table column.
virtual const TableLock & lockOptions() const =0
Get the locking info.
void checkRowNumber(rownr_t rownr) const
Check if the row number is valid.
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
void scratchCallback(Bool isScratch, const String &oldName) const
Do the callback for scratch tables (if callback is set).
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.
virtual void getPartNames(Block< String > &names, Bool recursive) const
Get the names of the tables this table consists of.
virtual Vector< rownr_t > * rowStorage()
By the default the table cannot return the storage of rownrs.
Bool makeTableDir()
Create the table directory when needed (and possible).
void markForDelete(Bool callback, const String &oldName)
Mark the table for delete.
Options defining how table files are organized.
virtual BaseTable * root()
Get pointer to root table (i.e.
BaseTable & operator=(const BaseTable &)
Assignment is forbidden, because copying a table requires some more knowledge (like table name of res...
Referenced counted pointer for constant data.
Abstract base class for tables.
Class for a table as a view of another table.
virtual TableRecord & rwKeywordSet()=0
Get read/write access to the table keyword set.
BaseTableIterator * makeIterator(const Block< String > &columnNames, const Block< CountedPtr< BaseCompare > > &, const Block< Int > &orders, int option, bool cacheIterationBoundaries=false)
Create an iterator.
rownr_t logicRows(rownr_t *&rownrs, Bool &allocated)
Get the rownrs of the table in ascending order to be used in the logical operation on the table...
static void unlink(BaseTable *)
Unlink from a BaseTable.
Bool openedForWrite() const
Test if the table is opened for write.
void checkRowNumberThrow(rownr_t rownr) const
Throw an exception for checkRowNumber.
const String & tableName() const
Get the table name.
String makeAbsoluteName(const String &name) const
Make the name absolute.
RefTable * makeRefTable(Bool rowOrder, rownr_t initialNrrow)
Create a RefTable object.
MPI_Comm itsMpiComm
MPI communicator for parallel I/O Set the default to MPI_COMM_WORLD to keep the compatibility for non...
virtual void removeColumn(const Vector< String > &columnNames)=0
Remove columns.
rownr_t nrow() const
Get number of rows.
BaseTable * tabAnd(BaseTable *)
Do logical operations on a table.
virtual void copy(const String &newName, int tableOption) const
Copy the table and all its subtables.
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.
BaseTable * project(const Block< String > &columnNames)
Project the given columns (i.e.
void logicCheck(BaseTable *that)
Check if the tables combined in a logical operation have the same root.
int traceId() const
Get the table's trace-id.
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.
virtual void removeRow(rownr_t rownr)
Remove rows.
A drop-in replacement for Block<T*>.
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.
A templated N-D Array class with zero origin. Array<T, Alloc> is a templated, N-dimensional, Array class. The origin is zero, but by default indices are zero-based. This Array class is the base class for the Vector, Matrix, and Cube subclasses.
void prepareCopyRename(const String &newName, int tableOption) const
Prepare for copying or renaming a table.
virtual BaseTable * doSort(PtrBlock< BaseColumn * > &, const Block< CountedPtr< BaseCompare > > &, const Block< Int > &sortOrder, int sortOption, std::shared_ptr< Vector< rownr_t >> sortIterBoundaries, std::shared_ptr< Vector< size_t >> sortIterKeyIdxChange)
Do the actual sort.
const TableDesc & makeEmptyTableDesc() const
Make an empty table description.
Bool isMarkedForDelete() const
Test if the table is marked for delete.
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 void addRow(rownr_t nrrow=1, Bool initialize=True)
Add one or more rows and possibly initialize them.
uInt64 rownr_t
Define the type of a row number in a table.
virtual Bool canRemoveColumn(const Vector< String > &columnNames) const =0
Test if columns can be removed.
BaseTable * select(const TableExprNode &, rownr_t maxRow, rownr_t offset)
Select rows using the given expression (which can be null).
Bool checkRemoveColumn(const Vector< String > &columnNames, Bool throwException) const
Check if the set of columns can be removed.
Abstract base class for a data manager.
virtual void showStructureExtra(std::ostream &) const
Show a possible extra table structure header.
virtual Record dataManagerInfo() const =0
Get the data manager info.
BaseTable * tabNot()
take complement
virtual Bool canRemoveRow() const
Test if it is possible to remove a row from this table.
virtual void flushTableInfo()
Write the TableInfo object.
void writeStart(AipsIO &, Bool bigEndian)
Start writing a 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.
Define the structure of a Casacore table.
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).
LockType
Define the possible lock types.
const TableDesc & tableDesc() const
Get the table description.
void link()
Link to this BaseTable object (i.e.
Bool shouldNotWrite() const
Should the table be written.
virtual Bool rowOrder() const
Tell if the table is in row order.
virtual Bool asBigEndian() const =0
Is the table stored in big or little endian format?
virtual Vector< rownr_t > rowNumbers() const
Get a vector of row numbers.
virtual Bool hasLock(FileLocker::LockType) const =0
Has this process the read or write lock, thus can the table be read or written safely?
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).
virtual void deepCopy(const String &newName, const Record &dataManagerInfo, const StorageOption &, int tableOption, Bool valueCopy, int endianFormat, Bool noRows) const
void showColumnInfo(ostream &os, const TableDesc &, uInt maxNameLength, const Array< String > &columnNames, Bool sort, Bool cOrder) const
Show the info of the given columns.
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.