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

More...

`#include <NullTable.h>`

## Public Member Functions

| NullTable ()
| Default constructor.
virtual | ~NullTable ()
| NullTable (const NullTable &)=delete
| Copy constructor is forbidden.
NullTable & | operator= (const NullTable &)=delete
| Assignment is forbidden.
virtual Bool | isNull () const override
| The table is a null table.
virtual void | reopenRW () override
| All functions throw a "null table" exception.
virtual Bool | asBigEndian () const override
| Is the table stored in big or little endian format?
virtual const StorageOption & | storageOption () const override
| Get the storage option used for the table.
virtual Bool | isMultiUsed (Bool checkSubTable) const override
| Is the table in use (i.e.
virtual const TableLock & | lockOptions () const override
| Get the locking info.
virtual void | mergeLock (const TableLock &lockOptions) override
| Merge the given lock info with the existing one.
virtual Bool | hasLock (FileLocker::LockType) const override
| Has this process the read or write lock, thus can the table be read or written safely?
virtual Bool | lock (FileLocker::LockType, uInt nattempts) override
| Try to lock the table for read or write access.
virtual void | unlock () override
| Unlock the table.
virtual void | flush (Bool fsync, Bool recursive) override
| Flush the table, i.e.
virtual void | resync () override
| Resync the Table object with the table file.
virtual uInt | getModifyCounter () const override
| Get the modify counter.
virtual Bool | isWritable () const override
| Test if this table is writable.
virtual void | deepCopy (const String &newName, const Record &dataManagerInfo, const StorageOption &, int tableOption, Bool valueCopy, int endianFormat, Bool noRows) const override
virtual TableDesc | actualTableDesc () const override
| Get the actual table description.
virtual Record | dataManagerInfo () const override
| Get the data manager info.
virtual TableRecord & | keywordSet () override
| Get readonly access to the table keyword set.
virtual TableRecord & | rwKeywordSet () override
| Get read/write access to the table keyword set.
virtual BaseColumn * | getColumn (uInt columnIndex) const override
| Get a column object using its index.
virtual BaseColumn * | getColumn (const String &columnName) const override
| Get a column object using its name.
virtual Bool | canAddRow () const override
| Test if it is possible to add a row to this table.
virtual void | addRow (rownr_t nrrow, Bool initialize) override
| Add one or more rows and possibly initialize them.
virtual Bool | canRemoveRow () const override
| Test if it is possible to remove a row from this table.
virtual void | removeRow (rownr_t rownr) override
| Remove rows.
virtual DataManager * | findDataManager (const String &name, Bool byColumn) const override
| Find the data manager with the given name or for the given column.
virtual void | addColumn (const ColumnDesc &columnDesc, Bool addToParent) override
| Add one or more columns to the table.
virtual void | addColumn (const ColumnDesc &columnDesc, const String &dataManager, Bool byName, Bool addToParent) override
virtual void | addColumn (const ColumnDesc &columnDesc, const DataManager &dataManager, Bool addToParent) override
virtual void | addColumn (const TableDesc &tableDesc, const DataManager &dataManager, Bool addToParent) override
virtual Bool | canRemoveColumn (const Vector< String > &columnNames) const override
| Test if columns can be removed.
virtual void | removeColumn (const Vector< String > &columnNames) override
| Remove columns.
virtual Bool | canRenameColumn (const String &columnName) const override
| Test if a column can be renamed.
virtual void | renameColumn (const String &newName, const String &oldName) override
| Rename a column.
virtual void | renameHypercolumn (const String &newName, const String &oldName) override
| Rename a hypercolumn.
virtual Vector< rownr_t > | rowNumbers () const override
| Get a vector of row numbers.
virtual BaseTable * | root () override
| Get pointer to root table (i.e.
virtual Bool | rowOrder () const override
| Tell if the table is in row order.
virtual Vector< rownr_t > & | rowStorage () override
| By the default the table cannot return the storage of rownrs.
virtual Bool | adjustRownrs (rownr_t nrrow, Vector< rownr_t > &rownrs, Bool determineOrder) const override
| Adjust the row numbers to be the actual row numbers in the root table.
virtual std::shared_ptr< BaseTable > | doSort (PtrBlock< BaseColumn * > &, const Block< std::shared_ptr< BaseCompare > > &, const Block< Int > &, int, std::shared_ptr< Vector< rownr_t > >, std::shared_ptr< Vector< size_t > >) override
| Do the actual sort.
virtual void | renameSubTables (const String &newName, const String &oldName) override
| Rename the subtables (used by rename function).
Public Member Functions inherited from casacore::BaseTable
| 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 void | changeTiledDataOnly ()
| Indicate we will only modify data values in existing tiled columns.
virtual void | setTableChanged ()
| Set the table to being changed.
void | doNotWrite ()
| Do not write the table (used in in case of exceptions).
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 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.
void | showStructure (std::ostream &, Bool showDataMan, Bool showColumns, Bool showSubTables, Bool sortColumns, Bool cOrder)
| Show the table structure (implementation of Table::showStructure).
TableInfo & | tableInfo ()
| Get access to the TableInfo object.
virtual void | flushTableInfo ()
| Write the TableInfo object.
rownr_t | nrow () const
| Get number of rows.
void | removeRow (const Vector< rownr_t > &rownrs)
void | removeRow (const Vector< uInt > &rownrs)
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.
void | addColumns (const TableDesc &tableDesc, const Record &dmInfo, Bool addToParent)
| Add one or more columns to the table.
Bool | checkRemoveColumn (const Vector< String > &columnNames, Bool throwException) const
| Check if the set of columns can be removed.
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.

## Private Member Functions

TableError | makeError (const String &name) const
| Make an exception message with the name of the function.

## Additional Inherited Members

Static Public Member Functions inherited from casacore::BaseTable
static TableInfo | tableInfo (const String &tableName)
| Get the table info of the table with the given name.
Protected Member Functions inherited from casacore::BaseTable
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.
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 inherited from casacore::BaseTable
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

## Detailed Description

Class indicating a null Table object

### Intended use:

Internal

### Review Status

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

### Prerequisite

- BaseTable

### Etymology

NullTable represents a null table object, i.e. a Table object without an underlying table.

### Synopsis

NullTable is used to represent a null table. The default Table constructor used to a create a null pointer which resulted in core dumps when the Table object was actually used. The NullTable object makes it possible to catch such cases and throw an appropriate exception.

Definition at line 66 of file NullTable.h.

## Constructor & Destructor Documentation

## NullTable() [1/2]

casacore::NullTable::NullTable | ( |  | ) |

Default constructor.

Referenced by NullTable(), and operator=().

## ~NullTable()

virtual casacore::NullTable::~NullTable | ( |  | ) |

virtual

## NullTable() [2/2]

casacore::NullTable::NullTable | ( | const NullTable & |  | ) |

delete

Copy constructor is forbidden.

References NullTable().

## Member Function Documentation

## actualTableDesc()

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

override virtual

Get the actual table description.

Implements casacore::BaseTable.

## addColumn() [1/4]

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

override virtual

Add one or more columns to the table.

The default implementation throws an "invalid operation" exception.

Reimplemented from casacore::BaseTable.

## addColumn() [2/4]

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

override virtual

Reimplemented from casacore::BaseTable.

## addColumn() [3/4]

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

override virtual

Reimplemented from casacore::BaseTable.

## addColumn() [4/4]

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

override virtual

Reimplemented from casacore::BaseTable.

References casacore::BaseTable::tableDesc().

## addRow()

virtual void casacore::NullTable::addRow | ( | rownr_t | nrrow,
|  | Bool | initialize )

override virtual

Add one or more rows and possibly initialize them.

This will fail for tables not supporting addition of rows.

Reimplemented from casacore::BaseTable.

## adjustRownrs()

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

override 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 from casacore::BaseTable.

## asBigEndian()

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

override virtual

Is the table stored in big or little endian format?

Implements casacore::BaseTable.

## canAddRow()

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

override virtual

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

Reimplemented from casacore::BaseTable.

## canRemoveColumn()

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

override virtual

Test if columns can be removed.

Implements casacore::BaseTable.

## canRemoveRow()

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

override virtual

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

Reimplemented from casacore::BaseTable.

## canRenameColumn()

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

override virtual

Test if a column can be renamed.

Implements casacore::BaseTable.

## dataManagerInfo()

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

override virtual

Get the data manager info.

Implements casacore::BaseTable.

References casacore::Record().

Referenced by deepCopy().

## deepCopy()

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

override virtual

Reimplemented from casacore::BaseTable.

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

## doSort()

virtual std::shared_ptr< BaseTable > casacore::NullTable::doSort | ( | PtrBlock< 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 )

override virtual

Do the actual sort.

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

Reimplemented from casacore::BaseTable.

## findDataManager()

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

override virtual

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

Implements casacore::BaseTable.

References casacore::name().

## flush()

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

override virtual

Flush the table, i.e.

write it to disk.

Implements casacore::BaseTable.

## getColumn() [1/2]

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

override virtual

Get a column object using its name.

Implements casacore::BaseTable.

## getColumn() [2/2]

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

override virtual

Get a column object using its index.

Implements casacore::BaseTable.

## getModifyCounter()

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

override virtual

Get the modify counter.

Implements casacore::BaseTable.

## hasLock()

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

override virtual

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

Implements casacore::BaseTable.

## isMultiUsed()

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

override 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.

Implements casacore::BaseTable.

## isNull()

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

override virtual

The table is a null table.

Reimplemented from casacore::BaseTable.

## isWritable()

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

override virtual

Test if this table is writable.

This tells if values can be put into a column.

Implements casacore::BaseTable.

## keywordSet()

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

override virtual

Get readonly access to the table keyword set.

Implements casacore::BaseTable.

## lock()

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

override virtual

Try to lock the table for read or write access.

Implements casacore::BaseTable.

## lockOptions()

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

override virtual

Get the locking info.

Implements casacore::BaseTable.

Referenced by mergeLock().

## makeError()

TableError casacore::NullTable::makeError | ( | const String & | name | ) | const

private

Make an exception message with the name of the function.

References casacore::name().

## mergeLock()

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

override virtual

Merge the given lock info with the existing one.

Implements casacore::BaseTable.

References lockOptions().

## operator=()

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

delete

Assignment is forbidden.

References NullTable().

## removeColumn()

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

override virtual

Remove columns.

Implements casacore::BaseTable.

## removeRow()

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

override 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::NullTable::removeRow
virtual void removeRow(rownr_t rownr) override
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 from casacore::BaseTable.

## renameColumn()

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

override virtual

Rename a column.

Implements casacore::BaseTable.

## renameHypercolumn()

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

override virtual

Rename a hypercolumn.

Implements casacore::BaseTable.

## renameSubTables()

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

override virtual

Rename the subtables (used by rename function).

Reimplemented from casacore::BaseTable.

## reopenRW()

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

override virtual

All functions throw a "null table" exception.

Implements casacore::BaseTable.

## resync()

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

override virtual

Resync the Table object with the table file.

Implements casacore::BaseTable.

## root()

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

override 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 from casacore::BaseTable.

References casacore::BaseTable::BaseTable().

## rowNumbers()

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

override 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 from casacore::BaseTable.

## rowOrder()

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

override 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 from casacore::BaseTable.

## rowStorage()

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

override 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 from casacore::BaseTable.

## rwKeywordSet()

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

override 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).

Implements casacore::BaseTable.

## storageOption()

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

override virtual

Get the storage option used for the table.

Implements casacore::BaseTable.

## unlock()

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

override virtual

Unlock the table.

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

Implements casacore::BaseTable.

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

- tables/Tables/NullTable.h