Loading...
Searching...
No Matches
casacore::BaseTable Class Referenceabstract
tables package (libcasa_tables) » Tables_module » Tables_module_internal_classes

More...

`#include <BaseTable.h>`

## Public Member Functions

| BaseTable (const String &tableName, int tableOption, rownr_t nrrow)
| Initialize the object.
| BaseTable (MPI_Comm mpiComm, const String &tableName, int tableOption, rownr_t nrrow)
| MPI version of the constructor.
void | BaseTableCommon (const String &tableName, int tableOption, rownr_t nrrow)
| Common code shared by the MPI constructor and non-MPI constructor.
virtual | ~BaseTable ()
| The destructor will delete the table if needed.
| BaseTable (const BaseTable &)=delete
| Copy constructor is forbidden, because copying a table requires some more knowledge (like table name of result).
BaseTable & | operator= (const BaseTable &)=delete
| Assignment is forbidden, because copying a table requires some more knowledge (like table name of result).
virtual Bool | isNull () const
| Is the table a null table?
virtual void | reopenRW ()=0
| Reopen the table for read/write.
virtual void | changeTiledDataOnly ()
| Indicate we will only modify data values in existing tiled columns.
virtual Bool | asBigEndian () const =0
| Is the table stored in big or little endian format?
virtual const StorageOption & | storageOption () const =0
| Get the storage option used for the table.
virtual Bool | isMultiUsed (Bool checkSubTables) const =0
| Is the table in use (i.e.
virtual const TableLock & | lockOptions () const =0
| Get the locking info.
virtual void | mergeLock (const TableLock &lockOptions)=0
| Merge the given lock info with the existing one.
virtual Bool | hasLock (FileLocker::LockType) const =0
| Has this process the read or write lock, thus can the table be read or written safely?
virtual Bool | lock (FileLocker::LockType, uInt nattempts)=0
| Try to lock the table for read or write access.
virtual void | unlock ()=0
| Unlock the table.
virtual void | flush (Bool fsync, Bool recursive)=0
| Flush the table, i.e.
virtual void | resync ()=0
| Resync the Table object with the table file.
virtual uInt | getModifyCounter () const =0
| Get the modify counter.
virtual void | setTableChanged ()
| Set the table to being changed.
void | doNotWrite ()
| Do not write the table (used in in case of exceptions).
virtual Bool | isWritable () const =0
| Test if this table is writable.
Bool | isColumnWritable (const String &columnName) const
| Test if the given column is writable.
Bool | isColumnWritable (uInt columnIndex) const
Bool | isColumnStored (const String &columnName) const
| Test if the given column is stored (otherwise it is virtual).
Bool | isColumnStored (uInt columnIndex) const
const String & | tableName () const
| Get the table name.
virtual void | getPartNames (Block< String > &names, Bool recursive) const
| Get the names of the tables this table consists of.
virtual void | rename (const String &newName, int tableOption)
| Rename the table.
virtual void | copy (const String &newName, int tableOption) const
| Copy the table and all its subtables.
virtual void | deepCopy (const String &newName, const Record &dataManagerInfo, const StorageOption &, int tableOption, Bool valueCopy, int endianFormat, Bool noRows) const
virtual int | tableType () const
| Get the table type.
int | tableOption () const
| Get the table option.
void | markForDelete (Bool callback, const String &oldName)
| Mark the table for delete.
void | unmarkForDelete (Bool callback, const String &oldName)
| Unmark the table for delete.
Bool | isMarkedForDelete () const
| Test if the table is marked for delete.
const TableDesc & | tableDesc () const
| Get the table description.
virtual TableDesc | actualTableDesc () const =0
| Get the actual table description.
virtual Record | dataManagerInfo () const =0
| Get the data manager info.
void | showStructure (std::ostream &, Bool showDataMan, Bool showColumns, Bool showSubTables, Bool sortColumns, Bool cOrder)
| Show the table structure (implementation of Table::showStructure).
virtual TableRecord & | keywordSet ()=0
| Get readonly access to the table keyword set.
virtual TableRecord & | rwKeywordSet ()=0
| Get read/write access to the table keyword set.
TableInfo & | tableInfo ()
| Get access to the TableInfo object.
virtual void | flushTableInfo ()
| Write the TableInfo object.
rownr_t | nrow () const
| Get number of rows.
virtual BaseColumn * | getColumn (uInt columnIndex) const =0
| Get a column object using its index.
virtual BaseColumn * | getColumn (const String &columnName) const =0
| Get a column object using its name.
virtual Bool | canAddRow () const
| Test if it is possible to add a row to this table.
virtual void | addRow (rownr_t nrrow=1, Bool initialize=True)
| Add one or more rows and possibly initialize them.
virtual Bool | canRemoveRow () const
| Test if it is possible to remove a row from this table.
virtual void | removeRow (rownr_t rownr)
| Remove rows.
void | removeRow (const Vector< rownr_t > &rownrs)
void | removeRow (const Vector< uInt > &rownrs)
virtual DataManager * | findDataManager (const String &name, Bool byColumn) const =0
| Find the data manager with the given name or for the given column.
std::shared_ptr< BaseTable > | select (const TableExprNode &, rownr_t maxRow, rownr_t offset)
| Select rows using the given expression (which can be null).
std::shared_ptr< BaseTable > | select (rownr_t maxRow, rownr_t offset)
| Select maxRow rows and skip first offset rows.
std::shared_ptr< BaseTable > | select (const Vector< rownr_t > &rownrs)
| Select rows using a vector of row numbers.
std::shared_ptr< BaseTable > | select (const Block< Bool > &mask)
| Select rows using a mask block.
std::shared_ptr< BaseTable > | project (const Block< String > &columnNames)
| Project the given columns (i.e.
std::shared_ptr< BaseTable > | tabAnd (BaseTable *)
| Do logical operations on a table.
std::shared_ptr< BaseTable > | tabOr (BaseTable *)
| union with another table
std::shared_ptr< BaseTable > | tabSub (BaseTable *)
| subtract another table
std::shared_ptr< BaseTable > | tabXor (BaseTable *)
| xor with another table
std::shared_ptr< BaseTable > | tabNot ()
| take complement
std::shared_ptr< BaseTable > | sort (const Block< String > &columnNames, const Block< std::shared_ptr< 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.
BaseTableIterator * | makeIterator (const Block< String > &columnNames, const Block< std::shared_ptr< BaseCompare > > &, const Block< Int > &orders, int option, bool cacheIterationBoundaries=false)
| Create an iterator.
virtual void | addColumn (const ColumnDesc &columnDesc, Bool addToParent)
| Add one or more columns to the table.
virtual void | addColumn (const ColumnDesc &columnDesc, const String &dataManager, Bool byName, Bool addToParent)
virtual void | addColumn (const ColumnDesc &columnDesc, const DataManager &dataManager, Bool addToParent)
virtual void | addColumn (const TableDesc &tableDesc, const DataManager &dataManager, Bool addToParent)
void | addColumns (const TableDesc &tableDesc, const Record &dmInfo, Bool addToParent)
| Add one or more columns to the table.
virtual Bool | canRemoveColumn (const Vector< String > &columnNames) const =0
| Test if columns can be removed.
virtual void | removeColumn (const Vector< String > &columnNames)=0
| Remove columns.
Bool | checkRemoveColumn (const Vector< String > &columnNames, Bool throwException) const
| Check if the set of columns can be removed.
virtual Bool | canRenameColumn (const String &columnName) const =0
| Test if a column can be renamed.
virtual void | renameColumn (const String &newName, const String &oldName)=0
| Rename a column.
virtual void | renameHypercolumn (const String &newName, const String &oldName)=0
| Rename a hypercolumn.
virtual Vector< rownr_t > | rowNumbers () const
| Get a vector of row numbers.
virtual BaseTable * | root ()
| Get pointer to root table (i.e.
virtual Bool | rowOrder () const
| Tell if the table is in row order.
virtual Vector< rownr_t > & | rowStorage ()
| By the default the table cannot return the storage of rownrs.
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 std::shared_ptr< BaseTable > | doSort (Block< BaseColumn * > &, const Block< std::shared_ptr< 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.
std::shared_ptr< RefTable > | makeRefTable (Bool rowOrder, rownr_t initialNrrow)
| Create a RefTable object.
void | checkRowNumber (rownr_t rownr) const
| Check if the row number is valid.
int | traceId () const
| Get the table's trace-id.

## Static Public Member Functions

static TableInfo | tableInfo (const String &tableName)
| Get the table info of the table with the given name.

## Protected Member Functions

void | scratchCallback (Bool isScratch, const String &oldName) const
| Do the callback for scratch tables (if callback is set).
Bool | makeTableDir ()
| Create the table directory when needed (and possible).
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.
void | prepareCopyRename (const String &newName, int tableOption) const
| Prepare for copying or renaming a table.
virtual void | renameSubTables (const String &newName, const String &oldName)
| Rename the subtables (used by rename function).
void | throwIfTableExists ()
| Check if the table already exists.
Bool | openedForWrite () const
| Test if the table is opened for write.
void | writeStart (AipsIO &, Bool bigEndian)
| Start writing a table.
void | writeEnd (AipsIO &)
| End writing a table.
Bool | shouldNotWrite () const
| Should the table be written.
void | getTableInfo ()
| Read the TableInfo object.

## Protected Attributes

std::weak_ptr< BaseTable > | thisPtr_p
rownr_t | nrrow_p
rownr_t | nrrowToAdd_p
std::shared_ptr< TableDesc > | tdescPtr_p
String | name_p
int | option_p
Bool | noWrite_p
Bool | delete_p
TableInfo | info_p
Bool | madeDir_p
int | itsTraceId

## Private Member Functions

virtual void | showStructureExtra (std::ostream &) const
| Show a possible extra table structure header.
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 | checkRowNumberThrow (rownr_t rownr) const
| Throw an exception for checkRowNumber.
void | logicCheck (BaseTable *that)
| Check if the tables combined in a logical operation have the same root.
Vector< rownr_t > | logicRows ()
| Get the rownrs of the table in ascending order to be used in the logical operation on the table.
const TableDesc & | makeEmptyTableDesc () const
| Make an empty table description.
String | makeAbsoluteName (const String &name) const
| Make the name absolute.

## Private Attributes

MPI_Comm | itsMpiComm
| MPI communicator for parallel I/O.

## Detailed Description

Abstract base class for tables

### Intended use:

Internal

### Review Status

Reviewed By:
  UNKNOWN
Date Reviewed:
  before2004/08/25

### Prerequisite

- Table
- Sort
- TableExprNode

### Etymology

BaseTable is the (abstract) base class for different kind of tables.

### Synopsis

BaseTables defines many virtual functions, which are actually implemented in the underlying table classes like PlainTable and RefTable. Other functions like sort and select are implemented in BaseTable itself.

The functions in BaseTable and its derived classes can only be used by the table system classes. All user access is via the envelope class Table, which references (counted) BaseTable.

### To Do

- Implement function renameColumn, removeColumn.

Definition at line 100 of file BaseTable.h.

## Constructor & Destructor Documentation

## BaseTable() [1/3]

casacore::BaseTable::BaseTable | ( | const String & | tableName,
|  | int | tableOption,
|  | rownr_t | nrrow )

Initialize the object.

References tableName(), and tableOption().

Referenced by BaseTable(), logicCheck(), operator=(), casacore::RefTable::RefTable(), casacore::RefTable::RefTable(), casacore::RefTable::RefTable(), casacore::RefTable::RefTable(), root(), casacore::NullTable::root(), casacore::RefTable::root(), casacore::ConcatTable::setup(), casacore::MemoryTable::setup(), casacore::RefTable::setup(), tabAnd(), tabOr(), tabSub(), and tabXor().

## BaseTable() [2/3]

casacore::BaseTable::BaseTable | ( | MPI_Comm | mpiComm,
|  | const String & | tableName,
|  | int | tableOption,
|  | rownr_t | nrrow )

MPI version of the constructor.

References tableName(), and tableOption().

## ~BaseTable()

virtual casacore::BaseTable::~BaseTable | ( |  | ) |

virtual

The destructor will delete the table if needed.

## BaseTable() [3/3]

casacore::BaseTable::BaseTable | ( | const BaseTable & |  | ) |

delete

Copy constructor is forbidden, because copying a table requires some more knowledge (like table name of result).

References BaseTable().

## Member Function Documentation

## actualTableDesc()

virtual TableDesc casacore::BaseTable::actualTableDesc | ( |  | ) | const

pure virtual

Get the actual table description.

Implemented in casacore::ConcatTable, casacore::MemoryTable, casacore::NullTable, casacore::PlainTable, and casacore::RefTable.

## addColumn() [1/4]

virtual void casacore::BaseTable::addColumn | ( | const ColumnDesc & | columnDesc,
|  | Bool | addToParent )

virtual

Add one or more columns to the table.

The default implementation throws an "invalid operation" exception.

Reimplemented in casacore::ConcatTable, casacore::MemoryTable, casacore::NullTable, casacore::PlainTable, and casacore::RefTable.

## addColumn() [2/4]

virtual void casacore::BaseTable::addColumn | ( | const ColumnDesc & | columnDesc,
|  | const DataManager & | dataManager,
|  | Bool | addToParent )

virtual

Reimplemented in casacore::ConcatTable, casacore::MemoryTable, casacore::NullTable, casacore::PlainTable, and casacore::RefTable.

## addColumn() [3/4]

virtual void casacore::BaseTable::addColumn | ( | const ColumnDesc & | columnDesc,
|  | const String & | dataManager,
|  | Bool | byName,
|  | Bool | addToParent )

virtual

Reimplemented in casacore::ConcatTable, casacore::MemoryTable, casacore::NullTable, casacore::PlainTable, and casacore::RefTable.

## addColumn() [4/4]

virtual void casacore::BaseTable::addColumn | ( | const TableDesc & | tableDesc,
|  | const DataManager & | dataManager,
|  | Bool | addToParent )

virtual

Reimplemented in casacore::ConcatTable, casacore::MemoryTable, casacore::NullTable, casacore::PlainTable, and casacore::RefTable.

References tableDesc().

## addColumns()

void casacore::BaseTable::addColumns | ( | const TableDesc & | tableDesc,
|  | const Record & | dmInfo,
|  | Bool | addToParent )

Add one or more columns to the table.

The data manager to use is described in the record.

References casacore::Record(), and tableDesc().

## addRow()

virtual void casacore::BaseTable::addRow | ( | rownr_t | nrrow = 1,
|  | Bool | initialize = True )

virtual

Add one or more rows and possibly initialize them.

This will fail for tables not supporting addition of rows.

Reimplemented in casacore::MemoryTable, casacore::NullTable, and casacore::PlainTable.

References casacore::True.

## adjustRownrs()

virtual Bool casacore::BaseTable::adjustRownrs | ( | rownr_t | nrrow,
|  | Vector< rownr_t > & | rownrs,
|  | Bool | determineOrder ) const

virtual

Adjust the row numbers to be the actual row numbers in the root table.

This is, for instance, used when a RefTable is sorted. Optionally it also determines if the resulting rows are in order.

Reimplemented in casacore::NullTable, and casacore::RefTable.

## asBigEndian()

virtual Bool casacore::BaseTable::asBigEndian | ( |  | ) | const

pure virtual

Is the table stored in big or little endian format?

Implemented in casacore::ConcatTable, casacore::MemoryTable, casacore::NullTable, casacore::PlainTable, and casacore::RefTable.

## BaseTableCommon()

void casacore::BaseTable::BaseTableCommon | ( | const String & | tableName,
|  | int | tableOption,
|  | rownr_t | nrrow )

Common code shared by the MPI constructor and non-MPI constructor.

References tableName(), and tableOption().

## canAddRow()

virtual Bool casacore::BaseTable::canAddRow | ( |  | ) | const

virtual

Test if it is possible to add a row to this table.

Reimplemented in casacore::MemoryTable, casacore::NullTable, and casacore::PlainTable.

## canRemoveColumn()

virtual Bool casacore::BaseTable::canRemoveColumn | ( | const Vector< String > & | columnNames | ) | const

pure virtual

Test if columns can be removed.

Implemented in casacore::ConcatTable, casacore::MemoryTable, casacore::NullTable, casacore::PlainTable, and casacore::RefTable.

## canRemoveRow()

virtual Bool casacore::BaseTable::canRemoveRow | ( |  | ) | const

virtual

Test if it is possible to remove a row from this table.

Reimplemented in casacore::ConcatTable, casacore::MemoryTable, casacore::NullTable, casacore::PlainTable, and casacore::RefTable.

## canRenameColumn()

virtual Bool casacore::BaseTable::canRenameColumn | ( | const String & | columnName | ) | const

pure virtual

Test if a column can be renamed.

Implemented in casacore::ConcatTable, casacore::MemoryTable, casacore::NullTable, casacore::PlainTable, and casacore::RefTable.

## changeTiledDataOnly()

virtual void casacore::BaseTable::changeTiledDataOnly | ( |  | ) |

virtual

Indicate we will only modify data values in existing tiled columns.

Reimplemented in casacore::PlainTable.

## checkRemoveColumn()

Bool casacore::BaseTable::checkRemoveColumn | ( | const Vector< String > & | columnNames,
|  | Bool | throwException ) const

Check if the set of columns can be removed.

It checks if columns have not been specified twice and it checks if they exist. If the flag is set an exception is thrown if errors are found.

## checkRowNumber()

void casacore::BaseTable::checkRowNumber | ( | rownr_t | rownr | ) | const

inline

Check if the row number is valid.

It throws an exception if out of range.

Definition at line 490 of file BaseTable.h.

References checkRowNumberThrow(), nrrow_p, and nrrowToAdd_p.

## checkRowNumberThrow()

void casacore::BaseTable::checkRowNumberThrow | ( | rownr_t | rownr | ) | const

private

Throw an exception for checkRowNumber.

Referenced by checkRowNumber().

## copy()

virtual void casacore::BaseTable::copy | ( | const String & | newName,
|  | int | tableOption ) const

virtual

Copy the table and all its subtables.

The default implementation of deepCopy is to call copy. The following options can be given:

Table::New
  When a table with this name exists, it will be overwritten.
Table::NewNoReplace
  When a table with this name already exists, an exception is thrown.
Table::Scratch
  Same as Table::New, but followed by markForDelete().

Reimplemented in casacore::ConcatTable, casacore::MemoryTable, and casacore::RefTable.

References tableOption().

## dataManagerInfo()

virtual Record casacore::BaseTable::dataManagerInfo | ( |  | ) | const

pure virtual

Get the data manager info.

Implemented in casacore::ConcatTable, casacore::MemoryTable, casacore::NullTable, casacore::PlainTable, and casacore::RefTable.

References casacore::Record().

Referenced by deepCopy(), and trueDeepCopy().

## deepCopy()

virtual void casacore::BaseTable::deepCopy | ( | const String & | newName,
|  | const Record & | dataManagerInfo,
|  | const StorageOption & | ,
|  | int | tableOption,
|  | Bool | valueCopy,
|  | int | endianFormat,
|  | Bool | noRows ) const

virtual

Reimplemented in casacore::ConcatTable, casacore::MemoryTable, casacore::NullTable, and casacore::RefTable.

References dataManagerInfo(), casacore::Record(), and tableOption().

## doNotWrite()

void casacore::BaseTable::doNotWrite | ( |  | ) |

inline

Do not write the table (used in in case of exceptions).

Definition at line 177 of file BaseTable.h.

References noWrite_p, and casacore::True.

## doSort()

virtual std::shared_ptr< BaseTable > casacore::BaseTable::doSort | ( | Block< BaseColumn * > & | ,
|  | const Block< std::shared_ptr< BaseCompare > > & | ,
|  | const Block< Int > & | sortOrder,
|  | int | sortOption,
|  | std::shared_ptr< Vector< rownr_t > > | sortIterBoundaries,
|  | std::shared_ptr< Vector< size_t > > | sortIterKeyIdxChange )

virtual

Do the actual sort.

The default implementation is suitable for almost all cases. Only in RefTable a smarter implementation is provided.

Reimplemented in casacore::NullTable.

## findDataManager()

virtual DataManager * casacore::BaseTable::findDataManager | ( | const String & | name,
|  | Bool | byColumn ) const

pure virtual

Find the data manager with the given name or for the given column.

Implemented in casacore::ConcatTable, casacore::MemoryTable, casacore::NullTable, casacore::PlainTable, and casacore::RefTable.

References casacore::name().

## flush()

virtual void casacore::BaseTable::flush | ( | Bool | fsync,
|  | Bool | recursive )

pure virtual

Flush the table, i.e.

write it to disk.

Implemented in casacore::ConcatTable, casacore::MemoryTable, casacore::NullTable, casacore::PlainTable, and casacore::RefTable.

## flushTableInfo()

virtual void casacore::BaseTable::flushTableInfo | ( |  | ) |

virtual

Write the TableInfo object.

Reimplemented in casacore::MemoryTable.

## getColumn() [1/2]

virtual BaseColumn * casacore::BaseTable::getColumn | ( | const String & | columnName | ) | const

pure virtual

Get a column object using its name.

Implemented in casacore::ConcatTable, casacore::MemoryTable, casacore::NullTable, casacore::PlainTable, and casacore::RefTable.

## getColumn() [2/2]

virtual BaseColumn * casacore::BaseTable::getColumn | ( | uInt | columnIndex | ) | const

pure virtual

Get a column object using its index.

Implemented in casacore::ConcatTable, casacore::MemoryTable, casacore::NullTable, casacore::PlainTable, and casacore::RefTable.

## getModifyCounter()

virtual uInt casacore::BaseTable::getModifyCounter | ( |  | ) | const

pure virtual

Get the modify counter.

Implemented in casacore::ConcatTable, casacore::MemoryTable, casacore::NullTable, casacore::PlainTable, and casacore::RefTable.

## getPartNames()

virtual void casacore::BaseTable::getPartNames | ( | Block< String > & | names,
|  | Bool | recursive ) const

virtual

Get the names of the tables this table consists of.

The default implementation adds the name of this table to the block.

Reimplemented in casacore::ConcatTable, and casacore::RefTable.

## getTableInfo()

void casacore::BaseTable::getTableInfo | ( |  | ) |

protected

Read the TableInfo object.

## hasLock()

virtual Bool casacore::BaseTable::hasLock | ( | FileLocker::LockType |  | ) | const

pure virtual

Has this process the read or write lock, thus can the table be read or written safely?

Implemented in casacore::ConcatTable, casacore::MemoryTable, casacore::NullTable, casacore::PlainTable, and casacore::RefTable.

## isColumnStored() [1/2]

Bool casacore::BaseTable::isColumnStored | ( | const String & | columnName | ) | const

Test if the given column is stored (otherwise it is virtual).

## isColumnStored() [2/2]

Bool casacore::BaseTable::isColumnStored | ( | uInt | columnIndex | ) | const

## isColumnWritable() [1/2]

Bool casacore::BaseTable::isColumnWritable | ( | const String & | columnName | ) | const

Test if the given column is writable.

## isColumnWritable() [2/2]

Bool casacore::BaseTable::isColumnWritable | ( | uInt | columnIndex | ) | const

## isMarkedForDelete()

Bool casacore::BaseTable::isMarkedForDelete | ( |  | ) | const

inline

Test if the table is marked for delete.

Definition at line 270 of file BaseTable.h.

References delete_p.

## isMultiUsed()

virtual Bool casacore::BaseTable::isMultiUsed | ( | Bool | checkSubTables | ) | const

pure virtual

Is the table in use (i.e.

open) in another process? If checkSubTables is set, it is also checked if a subtable is used in another process.

Implemented in casacore::ConcatTable, casacore::MemoryTable, casacore::NullTable, casacore::PlainTable, and casacore::RefTable.

## isNull()

virtual Bool casacore::BaseTable::isNull | ( |  | ) | const

virtual

Is the table a null table?

By default it is not.

Reimplemented in casacore::NullTable.

## isWritable()

virtual Bool casacore::BaseTable::isWritable | ( |  | ) | const

pure virtual

Test if this table is writable.

This tells if values can be put into a column.

Implemented in casacore::ConcatTable, casacore::MemoryTable, casacore::NullTable, casacore::PlainTable, and casacore::RefTable.

## keywordSet()

virtual TableRecord & casacore::BaseTable::keywordSet | ( |  | ) |

pure virtual

Get readonly access to the table keyword set.

Implemented in casacore::ConcatTable, casacore::MemoryTable, casacore::NullTable, casacore::PlainTable, and casacore::RefTable.

## lock()

virtual Bool casacore::BaseTable::lock | ( | FileLocker::LockType | ,
|  | uInt | nattempts )

pure virtual

Try to lock the table for read or write access.

Implemented in casacore::ConcatTable, casacore::MemoryTable, casacore::NullTable, casacore::PlainTable, and casacore::RefTable.

## lockOptions()

virtual const TableLock & casacore::BaseTable::lockOptions | ( |  | ) | const

pure virtual

Get the locking info.

Implemented in casacore::ConcatTable, casacore::MemoryTable, casacore::NullTable, casacore::PlainTable, and casacore::RefTable.

Referenced by mergeLock().

## logicCheck()

void casacore::BaseTable::logicCheck | ( | BaseTable * | that | ) |

private

Check if the tables combined in a logical operation have the same root.

References BaseTable().

## logicRows()

Vector< rownr_t > casacore::BaseTable::logicRows | ( |  | ) |

private

Get the rownrs of the table in ascending order to be used in the logical operation on the table.

## makeAbsoluteName()

String casacore::BaseTable::makeAbsoluteName | ( | const String & | name | ) | const

private

Make the name absolute.

It first checks if the name contains valid characters (not only. and /).

References casacore::name().

## makeEmptyTableDesc()

const TableDesc & casacore::BaseTable::makeEmptyTableDesc | ( |  | ) | const

private

Make an empty table description.

This is used if one asks for the description of a NullTable. Creating an empty TableDesc in the NullTable takes too much time. Furthermore it causes static initialization order problems.

Referenced by tableDesc().

## makeIterator()

BaseTableIterator * casacore::BaseTable::makeIterator | ( | const Block< String > & | columnNames,
|  | const Block< std::shared_ptr< BaseCompare > > & | ,
|  | const Block< Int > & | orders,
|  | int | option,
|  | bool | cacheIterationBoundaries = false )

Create an iterator.

## makeRefTable()

std::shared_ptr< RefTable > casacore::BaseTable::makeRefTable | ( | Bool | rowOrder,
|  | rownr_t | initialNrrow )

Create a RefTable object.

References rowOrder().

## makeTableDir()

Bool casacore::BaseTable::makeTableDir | ( |  | ) |

protected

Create the table directory when needed (and possible).

When the file already exists, check if it is a directory. It returns True when it actually created the directory.

## markForDelete()

void casacore::BaseTable::markForDelete | ( | Bool | callback,
|  | const String & | oldName )

Mark the table for delete.

This means that the underlying table gets deleted when it is actually destructed. The scratchCallback function is called when needed.

## mergeLock()

virtual void casacore::BaseTable::mergeLock | ( | const TableLock & | lockOptions | ) |

pure virtual

Merge the given lock info with the existing one.

Implemented in casacore::ConcatTable, casacore::MemoryTable, casacore::NullTable, casacore::PlainTable, and casacore::RefTable.

References lockOptions().

## nrow()

rownr_t casacore::BaseTable::nrow | ( |  | ) | const

inline

Get number of rows.

Definition at line 311 of file BaseTable.h.

References nrrow_p.

## openedForWrite()

Bool casacore::BaseTable::openedForWrite | ( |  | ) | const

protected

Test if the table is opened for write.

## operator=()

BaseTable & casacore::BaseTable::operator= | ( | const BaseTable & |  | ) |

delete

Assignment is forbidden, because copying a table requires some more knowledge (like table name of result).

References BaseTable().

## prepareCopyRename()

void casacore::BaseTable::prepareCopyRename | ( | const String & | newName,
|  | int | tableOption ) const

protected

Prepare for copying or renaming a table.

It checks if the target table already exists and removes it when necessary.

References tableOption().

## project()

std::shared_ptr< BaseTable > casacore::BaseTable::project | ( | const Block< String > & | columnNames | ) |

Project the given columns (i.e.

select the columns).

## removeColumn()

virtual void casacore::BaseTable::removeColumn | ( | const Vector< String > & | columnNames | ) |

pure virtual

Remove columns.

Implemented in casacore::ConcatTable, casacore::MemoryTable, casacore::NullTable, casacore::PlainTable, and casacore::RefTable.

## removeRow() [1/3]

void casacore::BaseTable::removeRow | ( | const Vector< rownr_t > & | rownrs | ) |

## removeRow() [2/3]

void casacore::BaseTable::removeRow | ( | const Vector< uInt > & | rownrs | ) |

## removeRow() [3/3]

virtual void casacore::BaseTable::removeRow | ( | rownr_t | rownr | ) |

virtual

Remove rows.

This will fail for tables not supporting removal of rows.
Tip: The following code fragments do NOT have the same result:

tab;removeRow (10); // remove row 10
tab;removeRow (20); // remove row 20, which was 21
Vector<rownr_t> vec(2);
vec(0) = 10;
vec(1) = 20;
tab;removeRow (vec); // remove row 10 and 20
casacore::BaseTable::removeRow
virtual void removeRow(rownr_t rownr)
Remove rows.
casacore::Vector
Definition Vector.h:82

because in the first fragment removing row 10 turns the former row 21 into row 20;

Reimplemented in casacore::ConcatTable, casacore::MemoryTable, casacore::NullTable, casacore::PlainTable, and casacore::RefTable.

## rename()

virtual void casacore::BaseTable::rename | ( | const String & | newName,
|  | int | tableOption )

virtual

Rename the table.

The following options can be given:

Table::Update
  A table with this name must already exists, which will be overwritten. When succesfully renamed, the table is unmarked for delete (if necessary).
Table::New
  When a table with this name exists, it will be overwritten. When succesfully renamed, the table is unmarked for delete (if necessary).
Table::NewNoReplace
  When a table with this name already exists, an exception is thrown. When succesfully renamed, the table is unmarked for delete (if necessary).
Table::Scratch
  Same as Table::New, but followed by markForDelete().

The rename function in this base class renames the table file. In a derived class (e.g. PlainTable) the function should also be implemented to rename subtables in its keywords.

Reimplemented in casacore::MemoryTable.

References tableOption().

## renameColumn()

virtual void casacore::BaseTable::renameColumn | ( | const String & | newName,
|  | const String & | oldName )

pure virtual

Rename a column.

Implemented in casacore::ConcatTable, casacore::MemoryTable, casacore::NullTable, casacore::PlainTable, and casacore::RefTable.

## renameHypercolumn()

virtual void casacore::BaseTable::renameHypercolumn | ( | const String & | newName,
|  | const String & | oldName )

pure virtual

Rename a hypercolumn.

Implemented in casacore::ConcatTable, casacore::MemoryTable, casacore::NullTable, casacore::PlainTable, and casacore::RefTable.

## renameSubTables()

virtual void casacore::BaseTable::renameSubTables | ( | const String & | newName,
|  | const String & | oldName )

protected virtual

Rename the subtables (used by rename function).

Reimplemented in casacore::NullTable, and casacore::PlainTable.

## reopenRW()

virtual void casacore::BaseTable::reopenRW | ( |  | ) |

pure virtual

Reopen the table for read/write.

Implemented in casacore::ConcatTable, casacore::MemoryTable, casacore::NullTable, casacore::PlainTable, and casacore::RefTable.

Referenced by casacore::Table::reopenRW().

## resync()

virtual void casacore::BaseTable::resync | ( |  | ) |

pure virtual

Resync the Table object with the table file.

Implemented in casacore::ConcatTable, casacore::MemoryTable, casacore::NullTable, casacore::PlainTable, and casacore::RefTable.

## root()

virtual BaseTable * casacore::BaseTable::root | ( |  | ) |

virtual

Get pointer to root table (i.e.

parent of a RefTable). Default it is this table. It is meant for the reference tables after a select or sort which can then still name their parent as the root.

Reimplemented in casacore::NullTable, and casacore::RefTable.

References BaseTable().

Referenced by casacore::Table::isSameRoot().

## rowNumbers()

virtual Vector< rownr_t > casacore::BaseTable::rowNumbers | ( |  | ) | const

virtual

Get a vector of row numbers.

By default it returns the row numbers 0..nrrow()-1. It needs to be implemented for RefTable only.

Reimplemented in casacore::NullTable, and casacore::RefTable.

## rowOrder()

virtual Bool casacore::BaseTable::rowOrder | ( |  | ) | const

virtual

Tell if the table is in row order.

By default it is, since normally a table is always in row order. It is meant for RefTable-s, where the rows can be in another (sorted) order.

Reimplemented in casacore::NullTable, and casacore::RefTable.

Referenced by makeRefTable().

## rowStorage()

virtual Vector< rownr_t > & casacore::BaseTable::rowStorage | ( |  | ) |

virtual

By the default the table cannot return the storage of rownrs.

That can only be done by a RefTable, where it is implemented.

Reimplemented in casacore::NullTable, and casacore::RefTable.

## rwKeywordSet()

virtual TableRecord & casacore::BaseTable::rwKeywordSet | ( |  | ) |

pure virtual

Get read/write access to the table keyword set.

This requires that the table is locked (or it gets locked when using AutoLocking mode).

Implemented in casacore::ConcatTable, casacore::MemoryTable, casacore::NullTable, casacore::PlainTable, and casacore::RefTable.

## scratchCallback()

void casacore::BaseTable::scratchCallback | ( | Bool | isScratch,
|  | const String & | oldName ) const

protected

Do the callback for scratch tables (if callback is set).

## select() [1/4]

std::shared_ptr< BaseTable > casacore::BaseTable::select | ( | const Block< Bool > & | mask | ) |

Select rows using a mask block.

The length of the block must match the number of rows in the table. If True, the corresponding row will be selected.

References casacore::mask().

## select() [2/4]

std::shared_ptr< BaseTable > casacore::BaseTable::select | ( | const TableExprNode & | ,
|  | rownr_t | maxRow,
|  | rownr_t | offset )

Select rows using the given expression (which can be null).

Skip first offset matching rows. Return at most maxRow matching rows.

References casacore::offset().

## select() [3/4]

std::shared_ptr< BaseTable > casacore::BaseTable::select | ( | const Vector< rownr_t > & | rownrs | ) |

Select rows using a vector of row numbers.

## select() [4/4]

std::shared_ptr< BaseTable > casacore::BaseTable::select | ( | rownr_t | maxRow,
|  | rownr_t | offset )

Select maxRow rows and skip first offset rows.

maxRow=0 means all.

References casacore::offset().

## setTableChanged()

virtual void casacore::BaseTable::setTableChanged | ( |  | ) |

virtual

Set the table to being changed.

By default it does nothing.

Reimplemented in casacore::PlainTable.

## shouldNotWrite()

Bool casacore::BaseTable::shouldNotWrite | ( |  | ) | const

inline protected

Should the table be written.

This flag is False if an exception was thrown.

Definition at line 552 of file BaseTable.h.

References noWrite_p.

## showColumnInfo()

void casacore::BaseTable::showColumnInfo | ( | ostream & | os,
|  | const TableDesc & | ,
|  | uInt | maxNameLength,
|  | const Array< String > & | columnNames,
|  | Bool | sort,
|  | Bool | cOrder ) const

private

Show the info of the given columns.

Sort the columns if needed.

References sort().

## showStructure()

void casacore::BaseTable::showStructure | ( | std::ostream & | ,
|  | Bool | showDataMan,
|  | Bool | showColumns,
|  | Bool | showSubTables,
|  | Bool | sortColumns,
|  | Bool | cOrder )

Show the table structure (implementation of Table::showStructure).

## showStructureExtra()

virtual void casacore::BaseTable::showStructureExtra | ( | std::ostream & |  | ) | const

private virtual

Show a possible extra table structure header.

It is used by e.g. RefTable to show which table is referenced.

Reimplemented in casacore::ConcatTable, and casacore::RefTable.

## sort()

std::shared_ptr< BaseTable > casacore::BaseTable::sort | ( | const Block< String > & | columnNames,
|  | const Block< std::shared_ptr< 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.

Referenced by showColumnInfo().

## storageOption()

virtual const StorageOption & casacore::BaseTable::storageOption | ( |  | ) | const

pure virtual

Get the storage option used for the table.

Implemented in casacore::ConcatTable, casacore::MemoryTable, casacore::NullTable, casacore::PlainTable, and casacore::RefTable.

## tabAnd()

std::shared_ptr< BaseTable > casacore::BaseTable::tabAnd | ( | BaseTable * |  | ) |

Do logical operations on a table.

intersection with another table

References BaseTable().

## tableDesc()

const TableDesc & casacore::BaseTable::tableDesc | ( |  | ) | const

inline

Get the table description.

Definition at line 274 of file BaseTable.h.

References makeEmptyTableDesc(), and tdescPtr_p.

Referenced by addColumn(), casacore::ConcatTable::addColumn(), casacore::MemoryTable::addColumn(), casacore::NullTable::addColumn(), casacore::PlainTable::addColumn(), casacore::RefTable::addColumn(), and addColumns().

## tableInfo() [1/2]

TableInfo & casacore::BaseTable::tableInfo | ( |  | ) |

inline

Get access to the TableInfo object.

Definition at line 300 of file BaseTable.h.

References info_p.

## tableInfo() [2/2]

TableInfo casacore::BaseTable::tableInfo | ( | const String & | tableName | ) |

static

Get the table info of the table with the given name.

An empty object is returned when the table is unknown.

References tableName().

## tableName()

const String & casacore::BaseTable::tableName | ( |  | ) | const

inline

Get the table name.

Definition at line 197 of file BaseTable.h.

References name_p.

Referenced by BaseTable(), BaseTable(), BaseTableCommon(), and tableInfo().

## tableOption()

int casacore::BaseTable::tableOption | ( |  | ) | const

inline

Get the table option.

Definition at line 255 of file BaseTable.h.

References option_p.

Referenced by BaseTable(), BaseTable(), BaseTableCommon(), copy(), casacore::ConcatTable::copy(), casacore::MemoryTable::copy(), casacore::RefTable::copy(), casacore::RefTable::copyRefTable(), deepCopy(), casacore::ConcatTable::deepCopy(), casacore::MemoryTable::deepCopy(), casacore::NullTable::deepCopy(), casacore::RefTable::deepCopy(), prepareCopyRename(), rename(), casacore::MemoryTable::rename(), casacore::PlainTable::toAipsIOFoption(), and trueDeepCopy().

## tableType()

virtual int casacore::BaseTable::tableType | ( |  | ) | const

virtual

Get the table type.

By default it returns Table::Plain.

Reimplemented in casacore::ConcatTable, casacore::MemoryTable, and casacore::RefTable.

## tabNot()

std::shared_ptr< BaseTable > casacore::BaseTable::tabNot | ( |  | ) |

take complement

## tabOr()

std::shared_ptr< BaseTable > casacore::BaseTable::tabOr | ( | BaseTable * |  | ) |

union with another table

References BaseTable().

## tabSub()

std::shared_ptr< BaseTable > casacore::BaseTable::tabSub | ( | BaseTable * |  | ) |

subtract another table

References BaseTable().

## tabXor()

std::shared_ptr< BaseTable > casacore::BaseTable::tabXor | ( | BaseTable * |  | ) |

xor with another table

References BaseTable().

## throwIfTableExists()

void casacore::BaseTable::throwIfTableExists | ( |  | ) |

protected

Check if the table already exists.

Throw an exception if so.

## traceId()

int casacore::BaseTable::traceId | ( |  | ) | const

inline

Get the table's trace-id.

Definition at line 494 of file BaseTable.h.

References itsTraceId.

## trueDeepCopy()

void casacore::BaseTable::trueDeepCopy | ( | const String & | newName,
|  | const Record & | dataManagerInfo,
|  | const StorageOption & | ,
|  | int | tableOption,
|  | int | endianFormat,
|  | Bool | noRows ) const

protected

Make a true deep copy of the table.

The table is flushed before making the copy.

References dataManagerInfo(), casacore::Record(), and tableOption().

## unlock()

virtual void casacore::BaseTable::unlock | ( |  | ) |

pure virtual

Unlock the table.

This will also synchronize the table data, thus force the data to be written to disk.

Implemented in casacore::ConcatTable, casacore::MemoryTable, casacore::NullTable, casacore::PlainTable, and casacore::RefTable.

## unmarkForDelete()

void casacore::BaseTable::unmarkForDelete | ( | Bool | callback,
|  | const String & | oldName )

Unmark the table for delete.

This means the underlying table does not get deleted when destructed. The scratchCallback function is called when needed.

## writeEnd()

void casacore::BaseTable::writeEnd | ( | AipsIO & |  | ) |

protected

End writing a table.

## writeStart()

void casacore::BaseTable::writeStart | ( | AipsIO & | ,
|  | Bool | bigEndian )

protected

Start writing a table.

It does a putstart and writes nrrow_p. It should be ended by calling writeEnd.

## Member Data Documentation

## delete_p

Bool casacore::BaseTable::delete_p

protected

Definition at line 505 of file BaseTable.h.

Referenced by isMarkedForDelete().

## info_p

TableInfo casacore::BaseTable::info_p

protected

Definition at line 506 of file BaseTable.h.

Referenced by tableInfo().

## itsMpiComm

MPI_Comm casacore::BaseTable::itsMpiComm

private

MPI communicator for parallel I/O.

When using an MPI-disabled casacore, MPI applications have always been able to create Tables from each rank independently. Defaulting this communicator to MPI_COMM_SELF preserves that expectation.

Definition at line 595 of file BaseTable.h.

## itsTraceId

int casacore::BaseTable::itsTraceId

protected

Definition at line 508 of file BaseTable.h.

Referenced by traceId().

## madeDir_p

Bool casacore::BaseTable::madeDir_p

protected

Definition at line 507 of file BaseTable.h.

## name_p

String casacore::BaseTable::name_p

protected

Definition at line 502 of file BaseTable.h.

Referenced by tableName().

## noWrite_p

Bool casacore::BaseTable::noWrite_p

protected

Definition at line 504 of file BaseTable.h.

Referenced by doNotWrite(), and shouldNotWrite().

## nrrow_p

rownr_t casacore::BaseTable::nrrow_p

protected

Definition at line 499 of file BaseTable.h.

Referenced by checkRowNumber(), and nrow().

## nrrowToAdd_p

rownr_t casacore::BaseTable::nrrowToAdd_p

protected

Definition at line 500 of file BaseTable.h.

Referenced by checkRowNumber().

## option_p

int casacore::BaseTable::option_p

protected

Definition at line 503 of file BaseTable.h.

Referenced by tableOption().

## tdescPtr_p

std::shared_ptr<TableDesc> casacore::BaseTable::tdescPtr_p

protected

Definition at line 501 of file BaseTable.h.

Referenced by tableDesc().

## thisPtr_p

std::weak_ptr<BaseTable> casacore::BaseTable::thisPtr_p

protected

Definition at line 498 of file BaseTable.h.

The documentation for this class was generated from the following file:

- tables/Tables/BaseTable.h