Loading...
Searching...
No Matches
casacore::Table Class Reference
tables package (libcasa_tables) » Tables_module

More...

`#include <Table.h>`

## Public Types

enum | TableOption { Old , New , NewNoReplace , Scratch , Update , Delete }
| Define the possible options how a table can be opened. More...
enum | TableType { Plain , Memory }
| Define the possible table types. More...
enum | EndianFormat { BigEndian , LittleEndian , LocalEndian , AipsrcEndian }
| Define the possible endian formats in which table data can be stored. More...
typedef 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.e.

## Public Member Functions

| Table ()
| Create a null Table object (i.e.
| Table (const String &tableName, TableOption=Table::Old, const TSMOption &=TSMOption())
| Create a table object for an existing table.
| Table (const String &tableName, const TableLock &lockOptions, TableOption=Table::Old, const TSMOption &=TSMOption())
| Table (const String &tableName, const String &tableDescName, TableOption=Table::Old, const TSMOption &=TSMOption())
| Table (const String &tableName, const String &tableDescName, const TableLock &lockOptions, TableOption=Table::Old, const TSMOption &=TSMOption())
| Table (TableType, EndianFormat=Table::AipsrcEndian, const TSMOption &=TSMOption())
| Make a new empty table (plain (scratch) or memory type).
| Table (SetupNewTable &, rownr_t nrrow=0, Bool initialize=False, EndianFormat=Table::AipsrcEndian, const TSMOption &=TSMOption())
| Make a table object for a new table, which can thereafter be used for reading and writing.
| Table (SetupNewTable &, TableType, rownr_t nrrow=0, Bool initialize=False, EndianFormat=Table::AipsrcEndian, const TSMOption &=TSMOption())
| Table (SetupNewTable &, TableType, const TableLock &lockOptions, rownr_t nrrow=0, Bool initialize=False, EndianFormat=Table::AipsrcEndian, const TSMOption &=TSMOption())
| Table (SetupNewTable &, TableLock::LockOption, rownr_t nrrow=0, Bool initialize=False, EndianFormat=Table::AipsrcEndian, const TSMOption &=TSMOption())
| Table (SetupNewTable &, const TableLock &lockOptions, rownr_t nrrow=0, Bool initialize=False, EndianFormat=Table::AipsrcEndian, const TSMOption &=TSMOption())
| Table (MPI_Comm mpiComm, TableType, EndianFormat=Table::AipsrcEndian, const TSMOption &=TSMOption())
| Table (MPI_Comm mpiComm, SetupNewTable &, rownr_t nrrow=0, Bool initialize=False, EndianFormat=Table::AipsrcEndian, const TSMOption &=TSMOption())
| Table (MPI_Comm mpiComm, SetupNewTable &, TableType, rownr_t nrrow=0, Bool initialize=False, EndianFormat=Table::AipsrcEndian, const TSMOption &=TSMOption())
| Table (MPI_Comm mpiComm, SetupNewTable &, TableType, const TableLock &lockOptions, rownr_t nrrow=0, Bool initialize=False, EndianFormat=Table::AipsrcEndian, const TSMOption &=TSMOption())
| Table (MPI_Comm mpiComm, SetupNewTable &, TableLock::LockOption, rownr_t nrrow=0, Bool initialize=False, EndianFormat=Table::AipsrcEndian, const TSMOption &=TSMOption())
| Table (MPI_Comm mpiComm, SetupNewTable &, const TableLock &lockOptions, rownr_t nrrow=0, Bool initialize=False, EndianFormat=Table::AipsrcEndian, const TSMOption &=TSMOption())
| Table (const Block< Table > &tables, const Block< String > &subTables=Block< String >(), const String &subDirName=String())
| Create a table object as the virtual concatenation of one or more of existing tables.
| Table (const Block< String > &tableNames, const Block< String > &subTables=Block< String >(), TableOption=Table::Old, const TSMOption &=TSMOption(), const String &subDirName=String())
| Table (const Block< String > &tableNames, const Block< String > &subTables, const TableLock &lockOptions, TableOption=Table::Old, const TSMOption &=TSMOption())
| Table (const Table &)
| Copy constructor (reference semantics).
virtual | ~Table ()
| The destructor flushes (i.e.
Table & | operator= (const Table &)
| Assignment (reference semantics).
Block< String > | getPartNames (Bool recursive=False) const
| Get the names of the tables this table consists of.
Bool | isSameTable (const Table &other) const
| Is this table the same as the other?
Bool | isSameRoot (const Table &other) const
| Is the root table of this table the same as that of the other one?
void | closeSubTables () const
| Close all open subtables.
void | reopenRW ()
| Try to reopen the table for read/write access.
void | changeTiledDataOnly ()
| Indicate we will leave the table unchanged except for the values of the data in columns stored with a TiledShape storage manager.
Table::EndianFormat | endianFormat () const
| Get the endian format in which the table is stored.
const StorageOption & | storageOption () const
| Get the storage option used for the table.
Bool | isMultiUsed (Bool checkSubTables=False) const
| Is the table used (i.e.
const TableLock & | lockOptions () const
| Get the locking options.
Bool | hasLock (FileLocker::LockType=FileLocker::Write) const
| Has this process the read or write lock, thus can the table be read or written safely?
Bool | hasLock (Bool write) const
Bool | lock (FileLocker::LockType=FileLocker::Write, uInt nattempts=0)
| Try to lock the table for read or write access (default is write).
Bool | lock (Bool write, uInt nattempts=0)
void | unlock ()
| Unlock the table.
Bool | hasDataChanged ()
| Determine if column or keyword table data have changed (or is being changed) since the last time this function was called.
void | flush (Bool fsync=False, Bool recursive=False)
| Flush the table, i.e.
void | resync ()
| Resynchronize the Table object with the table file.
Bool | isNull () const
| Test if the object is null, i.e.
void | throwIfNull () const
| Throw an exception if the object is null, i.e.
void | showStructure (std::ostream &, Bool showDataMans=True, Bool showColumns=True, Bool showSubTables=False, Bool sortColumns=False, Bool cOrder=False) const
| Show the structure of the table.
void | showKeywords (std::ostream &, Bool showSubTables=False, Bool showTabKey=True, Bool showColKey=False, Int maxVal=25) const
| Show the table and/or column keywords, possibly also of all subtables.
void | showKeywordSets (std::ostream &, Bool showTabKey, Bool showColKey, Int maxVal) const
| Show the table and/or column keywords of this table.
Bool | isRootTable () const
| Test if this table is the root table (ie.
Bool | isWritable () const
| Test if this table is opened as 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 TableRecord & | keywordSet () const
| Get readonly access to the table keyword set.
TableRecord & | rwKeywordSet ()
| Get read/write access to the table keyword set.
const TableInfo & | tableInfo () const
| Get access to the TableInfo object.
TableInfo & | tableInfo ()
void | flushTableInfo () const
| Write the TableInfo object.
const TableDesc & | tableDesc () const
| Get the table description.
TableDesc | actualTableDesc () const
Record | dataManagerInfo () const
| Return all data managers used and the columns served by them.
const String & | tableName () const
| Get the table name.
void | rename (const String &newName, TableOption)
| Rename the table and all its subtables.
void | copy (const String &newName, TableOption, Bool noRows=False) const
| Copy the table and all its subtables.
void | deepCopy (const String &newName, TableOption, Bool valueCopy=False, EndianFormat=AipsrcEndian, Bool noRows=False) const
void | deepCopy (const String &newName, const Record &dataManagerInfo, TableOption, Bool valueCopy=False, EndianFormat=AipsrcEndian, Bool noRows=False) const
void | deepCopy (const String &newName, const Record &dataManagerInfo, const StorageOption &, TableOption, Bool valueCopy=False, EndianFormat=AipsrcEndian, Bool noRows=False) const
Table | copyToMemoryTable (const String &name, Bool noRows=False) const
| Make a copy of a table to a MemoryTable object.
TableType | tableType () const
| Get the table type.
int | tableOption () const
| Get the table option.
void | markForDelete ()
| Mark the table for delete.
void | unmarkForDelete ()
| Unmark the table for delete.
Bool | isMarkedForDelete () const
| Test if the table is marked for delete.
rownr_t | nrow () const
| Get the number of rows.
Bool | canAddRow () const
| Test if it is possible to add a row to this table.
void | addRow (rownr_t nrrow=1, Bool initialize=False)
| Add one or more rows at the end of the table.
Bool | canRemoveRow () const
| Test if it is possible to remove a row from this table.
void | removeRow (rownr_t rownr)
| Remove the given row(s).
void | removeRow (const RowNumbers &rownrs)
TableExprNode | key (const String &keywordName) const
| Create a TableExprNode object for a column or for a keyword in the table keyword set.
TableExprNode | key (const Vector< String > &fieldNames) const
TableExprNode | col (const String &columnName) const
TableExprNode | col (const String &columnName, const Vector< String > &fieldNames) const
TableExprNode | nodeRownr (rownr_t origin=0) const
| Create a TableExprNode object for the rownumber function.
TableExprNode | nodeRandom () const
| Create a TableExprNode object for the rand function.
Table | operator() (const TableExprNode &, rownr_t maxRow=0, rownr_t offset=0) const
| Select rows from a table using an select expression consisting of TableExprNode objects.
Table | operator() (const RowNumbers &rownrs) const
| Select rows using a vector of row numbers.
Table | operator() (const Block< Bool > &mask) const
| Select rows using a mask block.
Table | project (const Block< String > &columnNames) const
| Project the given columns (i.e.
Table | operator& (const Table &) const
| Do logical operations on a table.
Table | operator| (const Table &) const
| Union with another table.
Table | operator- (const Table &) const
| Subtract another table.
Table | operator^ (const Table &) const
| Xor with another table.
Table | operator! () const
| Take complement.
Table | sort (const String &columnName, int=Sort::Ascending, int=Sort::ParSort) const
| Sort a table on one or more columns of scalars.
Table | sort (const Block< String > &columnNames, int=Sort::Ascending, int=Sort::ParSort) const
| Sort on multiple columns.
Table | sort (const Block< String > &columnNames, const Block< Int > &sortOrders, int=Sort::ParSort) const
| Sort on multiple columns.
Table | sort (const Block< String > &columnNames, const Block< std::shared_ptr< BaseCompare > > &compareObjects, const Block< Int > &sortOrders, int=Sort::ParSort) const
| Sort on multiple columns.
RowNumbers | rowNumbers () const
| Get a vector of row numbers in the root table of rows in this table.
RowNumbers | rowNumbers (const Table &that, Bool tryFast=False) const
| Get a vector of row numbers in that table of rows in this table.
void | addColumn (const ColumnDesc &columnDesc, Bool addToParent=True)
| Add a column to the table.
void | addColumn (const ColumnDesc &columnDesc, const String &dataManager, Bool byName, Bool addToParent=True)
| Use an existing data manager with the given name or type.
void | addColumn (const ColumnDesc &columnDesc, const DataManager &dataManager, Bool addToParent=True)
| Use the given data manager (which is a new one).
void | addColumn (const TableDesc &tableDesc, const DataManager &dataManager, Bool addToParent=True)
| Add a bunch of columns using the given new data manager.
void | addColumn (const TableDesc &tableDesc, const Record &dataManagerInfo, Bool addToParent=True)
Bool | canRemoveColumn (const String &columnName) const
| Test if columns can be removed.
Bool | canRemoveColumn (const Vector< String > &columnNames) const
void | removeColumn (const String &columnName)
| Remove columns.
void | removeColumn (const Vector< String > &columnName)
Bool | canRenameColumn (const String &columnName) const
| Test if a column can be renamed.
void | renameColumn (const String &newName, const String &oldName)
| Rename a column.
void | renameHypercolumn (const String &newName, const String &oldName)
void | getTableKeyword (AipsIO &, Bool openWritable)
| Read a table from AipsIO (for TableKeywords).
DataManager * | findDataManager (const String &name, Bool byColumn=False) const
| Find the data manager with the given name or for the given column name.

## Static Public Member Functions

static ScratchCallback * | setScratchCallback (ScratchCallback *)
| Set the pointer to the ScratchCallback function.
static Bool | isOpened (const String &tableName)
| Is the table used (i.e.
static uInt | nAutoLocks ()
| Determine the number of locked tables opened with the AutoLock option (Locked table means locked for read and/or write).
static void | relinquishAutoLocks (Bool all=False)
| Unlock locked tables opened with the AutoLock option.
static Vector< String > | getLockedTables (FileLocker::LockType=FileLocker::Read, int lockOption=-1)
| Get the names of tables locked in this process.
static Bool | isNativeDataType (DataType dtype)
| Test if the given data type is native to the table system.
static String | fileName (const String &tableName)
| Make the table file name.
static Bool | isReadable (const String &tableName, bool throwIf=False)
| Test if a table with the given name exists and is readable.
static Bool | isWritable (const String &tableName, bool throwIf=False)
| Test if a table with the given name exists and is writable.
static Vector< String > | nonWritableFiles (const String &tableName)
| Find the non-writable files in a table.

## Friends

class | TableColumn
class | BaseTable
class | PlainTable
class | MemoryTable
class | RefTable
class | ConcatTable
class | TableIterator
class | RODataManAccessor
class | TableExprNode
class | TableExprNodeRep
AipsIO & | operator<< (AipsIO &, const Table &)
| Write a table to AipsIO (for TypedKeywords<Table>).
AipsIO & | operator>> (AipsIO &, Table &)
| Read a table from AipsIO (for TypedKeywords<Table>).
ostream & | operator<< (ostream &, const Table &)
| Write a table to ostream (for TypedKeywords<Table>).

## Detailed Description

Main interface class to a read/write table

### Intended use:

Public interface

### Review Status

Reviewed By:
  TPPR
Date Reviewed:
  08.11.94
Test programs:
  tTable

### Prerequisite

- SetupNewTable
- TableDesc
- TableColumn
- ScalarColumn
- ArrayColum
- TableLock

### Synopsis

Class Table can be used to create a new table or to access an existing table in read/write or readonly mode.

To access the data in a Table, objects have to be created to access the columns. These objects are TableColumn, ScalarColumn<T> and ArrayColumn<T>, which can be created via their constructors. Furthermore the Table has a TableRecord object for holding keywords which can be read or written using the appropriate functions.
The Table class structure is shown in this UML diagram.

To open an existing table, a simple Table constructor can be used. The possible construct options are:

- Old readonly table (default option)
- Update update existing table
- Delete delete table

Creating a new table requires more work, because columns have to be bound to storage managers or virtual column engines. Class SetupNewTable is needed for this purpose. The Tables module documentation explains in more detail how to create a table. When creating a table, it can be specified which endian format to use. By default it uses the format specified in the aipsrc variable `table.endianformat` which defaults to `Table::LocalEndian` (thus the endian format of the machine being used).

Note that TableUtil contains convenience function to open, create or delete a table. They make it possible to use the :: notation to denote subtables.

It is possible to create a Table object as the virtual concatenation of Tables having identical table descriptions. Subtables of those tables can optionally be concatenated as well. E.g. if a MeasurementSet is partioned in time, this mechanism makes it possible to view it as a single table. Furthermore, a subtable like SYSCAL can be concatenated as well, while the other subtables are identical in all partitions and are taken from the first table only.

Other Table objects can be created from a Table using the select, project and sort functions. The result in so-called reference tables. In this way a subset of a table can be created and can be read/written in the same way as a normal Table. Writing has the effect that the underlying table gets written.

### Example

// Open a table to be updated.
Table myTable ("theTable", Table::Update);
// Write the column containing the scalar RA.
ScalarColumn<double> raColumn(myTable, "RA");
rownr_t nrrow = myTable.nrow();
for (rownr_t i=0; i<nrrow; i++) {
raColumn.put (i, i+10); // Put value i+10 into row i
}
casacore::ScalarColumn
Definition ScalarColumn.h:83
casacore::Table::Update
@ Update
update existing table
Definition Table.h:181
casacore::Table::Table
Table()
Create a null Table object (i.e.
casacore::rownr_t
uInt64 rownr_t
Define the type of a row number in a table.
Definition aipsxtype.h:44

### Motivation

Table is the envelope for the underlying counted referenced classes derived from BaseTable. In this way no pointers have to be used to get polymorphism.

### To Do

- add, remove, rename columns.
- virtual concatenation of tables (if still necessary).
- maybe an isAttached function.

Definition at line 156 of file Table.h.

## Member Typedef Documentation

## ScratchCallback

typedef void casacore::Table::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.e.

created, closed, renamed, (un)markForDelete).
- isScratch=True indicates that a scratch table is created (oldName is empty) or renamed (oldName is not empty).
- isScratch=False indicates that a scratch table with name name is not scratch anymore (because it is closed or because its state is set to non-scratch).

Definition at line 217 of file Table.h.

## Member Enumeration Documentation

## EndianFormat

enum casacore::Table::EndianFormat

Define the possible endian formats in which table data can be stored.

Enumerator
BigEndian | store table data in big endian (e.g. SUN) format
LittleEndian | store table data in little endian (e.g. Intel) format
LocalEndian | store data in the endian format of the machine used
AipsrcEndian | use endian format defined in the aipsrc variable table.endianformat If undefined, it defaults to LocalEndian.

Definition at line 195 of file Table.h.

## TableOption

enum casacore::Table::TableOption

Define the possible options how a table can be opened.

Enumerator
Old | existing table
New | create table
NewNoReplace | create table (may not exist)
Scratch | new table, which gets marked for delete
Update | update existing table
Delete | delete table

Definition at line 171 of file Table.h.

## TableType

enum casacore::Table::TableType

Define the possible table types.

Enumerator
Plain | plain table (stored on disk)
Memory | table held in memory

Definition at line 187 of file Table.h.

## Constructor & Destructor Documentation

## Table() [1/21]

casacore::Table::Table | ( |  | ) |

Create a null Table object (i.e.

a NullTable is attached). The sole purpose of this constructor is to allow construction of an array of Table objects. The assignment operator can be used to make a null object reference a proper table.

Referenced by copyToMemoryTable(), isSameRoot(), isSameTable(), casacore::MSTable< MSEnum >::MSTable(), operator!(), operator&(), operator()(), operator()(), operator()(), operator-(), operator<<, operator<<, operator=(), operator>>, operator^(), operator|(), project(), casacore::MSTable< MSEnum >::referenceCopy(), rowNumbers(), sort(), sort(), sort(), sort(), and Table().

## Table() [2/21]

casacore::Table::Table | ( | const String & | tableName,
|  | TableOption | = Table::Old,
|  | const TSMOption & | = TSMOption() )

explicit

Create a table object for an existing table.

The only options allowed are Old, Update, and Delete. If the name of a table description is given, it is checked if the table has that description. Locking options can be given (see class TableLock. If the table with this name was already opened in this process, the existing and new locking options are merged using TableLock::merge. The default locking mechanism is DefaultLocking. If the table is not open yet, it comes to AutoLocking with an inspection interval of 5 seconds. Otherwise DefaultLocking keeps the locking options of the already open table.

References Old, and tableName().

## Table() [3/21]

casacore::Table::Table | ( | const String & | tableName,
|  | const TableLock & | lockOptions,
|  | TableOption | = Table::Old,
|  | const TSMOption & | = TSMOption() )

References lockOptions(), Old, and tableName().

## Table() [4/21]

casacore::Table::Table | ( | const String & | tableName,
|  | const String & | tableDescName,
|  | TableOption | = Table::Old,
|  | const TSMOption & | = TSMOption() )

References Old, and tableName().

## Table() [5/21]

casacore::Table::Table | ( | const String & | tableName,
|  | const String & | tableDescName,
|  | const TableLock & | lockOptions,
|  | TableOption | = Table::Old,
|  | const TSMOption & | = TSMOption() )

References lockOptions(), Old, and tableName().

## Table() [6/21]

casacore::Table::Table | ( | TableType | ,
|  | EndianFormat | = Table::AipsrcEndian,
|  | const TSMOption & | = TSMOption() )

explicit

Make a new empty table (plain (scratch) or memory type).

Columns should be added to make it a real one. Note that the endian format is only relevant for plain tables.

References AipsrcEndian.

## Table() [7/21]

casacore::Table::Table | ( | SetupNewTable & | ,
|  | rownr_t | nrrow = 0,
|  | Bool | initialize = False,
|  | EndianFormat | = Table::AipsrcEndian,
|  | const TSMOption & | = TSMOption() )

explicit

Make a table object for a new table, which can thereafter be used for reading and writing.

If there are unbound columns, default storage managers an/ord virtual column engines will be created and bound to those columns. Create the table with the given nr of rows. If a storage manager is used which does not allow addition of rows, the number of rows in the table must already be given here. Optionally the rows can be initialized with the default values as defined in the column descriptions. Locking options can be given (see class TableLock. The default locking mechanism is AutoLocking with a default inspection interval of 5 seconds.
The data will be stored in the given endian format.

References AipsrcEndian, and casacore::False.

## Table() [8/21]

casacore::Table::Table | ( | SetupNewTable & | ,
|  | TableType | ,
|  | rownr_t | nrrow = 0,
|  | Bool | initialize = False,
|  | EndianFormat | = Table::AipsrcEndian,
|  | const TSMOption & | = TSMOption() )

References AipsrcEndian, and casacore::False.

## Table() [9/21]

casacore::Table::Table | ( | SetupNewTable & | ,
|  | TableType | ,
|  | const TableLock & | lockOptions,
|  | rownr_t | nrrow = 0,
|  | Bool | initialize = False,
|  | EndianFormat | = Table::AipsrcEndian,
|  | const TSMOption & | = TSMOption() )

References AipsrcEndian, casacore::False, and lockOptions().

## Table() [10/21]

casacore::Table::Table | ( | SetupNewTable & | ,
|  | TableLock::LockOption | ,
|  | rownr_t | nrrow = 0,
|  | Bool | initialize = False,
|  | EndianFormat | = Table::AipsrcEndian,
|  | const TSMOption & | = TSMOption() )

References AipsrcEndian, and casacore::False.

## Table() [11/21]

casacore::Table::Table | ( | SetupNewTable & | ,
|  | const TableLock & | lockOptions,
|  | rownr_t | nrrow = 0,
|  | Bool | initialize = False,
|  | EndianFormat | = Table::AipsrcEndian,
|  | const TSMOption & | = TSMOption() )

References AipsrcEndian, casacore::False, and lockOptions().

## Table() [12/21]

casacore::Table::Table | ( | MPI_Comm | mpiComm,
|  | TableType | ,
|  | EndianFormat | = Table::AipsrcEndian,
|  | const TSMOption & | = TSMOption() )

explicit

References AipsrcEndian.

## Table() [13/21]

casacore::Table::Table | ( | MPI_Comm | mpiComm,
|  | SetupNewTable & | ,
|  | rownr_t | nrrow = 0,
|  | Bool | initialize = False,
|  | EndianFormat | = Table::AipsrcEndian,
|  | const TSMOption & | = TSMOption() )

explicit

References AipsrcEndian, and casacore::False.

## Table() [14/21]

casacore::Table::Table | ( | MPI_Comm | mpiComm,
|  | SetupNewTable & | ,
|  | TableType | ,
|  | rownr_t | nrrow = 0,
|  | Bool | initialize = False,
|  | EndianFormat | = Table::AipsrcEndian,
|  | const TSMOption & | = TSMOption() )

References AipsrcEndian, and casacore::False.

## Table() [15/21]

casacore::Table::Table | ( | MPI_Comm | mpiComm,
|  | SetupNewTable & | ,
|  | TableType | ,
|  | const TableLock & | lockOptions,
|  | rownr_t | nrrow = 0,
|  | Bool | initialize = False,
|  | EndianFormat | = Table::AipsrcEndian,
|  | const TSMOption & | = TSMOption() )

References AipsrcEndian, casacore::False, and lockOptions().

## Table() [16/21]

casacore::Table::Table | ( | MPI_Comm | mpiComm,
|  | SetupNewTable & | ,
|  | TableLock::LockOption | ,
|  | rownr_t | nrrow = 0,
|  | Bool | initialize = False,
|  | EndianFormat | = Table::AipsrcEndian,
|  | const TSMOption & | = TSMOption() )

References AipsrcEndian, and casacore::False.

## Table() [17/21]

casacore::Table::Table | ( | MPI_Comm | mpiComm,
|  | SetupNewTable & | ,
|  | const TableLock & | lockOptions,
|  | rownr_t | nrrow = 0,
|  | Bool | initialize = False,
|  | EndianFormat | = Table::AipsrcEndian,
|  | const TSMOption & | = TSMOption() )

References AipsrcEndian, casacore::False, and lockOptions().

## Table() [18/21]

casacore::Table::Table | ( | const Block< Table > & | tables,
|  | const Block< String > & | subTables = Block< String >(),
|  | const String & | subDirName = String() )

explicit

Create a table object as the virtual concatenation of one or more of existing tables.

The descriptions of all those tables must be exactly the same.
The keywordset of the virtual table is the set of the first table including its subtables. However, it is possible to specify the names of the subtables that have to be concantenated as well.
In this way a concatenation of multiple MS-s can be made, where it can be specified that, say, the SYSCAL table has to be concatenated too.
When a concatenated table is written and if a non-empty subDirName is given, the tables to be concatenated will be moved to that subdirectory in the directory of the concatenated table. This option is mainly used by the MSS structure used in CASA.
The only open options allowed are Old and Update. Locking options can be given (see class TableLock. They apply to all underlying tables. If a table was already opened in this process, the existing and new locking options are merged using TableLock::merge. The default locking mechanism is DefaultLocking. If the table is not open yet, it comes to AutoLocking with an inspection interval of 5 seconds. Otherwise DefaultLocking keeps the locking options of the already open table.

## Table() [19/21]

casacore::Table::Table | ( | const Block< String > & | tableNames,
|  | const Block< String > & | subTables = Block< String >(),
|  | TableOption | = Table::Old,
|  | const TSMOption & | = TSMOption(),
|  | const String & | subDirName = String() )

explicit

References Old.

## Table() [20/21]

casacore::Table::Table | ( | const Block< String > & | tableNames,
|  | const Block< String > & | subTables,
|  | const TableLock & | lockOptions,
|  | TableOption | = Table::Old,
|  | const TSMOption & | = TSMOption() )

References lockOptions(), and Old.

## Table() [21/21]

casacore::Table::Table | ( | const Table & |  | ) |

Copy constructor (reference semantics).

References Table().

## ~Table()

virtual casacore::Table::~Table | ( |  | ) |

virtual

The destructor flushes (i.e.

writes) the table if it is opened for output and not marked for delete. It will flush if the destructor is called due to an exception, because the Table object may not be correct. Of course, in that case the flush function could be called explicitly.
It is virtual, so an object of a derived class like MeasurementSet is destructed correctly through a Table pointer.

## Member Function Documentation

## actualTableDesc()

TableDesc casacore::Table::actualTableDesc | ( |  | ) | const

## addColumn() [1/5]

void casacore::Table::addColumn | ( | const ColumnDesc & | columnDesc,
|  | Bool | addToParent = True )

inline

Add a column to the table.

The data manager used for the column depend on the function used. Exceptions are thrown if the column already exist or if the table is not writable.
If this table is a reference table (result of selection) and if addToParent=True the column is also added to the parent table.

Use the first appropriate existing storage manager. If there is none, a data manager is created using the default data manager in the column description.

Definition at line 1225 of file Table.h.

## addColumn() [2/5]

void casacore::Table::addColumn | ( | const ColumnDesc & | columnDesc,
|  | const DataManager & | dataManager,
|  | Bool | addToParent = True )

inline

Use the given data manager (which is a new one).

Definition at line 1231 of file Table.h.

## addColumn() [3/5]

void casacore::Table::addColumn | ( | const ColumnDesc & | columnDesc,
|  | const String & | dataManager,
|  | Bool | byName,
|  | Bool | addToParent = True )

inline

Use an existing data manager with the given name or type.

If the flag byName is True, a name is given, otherwise a type. If a name is given, an exception is thrown if the data manager is unknown or does not allow addition of columns. If a type is given, a storage manager of the given type will be created if there is no such data manager allowing addition of rows.

Definition at line 1227 of file Table.h.

## addColumn() [4/5]

void casacore::Table::addColumn | ( | const TableDesc & | tableDesc,
|  | const DataManager & | dataManager,
|  | Bool | addToParent = True )

inline

Add a bunch of columns using the given new data manager.

All columns and possible hypercolumn definitions in the given table description will be copied and added to the table. This can be used in case of specific data managers which need to be created with more than one column (e.g. the tiled hypercube storage managers).
The data manager can be given directly or by means of a record describing the data manager in the standard way with the fields TYPE, NAME, and SPEC. The record can contain those fields itself or it can contain a single subrecord with those fields.
If this table is a reference table (result of selection) and if addToParent=True the columns are also added to the parent table.

Definition at line 1234 of file Table.h.

References tableDesc().

## addColumn() [5/5]

void casacore::Table::addColumn | ( | const TableDesc & | tableDesc,
|  | const Record & | dataManagerInfo,
|  | Bool | addToParent = True )

inline

Definition at line 1237 of file Table.h.

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

## addRow()

void casacore::Table::addRow | ( | rownr_t | nrrow = 1,
|  | Bool | initialize = False )

inline

Add one or more rows at the end of the table.

This will fail for tables not supporting addition of rows. Optionally the rows can be initialized with the default values as defined in the column descriptions.

Definition at line 1219 of file Table.h.

## canAddRow()

Bool casacore::Table::canAddRow | ( |  | ) | const

inline

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

It is possible if all storage managers used for the table support it.

Definition at line 1210 of file Table.h.

## canRemoveColumn() [1/2]

Bool casacore::Table::canRemoveColumn | ( | const String & | columnName | ) | const

Test if columns can be removed.

It can if the columns exist and if the data manager it is using supports removal of columns or if all columns from a data manager would be removed..
You can always remove columns from a reference table.

## canRemoveColumn() [2/2]

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

inline

Definition at line 1214 of file Table.h.

## canRemoveRow()

Bool casacore::Table::canRemoveRow | ( |  | ) | const

inline

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

It is possible if all storage managers used for the table support it.

Definition at line 1212 of file Table.h.

## canRenameColumn()

Bool casacore::Table::canRenameColumn | ( | const String & | columnName | ) | const

inline

Test if a column can be renamed.

Definition at line 1216 of file Table.h.

## changeTiledDataOnly()

void casacore::Table::changeTiledDataOnly | ( |  | ) |

inline

Indicate we will leave the table unchanged except for the values of the data in columns stored with a TiledShape storage manager.

This hint combined with TableLock::NoLocking and reopenRW() allows multiple processes to modify non-overlapping data in separate tiles to perform, e.g., flagging, calibration or continuum subtraction. If readonly subtable access is required, ensure they are opened in each process before reopenRW() is called.

Definition at line 1115 of file Table.h.

## closeSubTables()

void casacore::Table::closeSubTables | ( |  | ) | const

Close all open subtables.

## col() [1/2]

TableExprNode casacore::Table::col | ( | const String & | columnName | ) | const

References TableExprNode.

Referenced by casacore::MSSelectableTable::col(), and casacore::MSTable< MSEnum >::colMapDef().

## col() [2/2]

TableExprNode casacore::Table::col | ( | const String & | columnName,
|  | const Vector< String > & | fieldNames ) const

References TableExprNode.

## copy()

void casacore::Table::copy | ( | const String & | newName,
|  | TableOption | ,
|  | Bool | noRows = False ) const

Copy the table and all its subtables.

Especially for RefTables copy and deepCopy behave differently. copy makes a bitwise copy of the table, thus the result is still a RefTable. On the other hand deepCopy makes a physical copy of all referenced table rows and columns, thus the result is a PlainTable.
For PlainTables deepCopy is the same as copy unless valueCopy==True is given. In that case the values are copied which takes longer, but reorganizes the data files to get rid of gaps in the data. Also if specific DataManager info is given or if no rows have to be copied, a deep copy is made.
The following options can be given:

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

The new table gets the given endian format. Note that the endian option is only used if a true deep copy of a table is made.
When making a deep copy, it is possible to specify the data managers using the dataManagerInfo argument. See getDataManagerInfo for more info about that record.
If noRows=True no rows are copied. Also no rows are copied in all subtables. It is useful if one wants to make a copy of only the Table structure.

References casacore::False.

## copyToMemoryTable()

Table casacore::Table::copyToMemoryTable | ( | const String & | name,
|  | Bool | noRows = False ) const

Make a copy of a table to a MemoryTable object.

Use the given name for the memory table.

References casacore::False, casacore::name(), and Table().

## dataManagerInfo()

Record casacore::Table::dataManagerInfo | ( |  | ) | const

Return all data managers used and the columns served by them.

The info is returned in a record. It contains a subrecord per data manager. Each subrecord contains the following fields:

TYPE
  a string giving the type of the data manager.
NAME
  a string giving the name of the data manager.
COLUMNS
  a vector of strings giving the columns served by the data manager.

Data managers may return some additional fields (e.g. BUCKETSIZE).

References casacore::Record().

Referenced by addColumn(), deepCopy(), deepCopy(), deepCopy(), and rowNumbers().

## deepCopy() [1/3]

void casacore::Table::deepCopy | ( | const String & | newName,
|  | const Record & | dataManagerInfo,
|  | const StorageOption & | stopt,
|  | TableOption | option,
|  | Bool | valueCopy = False,
|  | EndianFormat | endianFormat = AipsrcEndian,
|  | Bool | noRows = False ) const

inline

Definition at line 1170 of file Table.h.

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

## deepCopy() [2/3]

void casacore::Table::deepCopy | ( | const String & | newName,
|  | const Record & | dataManagerInfo,
|  | TableOption | option,
|  | Bool | valueCopy = False,
|  | EndianFormat | endianFormat = AipsrcEndian,
|  | Bool | noRows = False ) const

inline

Definition at line 1161 of file Table.h.

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

## deepCopy() [3/3]

void casacore::Table::deepCopy | ( | const String & | newName,
|  | TableOption | ,
|  | Bool | valueCopy = False,
|  | EndianFormat | = AipsrcEndian,
|  | Bool | noRows = False ) const

References AipsrcEndian, dataManagerInfo(), casacore::False, and casacore::Record().

## endianFormat()

Table::EndianFormat casacore::Table::endianFormat | ( |  | ) | const

Get the endian format in which the table is stored.

Referenced by deepCopy(), and deepCopy().

## fileName()

String casacore::Table::fileName | ( | const String & | tableName | ) |

static

Make the table file name.

References tableName().

## findDataManager()

DataManager * casacore::Table::findDataManager | ( | const String & | name,
|  | Bool | byColumn = False ) const

inline

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

Definition at line 1246 of file Table.h.

References casacore::name().

## flush()

void casacore::Table::flush | ( | Bool | fsync = False,
|  | Bool | recursive = False )

inline

Flush the table, i.e.

write out the buffers. If sync=True, it is ensured that all data are physically written to disk. Nothing will be done if the table is not writable. At any time a flush can be executed, even if the table is marked for delete. If the table is marked for delete, the destructor will remove files written by intermediate flushes. Note that if necessary the destructor will do an implicit flush, unless it is executed due to an exception.
If fsync=True the file contents are fsync-ed to disk, thus ensured that the system buffers are actually written to disk.
If recursive=True all subtables are flushed too.

Definition at line 1117 of file Table.h.

## flushTableInfo()

void casacore::Table::flushTableInfo | ( |  | ) | const

inline

Write the TableInfo object.

Usually this is not necessary, because it is done automatically when the table gets written (by table destructor or flush function). This function is only useful if the table info has to be written before the table gets written (e.g. when another process reads the table while it gets filled).

Definition at line 1200 of file Table.h.

## getLockedTables()

Vector< String > casacore::Table::getLockedTables | ( | FileLocker::LockType | = FileLocker::Read,
|  | int | lockOption = -1 )

static

Get the names of tables locked in this process.

By default all locked tables are given (note that a write lock implies a read lock), but it is possible to select on lock type FileLocker::Write and on option (TableLock::AutoLocking, TableLock::ReadLocking, or TableLock::PermanentLocking).

References casacore::FileLocker::Read.

## getPartNames()

Block< String > casacore::Table::getPartNames | ( | Bool | recursive = False | ) | const

Get the names of the tables this table consists of.

For a plain table it returns its name, for a RefTable the name of the parent, and for a ConcatTable the names of all its parts.
Note that a part can be any type of table (e.g. a ConcatTable). The recursive switch tells how to deal with that.

References casacore::False.

## getTableKeyword()

void casacore::Table::getTableKeyword | ( | AipsIO & | ,
|  | Bool | openWritable )

Read a table from AipsIO (for TableKeywords).

This will read the table name and open the table as writable if the switch is set and if the table file is writable. otherwise it is opened as readonly.

## hasDataChanged()

Bool casacore::Table::hasDataChanged | ( |  | ) |

Determine if column or keyword table data have changed (or is being changed) since the last time this function was called.

References casacore::False.

## hasLock() [1/2]

Bool casacore::Table::hasLock | ( | Bool | write | ) | const

inline

Definition at line 1139 of file Table.h.

References casacore::FileLocker::Read, casacore::FileLocker::Write, and casacore::write().

## hasLock() [2/2]

Bool casacore::Table::hasLock | ( | FileLocker::LockType | type = FileLocker::Write | ) | const

inline

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

Definition at line 1137 of file Table.h.

## isColumnStored() [1/2]

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

inline

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

Definition at line 1154 of file Table.h.

## isColumnStored() [2/2]

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

inline

Definition at line 1156 of file Table.h.

## isColumnWritable() [1/2]

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

inline

Test if the given column is writable.

Definition at line 1149 of file Table.h.

Referenced by casacore::MSTable< MSEnum >::isColumnWritable(), and casacore::MSTable< MSEnum >::isColumnWritable().

## isColumnWritable() [2/2]

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

inline

Definition at line 1151 of file Table.h.

## isMarkedForDelete()

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

inline

Test if the table is marked for delete.

Definition at line 1184 of file Table.h.

## isMultiUsed()

Bool casacore::Table::isMultiUsed | ( | Bool | checkSubTables = False | ) | const

inline

Is the table used (i.e.

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

Definition at line 1124 of file Table.h.

## isNativeDataType()

Bool casacore::Table::isNativeDataType | ( | DataType | dtype | ) |

static

Test if the given data type is native to the table system.

If not, a virtual column engine is needed to store data with that type. With the function DataType::whatType it can be used in a templated function like:

if (Table::isNativeDataType (whatType(static_cast<T*>(0)))) {
casacore::Table::isNativeDataType
static Bool isNativeDataType(DataType dtype)
Test if the given data type is native to the table system.

## isNull()

Bool casacore::Table::isNull | ( |  | ) | const

inline

Test if the object is null, i.e.

does not reference a proper table. This is the case if the default constructor is used.

Definition at line 489 of file Table.h.

References casacore::True.

Referenced by casacore::MSTable< MSEnum >::validate().

## isOpened()

Bool casacore::Table::isOpened | ( | const String & | tableName | ) |

static

Is the table used (i.e.

open) in this process.

References casacore::False, tableName(), casacore::FileLocker::Write, and casacore::write().

## isReadable()

Bool casacore::Table::isReadable | ( | const String & | tableName,
|  | bool | throwIf = False )

static

Test if a table with the given name exists and is readable.

If not, an exception is thrown if throwIf==True.

References casacore::False, tableName(), and casacore::True.

## isRootTable()

Bool casacore::Table::isRootTable | ( |  | ) | const

inline

Test if this table is the root table (ie.

if it is not the subset of another table).

Definition at line 1144 of file Table.h.

## isSameRoot()

Bool casacore::Table::isSameRoot | ( | const Table & | other | ) | const

inline

Is the root table of this table the same as that of the other one?

Definition at line 1110 of file Table.h.

References isSameRoot(), casacore::BaseTable::root(), and Table().

Referenced by isSameRoot().

## isSameTable()

Bool casacore::Table::isSameTable | ( | const Table & | other | ) | const

inline

Is this table the same as the other?

Definition at line 379 of file Table.h.

References Table().

## isWritable() [1/2]

Bool casacore::Table::isWritable | ( |  | ) | const

inline

Test if this table is opened as writable.

Definition at line 1147 of file Table.h.

## isWritable() [2/2]

Bool casacore::Table::isWritable | ( | const String & | tableName,
|  | bool | throwIf = False )

static

Test if a table with the given name exists and is writable.

References casacore::False, and tableName().

## key() [1/2]

TableExprNode casacore::Table::key | ( | const String & | keywordName | ) | const

Create a TableExprNode object for a column or for a keyword in the table keyword set.

This can be used in selecting rows from a table using operator() described below.
The functions taking the fieldNames vector are meant for the cases where the keyword or column contains records. The fieldNames indicate which field to take from that record (which can be a record again, etc.).

References TableExprNode.

Referenced by casacore::MSTable< MSEnum >::addKeyToDesc(), casacore::MSTable< MSEnum >::addKeyToDesc(), and casacore::MSTable< MSEnum >::keyMapDef().

## key() [2/2]

TableExprNode casacore::Table::key | ( | const Vector< String > & | fieldNames | ) | const

References TableExprNode.

## keywordSet()

const TableRecord & casacore::Table::keywordSet | ( |  | ) | const

inline

Get readonly access to the table keyword set.

If UserLocking is used, it will automatically acquire and release a read lock if the table is not locked.

Definition at line 1193 of file Table.h.

## lock() [1/2]

Bool casacore::Table::lock | ( | Bool | write,
|  | uInt | nattempts = 0 )

inline

Definition at line 1130 of file Table.h.

References casacore::FileLocker::Read, casacore::FileLocker::Write, and casacore::write().

## lock() [2/2]

Bool casacore::Table::lock | ( | FileLocker::LockType | type = FileLocker::Write,
|  | uInt | nattempts = 0 )

inline

Try to lock the table for read or write access (default is write).

The number of attempts (default = forever) can be specified when acquiring the lock does not succeed immediately. If nattempts>1, the system waits 1 second between each attempt, so nattempts is more or less equal to a wait period in seconds. The return value is false if acquiring the lock failed. If PermanentLocking is in effect, a lock is already present, so nothing will be done.

Definition at line 1128 of file Table.h.

## lockOptions()

const TableLock & casacore::Table::lockOptions | ( |  | ) | const

inline

Get the locking options.

Definition at line 1126 of file Table.h.

Referenced by casacore::MeasurementSet::MeasurementSet(), casacore::MeasurementSet::MeasurementSet(), casacore::MeasurementSet::MeasurementSet(), casacore::MeasurementSet::MeasurementSet(), casacore::MeasurementSet::MeasurementSet(), casacore::MSTable< MSEnum >::MSTable(), casacore::MSTable< MSEnum >::MSTable(), casacore::MSTable< MSEnum >::MSTable(), casacore::MSTable< MSEnum >::MSTable(), operator<<, Table(), Table(), Table(), Table(), Table(), Table(), and Table().

## markForDelete()

void casacore::Table::markForDelete | ( |  | ) |

inline

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.

Definition at line 1180 of file Table.h.

References casacore::True.

## nAutoLocks()

uInt casacore::Table::nAutoLocks | ( |  | ) |

static

Determine the number of locked tables opened with the AutoLock option (Locked table means locked for read and/or write).

## nodeRandom()

TableExprNode casacore::Table::nodeRandom | ( |  | ) | const

Create a TableExprNode object for the rand function.

References TableExprNode.

## nodeRownr()

TableExprNode casacore::Table::nodeRownr | ( | rownr_t | origin = 0 | ) | const

Create a TableExprNode object for the rownumber function.

'origin' Indicates which rownumber is the first. C++ uses origin = 0 (default) Glish and TaQL both use origin = 1

References TableExprNode.

## nonWritableFiles()

Vector< String > casacore::Table::nonWritableFiles | ( | const String & | tableName | ) |

static

Find the non-writable files in a table.

References tableName().

## nrow()

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

inline

Get the number of rows.

It is unsynchronized meaning that it will not check if another process updated the table, thus possible increased the number of rows. If one wants to take that into account, he should acquire a read-lock (using the lock function) before using nrow().

Definition at line 1187 of file Table.h.

Referenced by casacore::MSValidIds::checkResult(), and casacore::TableCopy::copyRows().

## operator!()

Table casacore::Table::operator! | ( |  | ) | const

Take complement.

References Table().

## operator&()

Table casacore::Table::operator& | ( | const Table & |  | ) | const

Do logical operations on a table.

It can be used for row-selected or projected (i.e. column-selected) tables. The tables involved must come from the same root table or be the root table themselves.

Intersection with another table.

References Table().

## operator()() [1/3]

Table casacore::Table::operator() | ( | const Block< Bool > & | mask | ) | const

Select rows using a mask block.

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

References casacore::mask(), and Table().

## operator()() [2/3]

Table casacore::Table::operator() | ( | const RowNumbers & | rownrs | ) | const

Select rows using a vector of row numbers.

This can, for instance, be used to select the same rows as were selected in another table (using the rowNumbers function).

Table result = thisTable (otherTable.rowNumbers());

References Table().

## operator()() [3/3]

Table casacore::Table::operator() | ( | const TableExprNode & | ,
|  | rownr_t | maxRow = 0,
|  | rownr_t | offset = 0 ) const

Select rows from a table using an select expression consisting of TableExprNode objects.

Basic TableExprNode objects can be created with the functions key and especially col. Composite TableExprNode objects, representing an expression, can be created by applying operations (like == and +) to the basic ones. This is described in class TableExprNode. For example:

Table result = tab(tab.col("columnName") > 10);

All rows for which the expression is true, will be selected and "stored" in the result. You need to include ExprNode.h for this purpose.
The first offset matching rows will be skipped.
If maxRow>0, the selection process will stop when maxRow rows are selected.
The TableExprNode argument can be empty (null) meaning that only the maxRow/offset arguments are taken into account.

References casacore::offset(), Table(), and TableExprNode.

## operator-()

Table casacore::Table::operator- | ( | const Table & |  | ) | const

Subtract another table.

References Table().

## operator=()

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

Assignment (reference semantics).

References Table().

## operator^()

Table casacore::Table::operator^ | ( | const Table & |  | ) | const

Xor with another table.

References Table().

## operator|()

Table casacore::Table::operator| | ( | const Table & |  | ) | const

Union with another table.

References Table().

## project()

Table casacore::Table::project | ( | const Block< String > & | columnNames | ) | const

Project the given columns (i.e.

select the columns).

References Table().

## relinquishAutoLocks()

void casacore::Table::relinquishAutoLocks | ( | Bool | all = False | ) |

static

Unlock locked tables opened with the AutoLock option.

If all=True all such tables will be unlocked. If all=False only tables requested by another process will be unlocked.

References casacore::all(), and casacore::False.

## removeColumn() [1/2]

void casacore::Table::removeColumn | ( | const String & | columnName | ) |

Remove columns.

When removing columns from a reference table, the columns are NOT removed from the underlying table.

## removeColumn() [2/2]

void casacore::Table::removeColumn | ( | const Vector< String > & | columnName | ) |

inline

Definition at line 1239 of file Table.h.

## removeRow() [1/2]

void casacore::Table::removeRow | ( | const RowNumbers & | rownrs | ) |

inline

Definition at line 1223 of file Table.h.

## removeRow() [2/2]

void casacore::Table::removeRow | ( | rownr_t | rownr | ) |

inline

Remove the given row(s).

The latter form can be useful with the select and rowNumbers functions to remove some selected rows from the table.
It will fail for tables not supporting removal of rows.
Warning: 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::Table::removeRow
void removeRow(rownr_t rownr)
Remove the given row(s).
Definition Table.h:1221
casacore::Vector
Definition Vector.h:82

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

Definition at line 1221 of file Table.h.

## rename()

void casacore::Table::rename | ( | const String & | newName,
|  | TableOption | option )

inline

Rename the table and all its subtables.

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
  If a table with this name exists, it will be overwritten. When succesfully renamed, the table is unmarked for delete (if necessary).
Table::NewNoReplace
  If 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 scratchCallback function is called when needed.

Definition at line 1159 of file Table.h.

## renameColumn()

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

inline

Rename a column.

An exception is thrown if the old name does not exist or if the name already exists.
Caution: Renaming a column should be done with care, because other columns may be referring this column; Also a hypercolumn definition might be using the old name; Finally if may also invalidate persistent selections of a table, because the reference table cannot find the column anymore;

Definition at line 1241 of file Table.h.

## renameHypercolumn()

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

inline

Definition at line 1243 of file Table.h.

## reopenRW()

void casacore::Table::reopenRW | ( |  | ) |

inline

Try to reopen the table for read/write access.

An exception is thrown if the table is not writable. Nothing is done if the table is already open for read/write.

Definition at line 1113 of file Table.h.

References casacore::BaseTable::reopenRW().

## resync()

void casacore::Table::resync | ( |  | ) |

inline

Resynchronize the Table object with the table file.

This function is only useful if no read-locking is used, ie. if the table lock option is UserNoReadLocking or AutoNoReadLocking. In that cases the table system does not acquire a read-lock, thus does not synchronize itself automatically.

Definition at line 1119 of file Table.h.

## rowNumbers() [1/2]

RowNumbers casacore::Table::rowNumbers | ( |  | ) | const

Get a vector of row numbers in the root table of rows in this table.

In case the table is a subset of the root table, this tells which rows of the root table are part of the subset. In case the table is the root table itself, the result is a vector containing the row numbers 0.. #rows-1.
Note that in general it is better to use the next rowNumbers(Table) function.

## rowNumbers() [2/2]

RowNumbers casacore::Table::rowNumbers | ( | const Table & | that,
|  | Bool | tryFast = False ) const

Get a vector of row numbers in that table of rows in this table.

In case the table is a subset of that table, this tells which rows of that table are part of the subset. In case the table is that table itself, the result is a vector containing the row numbers 0.. #rows-1.
Caution: This function is in principle meant for cases where this table is a subset of that table; However, it can be used for any table; In that case the returned vector contains a very high number (max_uint) for rows in this table not part of that table; In that way they are invalid if used elsewhere;
In the general case creating the row number vector can be slowish, because it has to do two mappings; However, if this table is a subset of that table and if they are in the same order, the mapping can be done in a more efficient way; The argument tryFast can be used to tell the function to try a fast conversion first; If that cannot be done, it reverts to the slower way at the expense of an unsuccessful fast attempt;

Table tab("somename");
Table subset = tab(some_select_expression);
RowNumbers rownrs = subset.rowNumbers(tab);
casacore::RowNumbers
Definition RowNumbers.h:36
casacore::Table::rowNumbers
RowNumbers rowNumbers() const
Get a vector of row numbers in the root table of rows in this table.

Note that one cannot be sure that table "somename" is the root (i.e. original) table. It may also be a subset of another table. In the latter case doing
RowNumbers rownrs = subset.rowNumbers() does not give the row numbers in tab, but in the root table (which is probably not what you want).

References dataManagerInfo(), casacore::False, casacore::Record(), Table(), tableDesc(), and casacore::True.

## rwKeywordSet()

TableRecord & casacore::Table::rwKeywordSet | ( |  | ) |

Get read/write access to the table keyword set.

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

## setScratchCallback()

ScratchCallback * casacore::Table::setScratchCallback | ( | ScratchCallback * |  | ) |

static

Set the pointer to the ScratchCallback function.

It returns the current value of the pointer. This function is called when changing the state of a table (i.e. create, close, rename, (un)markForDelete).

## showKeywords()

void casacore::Table::showKeywords | ( | std::ostream & | ,
|  | Bool | showSubTables = False,
|  | Bool | showTabKey = True,
|  | Bool | showColKey = False,
|  | Int | maxVal = 25 ) const

Show the table and/or column keywords, possibly also of all subtables.

Maximum maxVal values of Arrays will be shown.

References casacore::False, and casacore::True.

## showKeywordSets()

void casacore::Table::showKeywordSets | ( | std::ostream & | ,
|  | Bool | showTabKey,
|  | Bool | showColKey,
|  | Int | maxVal ) const

Show the table and/or column keywords of this table.

Maximum maxVal values of Arrays will be shown.

## showStructure()

void casacore::Table::showStructure | ( | std::ostream & | os,
|  | Bool | showDataMans = True,
|  | Bool | showColumns = True,
|  | Bool | showSubTables = False,
|  | Bool | sortColumns = False,
|  | Bool | cOrder = False ) const

inline

Show the structure of the table.

It shows the columns (with types), the data managers, and the subtables. Optionally the columns can be sorted alphabetically.

Definition at line 1252 of file Table.h.

## sort() [1/4]

Table casacore::Table::sort | ( | const Block< String > & | columnNames,
|  | const Block< Int > & | sortOrders,
|  | int | = Sort::ParSort ) const

Sort on multiple columns.

The principal column has to be the first element in the Block of column names. The order can be given per column.

References casacore::Sort::ParSort, and Table().

## sort() [2/4]

Table casacore::Table::sort | ( | const Block< String > & | columnNames,
|  | const Block< std::shared_ptr< BaseCompare > > & | compareObjects,
|  | const Block< Int > & | sortOrders,
|  | int | = Sort::ParSort ) const

Sort on multiple columns.

The principal column has to be the first element in the Block of column names. The order can be given per column. Provide some special comparisons via std::shared_ptrs of compare objects. A null std::shared_ptr means using the standard compare object from class ObjCompare.

References casacore::Sort::ParSort, and Table().

## sort() [3/4]

Table casacore::Table::sort | ( | const Block< String > & | columnNames,
|  | int | = Sort::Ascending,
|  | int | = Sort::ParSort ) const

Sort on multiple columns.

The principal column has to be the first element in the Block of column names.

References casacore::Sort::Ascending, casacore::Sort::ParSort, and Table().

## sort() [4/4]

Table casacore::Table::sort | ( | const String & | columnName,
|  | int | = Sort::Ascending,
|  | int | = Sort::ParSort ) const

Sort a table on one or more columns of scalars.

Per column a compare function can be provided. By default the standard compare function defined in Compare.h will be used. Default sort order is ascending. Default sorting algorithm is the parallel sort.

Sort on one column.

References casacore::Sort::Ascending, casacore::Sort::ParSort, and Table().

Referenced by operator<<.

## storageOption()

const StorageOption & casacore::Table::storageOption | ( |  | ) | const

inline

Get the storage option used for the table.

Definition at line 1122 of file Table.h.

## tableDesc()

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

inline

Get the table description.

This can be used to get nr of columns, etc.. tableDesc() gives the table description used when constructing the table, while actualTableDesc() gives the actual description, thus with the actual data managers used.

Definition at line 1191 of file Table.h.

Referenced by addColumn(), addColumn(), rowNumbers(), and casacore::MSTable< MSEnum >::validate().

## tableInfo() [1/2]

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

inline

Definition at line 1198 of file Table.h.

## tableInfo() [2/2]

const TableInfo & casacore::Table::tableInfo | ( |  | ) | const

inline

Get access to the TableInfo object.

Definition at line 1196 of file Table.h.

Referenced by operator<<.

## tableName()

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

inline

Get the table name.

Definition at line 1203 of file Table.h.

Referenced by fileName(), isOpened(), isReadable(), isWritable(), casacore::MeasurementSet::MeasurementSet(), casacore::MeasurementSet::MeasurementSet(), casacore::MeasurementSet::MeasurementSet(), casacore::MeasurementSet::MeasurementSet(), casacore::MeasurementSet::MeasurementSet(), casacore::MSAntenna::MSAntenna(), casacore::MSAntenna::MSAntenna(), casacore::MSDataDescription::MSDataDescription(), casacore::MSDataDescription::MSDataDescription(), casacore::MSDoppler::MSDoppler(), casacore::MSDoppler::MSDoppler(), casacore::MSFeed::MSFeed(), casacore::MSFeed::MSFeed(), casacore::MSField::MSField(), casacore::MSField::MSField(), casacore::MSFlagCmd::MSFlagCmd(), casacore::MSFlagCmd::MSFlagCmd(), casacore::MSFreqOffset::MSFreqOffset(), casacore::MSFreqOffset::MSFreqOffset(), casacore::MSHistory::MSHistory(), casacore::MSHistory::MSHistory(), casacore::MSObservation::MSObservation(), casacore::MSObservation::MSObservation(), casacore::MSPointing::MSPointing(), casacore::MSPointing::MSPointing(), casacore::MSPolarization::MSPolarization(), casacore::MSPolarization::MSPolarization(), casacore::MSProcessor::MSProcessor(), casacore::MSProcessor::MSProcessor(), casacore::MSSource::MSSource(), casacore::MSSource::MSSource(), casacore::MSSpectralWindow::MSSpectralWindow(), casacore::MSSpectralWindow::MSSpectralWindow(), casacore::MSState::MSState(), casacore::MSState::MSState(), casacore::MSSysCal::MSSysCal(), casacore::MSSysCal::MSSysCal(), casacore::MSTable< MSEnum >::MSTable(), casacore::MSTable< MSEnum >::MSTable(), casacore::MSTable< MSEnum >::MSTable(), casacore::MSTable< MSEnum >::MSTable(), casacore::MSWeather::MSWeather(), casacore::MSWeather::MSWeather(), nonWritableFiles(), operator<<, Table(), Table(), Table(), and Table().

## tableOption()

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

inline

Get the table option.

Definition at line 1207 of file Table.h.

Referenced by operator<<.

## tableType()

Table::TableType casacore::Table::tableType | ( |  | ) | const

inline

Get the table type.

Definition at line 1205 of file Table.h.

## throwIfNull()

void casacore::Table::throwIfNull | ( |  | ) | const

Throw an exception if the object is null, i.e.

if function isNull() is True.

## unlock()

void casacore::Table::unlock | ( |  | ) |

inline

Unlock the table.

This will also synchronize the table data, thus force the data to be written to disk. If PermanentLocking is in effect, nothing will be done.

Definition at line 1135 of file Table.h.

## unmarkForDelete()

void casacore::Table::unmarkForDelete | ( |  | ) |

inline

Unmark the table for delete.

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

Definition at line 1182 of file Table.h.

References casacore::True.

## Friends And Related Symbol Documentation

## BaseTable

friend class BaseTable

friend

Definition at line 159 of file Table.h.

References BaseTable.

Referenced by BaseTable, and operator<<.

## ConcatTable

friend class ConcatTable

friend

Definition at line 163 of file Table.h.

References ConcatTable.

Referenced by ConcatTable.

## MemoryTable

friend class MemoryTable

friend

Definition at line 161 of file Table.h.

References MemoryTable.

Referenced by MemoryTable.

## operator<< [1/2]

AipsIO & operator<< | ( | AipsIO & | ,
|  | const Table & | )

friend

Write a table to AipsIO (for TypedKeywords<Table>).

This will only write the table name.

References Table().

## operator<< [2/2]

ostream & operator<< | ( | ostream & | ,
|  | const Table & | )

friend

Write a table to ostream (for TypedKeywords<Table>).

This only shows its name and number of columns and rows.

References BaseTable, casacore::False, lockOptions(), casacore::name(), Old, sort(), Table(), tableInfo(), tableName(), and tableOption().

## operator>>

AipsIO & operator>> | ( | AipsIO & | ,
|  | Table & | )

friend

Read a table from AipsIO (for TypedKeywords<Table>).

This will read the table name and open the table as writable if the table file is writable, otherwise as readonly.

References Table().

## PlainTable

friend class PlainTable

friend

Definition at line 160 of file Table.h.

References PlainTable.

Referenced by PlainTable.

## RefTable

friend class RefTable

friend

Definition at line 162 of file Table.h.

References RefTable.

Referenced by RefTable.

## RODataManAccessor

friend class RODataManAccessor

friend

Definition at line 165 of file Table.h.

References RODataManAccessor.

Referenced by RODataManAccessor.

## TableColumn

friend class TableColumn

friend

Definition at line 158 of file Table.h.

References TableColumn.

Referenced by TableColumn.

## TableExprNode

friend class TableExprNode

friend

Definition at line 166 of file Table.h.

References TableExprNode.

Referenced by col(), col(), key(), key(), nodeRandom(), nodeRownr(), operator()(), and TableExprNode.

## TableExprNodeRep

friend class TableExprNodeRep

friend

Definition at line 167 of file Table.h.

References TableExprNodeRep.

Referenced by TableExprNodeRep.

## TableIterator

friend class TableIterator

friend

Definition at line 164 of file Table.h.

References TableIterator.

Referenced by TableIterator.

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

- tables/Tables/Table.h