casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Static Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | Static Private Attributes | List of all members
casacore::PlainTable Class Reference

Class defining a plain regular table. More...

#include <PlainTable.h>

Inheritance diagram for casacore::PlainTable:
casacore::BaseTable

Public Member Functions

 PlainTable (SetupNewTable &, uInt nrrow, Bool initialize, const TableLock &lockOptions, int endianFormat, const TSMOption &tsmOption)
 Construct the object for a new table. More...
 
void PlainTableCommon (SetupNewTable &, uInt nrrow, Bool initialize, const TableLock &lockOptions, int endianFormat, const TSMOption &tsmOption)
 Common part of the constructor shared by MPI and non-MPI. More...
 
 PlainTable (AipsIO &, uInt version, const String &name, const String &type, uInt nrrow, int option, const TableLock &lockOptions, const TSMOption &tsmOption, Bool addToCache, uInt locknr)
 Construct the object for an existing table. More...
 
virtual ~PlainTable ()
 The destructor flushes (i.e. More...
 
virtual void reopenRW ()
 Try to reopen the table for read/write access. More...
 
virtual Bool asBigEndian () const
 Is the table stored in big or little endian format? More...
 
virtual const StorageOptionstorageOption () const
 Get the storage option used for the table. More...
 
virtual Bool isMultiUsed (Bool checkSubTables) const
 Is the table in use (i.e. More...
 
virtual const TableLocklockOptions () const
 Get the locking info. More...
 
virtual void mergeLock (const TableLock &lockOptions)
 Merge the given lock info with the existing one. More...
 
virtual Bool hasLock (FileLocker::LockType) const
 Has this process the read or write lock, thus can the table be read or written safely? More...
 
virtual Bool lock (FileLocker::LockType, uInt nattempts)
 Try to lock the table for read or write access. More...
 
virtual void unlock ()
 Unlock the table. More...
 
void autoReleaseLock (Bool always=False)
 Do a release of an AutoLock when the inspection interval has expired. More...
 
virtual void flush (Bool fsync, Bool recursive)
 Flush the table, i.e. More...
 
virtual void resync ()
 Resync the Table object with the table file. More...
 
virtual uInt getModifyCounter () const
 Get the modify counter. More...
 
virtual void setTableChanged ()
 Set the table to being changed. More...
 
virtual Bool isWritable () const
 Test if the table is opened as writable. More...
 
virtual TableDesc actualTableDesc () const
 Get the actual table description. More...
 
virtual Record dataManagerInfo () const
 Get the data manager info. More...
 
virtual TableRecordkeywordSet ()
 Get readonly access to the table keyword set. More...
 
virtual TableRecordrwKeywordSet ()
 Get read/write access to the table keyword set. More...
 
virtual BaseColumngetColumn (uInt columnIndex) const
 Get a column object using its index. More...
 
virtual BaseColumngetColumn (const String &columnName) const
 Get a column object using its name. More...
 
virtual Bool canAddRow () const
 Test if it is possible to add a row to this table. More...
 
virtual void addRow (uInt nrrow, Bool initialize)
 Add one or more rows and possibly initialize them. More...
 
virtual Bool canRemoveRow () const
 Test if it is possible to remove a row from this table. More...
 
virtual void removeRow (uInt rownr)
 Remove the given row. More...
 
virtual void addColumn (const ColumnDesc &columnDesc, Bool)
 Add a column to the table. More...
 
virtual void addColumn (const ColumnDesc &columnDesc, const String &dataManager, Bool byName, Bool)
 
virtual void addColumn (const ColumnDesc &columnDesc, const DataManager &dataManager, Bool)
 
virtual void addColumn (const TableDesc &tableDesc, const DataManager &dataManager, Bool)
 
virtual Bool canRemoveColumn (const Vector< String > &columnNames) const
 Test if columns can be removed. More...
 
virtual void removeColumn (const Vector< String > &columnNames)
 Remove columns. More...
 
virtual Bool canRenameColumn (const String &columnName) const
 Test if a column can be renamed (yes). More...
 
virtual void renameColumn (const String &newName, const String &oldName)
 Rename a column. More...
 
virtual void renameHypercolumn (const String &newName, const String &oldName)
 Rename a hypercolumn. More...
 
virtual DataManagerfindDataManager (const String &name, Bool byColumn) const
 Find the data manager with the given name or for the given column. More...
 
- Public Member Functions inherited from casacore::BaseTable
 BaseTable (const String &tableName, int tableOption, uInt nrrow)
 Initialize the object. More...
 
void BaseTableCommon (const String &tableName, int tableOption, uInt nrrow)
 Common code shared by the MPI constructor and non-MPI constructor. More...
 
virtual ~BaseTable ()
 
void link ()
 Link to this BaseTable object (i.e. More...
 
virtual Bool isNull () const
 Is the table a null table? By default it is not. More...
 
void doNotWrite ()
 Do not write the table (used in in case of exceptions). More...
 
Bool isColumnWritable (const String &columnName) const
 Test if the given column is writable. More...
 
Bool isColumnWritable (uInt columnIndex) const
 
Bool isColumnStored (const String &columnName) const
 Test if the given column is stored (otherwise it is virtual). More...
 
Bool isColumnStored (uInt columnIndex) const
 
const StringtableName () const
 Get the table name. More...
 
virtual void getPartNames (Block< String > &names, Bool recursive) const
 Get the names of the tables this table consists of. More...
 
virtual void rename (const String &newName, int tableOption)
 Rename the table. More...
 
virtual void copy (const String &newName, int tableOption) const
 Copy the table and all its subtables. More...
 
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. More...
 
int tableOption () const
 Get the table option. More...
 
void markForDelete (Bool callback, const String &oldName)
 Mark the table for delete. More...
 
void unmarkForDelete (Bool callback, const String &oldName)
 Unmark the table for delete. More...
 
Bool isMarkedForDelete () const
 Test if the table is marked for delete. More...
 
const TableDesctableDesc () const
 Get the table description. More...
 
void showStructure (std::ostream &, Bool showDataMan, Bool showColumns, Bool showSubTables, Bool sortColumns, Bool cOrder)
 Show the table structure (implementation of Table::showStructure). More...
 
TableInfotableInfo ()
 Get access to the TableInfo object. More...
 
virtual void flushTableInfo ()
 Write the TableInfo object. More...
 
uInt nrow () const
 Get number of rows. More...
 
void removeRow (const Vector< uInt > &rownrs)
 
BaseTableselect (const TableExprNode &, uInt maxRow, uInt offset)
 Select rows using the given expression (which can be null). More...
 
BaseTableselect (uInt maxRow, uInt offset)
 Select maxRow rows and skip first offset rows. More...
 
BaseTableselect (const Vector< uInt > &rownrs)
 Select rows using a vector of row numbers. More...
 
BaseTableselect (const Block< Bool > &mask)
 Select rows using a mask block. More...
 
BaseTableproject (const Block< String > &columnNames)
 Project the given columns (i.e. More...
 
BaseTabletabAnd (BaseTable *)
 Do logical operations on a table. More...
 
BaseTabletabOr (BaseTable *)
 union with another table More...
 
BaseTabletabSub (BaseTable *)
 subtract another table More...
 
BaseTabletabXor (BaseTable *)
 xor with another table More...
 
BaseTabletabNot ()
 take complement More...
 
BaseTablesort (const Block< String > &columnNames, const Block< CountedPtr< BaseCompare > > &compareObjects, const Block< Int > &sortOrder, int sortOption)
 Sort a table on one or more columns of scalars. More...
 
BaseTableIteratormakeIterator (const Block< String > &columnNames, const Block< CountedPtr< BaseCompare > > &, const Block< Int > &orders, int option)
 Create an iterator. More...
 
void addColumns (const TableDesc &tableDesc, const Record &dmInfo, Bool addToParent)
 Add one or more columns to the table. More...
 
Bool checkRemoveColumn (const Vector< String > &columnNames, Bool throwException) const
 Check if the set of columns can be removed. More...
 
virtual Vector< uIntrowNumbers () const
 Get a vector of row numbers. More...
 
virtual BaseTableroot ()
 Get pointer to root table (i.e. More...
 
virtual Bool rowOrder () const
 Tell if the table is in row order. More...
 
virtual Vector< uInt > * rowStorage ()
 By the default the table cannot return the storage of rownrs. More...
 
virtual Bool adjustRownrs (uInt nrrow, Vector< uInt > &rownrs, Bool determineOrder) const
 Adjust the row numbers to be the actual row numbers in the root table. More...
 
virtual BaseTabledoSort (PtrBlock< BaseColumn * > &, const Block< CountedPtr< BaseCompare > > &, const Block< Int > &sortOrder, int sortOption)
 Do the actual sort. More...
 
RefTablemakeRefTable (Bool rowOrder, uInt initialNrrow)
 Create a RefTable object. More...
 
void checkRowNumber (uInt rownr) const
 Check if the row number is valid. More...
 
int traceId () const
 Get the table's trace-id. More...
 

Static Public Member Functions

static void getLayout (TableDesc &desc, AipsIO &ios)
 Return the layout of a table (i.e. More...
 
static ByteIO::OpenOption toAipsIOFoption (int tableOption)
 Convert a Table option to an AipsIO file option. More...
 
static TableCachetableCache ()
 Get access to the TableCache. More...
 
- Static Public Member Functions inherited from casacore::BaseTable
static void unlink (BaseTable *)
 Unlink from a BaseTable. More...
 
static TableInfo tableInfo (const String &tableName)
 Get the table info of the table with the given name. More...
 

Private Member Functions

 PlainTable (const PlainTable &)
 Copy constructor is forbidden, because copying a table requires some more knowledge (like table name of result). More...
 
PlainTableoperator= (const PlainTable &)
 Assignment is forbidden, because copying a table requires some more knowledge (like table name of result). More...
 
void closeObject ()
 Close the object which is called by the destructor. More...
 
virtual void renameSubTables (const String &newName, const String &oldName)
 Rename the subtables (used by rename function). More...
 
MemoryIOdoReleaseCallBack (Bool always)
 
Bool putFile (Bool always)
 When needed, write the table control information in an AipsIO file. More...
 
void syncTable ()
 Synchronize the table after having acquired a lock which says that main table data has changed. More...
 
void setEndian (int endianFormat)
 Determine and set the endian format (big or little). More...
 
void checkWritable (const char *func) const
 Throw an exception if the table is not writable. More...
 

Static Private Member Functions

static MemoryIOreleaseCallBack (void *plainTableObject, Bool always)
 The callback function when a lock is released. More...
 

Private Attributes

ColumnSetcolSetPtr_p
 
Bool tableChanged_p
 
Bool addToCache_p
 
TableLockDatalockPtr_p
 
TableSyncData lockSync_p
 
Bool bigEndian_p
 
TSMOption tsmOption_p
 

Static Private Attributes

static TableCache theirTableCache
 

Additional Inherited Members

- 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). More...
 
Bool makeTableDir ()
 Create the table directory when needed (and possible). More...
 
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. More...
 
void prepareCopyRename (const String &newName, int tableOption) const
 Prepare for copying or renaming a table. More...
 
void throwIfTableExists ()
 Check if the table already exists. More...
 
Bool openedForWrite () const
 Test if the table is opened for write. More...
 
void writeStart (AipsIO &, Bool bigEndian)
 Start writing a table. More...
 
void writeEnd (AipsIO &)
 End writing a table. More...
 
Bool shouldNotWrite () const
 Should the table be written. More...
 
void getTableInfo ()
 Read the TableInfo object. More...
 
- Protected Attributes inherited from casacore::BaseTable
uInt nrlink_p
 
uInt nrrow_p
 
uInt nrrowToAdd_p
 
TableDesctdescPtr_p
 
String name_p
 
int option_p
 
Bool noWrite_p
 
Bool delete_p
 
TableInfo info_p
 
Bool madeDir_p
 
int itsTraceId
 

Detailed Description

Class defining a plain regular table.

Intended use:

Internal

Review Status

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

Prerequisite

Etymology

PlainTable represents a plain regular table. This is opposed to a RefTable, which is a view on a PlainTable.

Synopsis

PlainTable is a table consisting of a keyword set and a number of filled and virtual columns. The table control information and the keyword set is stored in an AipsIO file. The data in the filled columns are stored separately by storage managers.

To Do

Definition at line 85 of file PlainTable.h.

Constructor & Destructor Documentation

casacore::PlainTable::PlainTable ( SetupNewTable ,
uInt  nrrow,
Bool  initialize,
const TableLock lockOptions,
int  endianFormat,
const TSMOption tsmOption 
)

Construct the object for a new table.

It creates storage manager(s) for unbound columns and initializes all storage managers. The given number of rows is stored in the table and initialized if the flag is set.

casacore::PlainTable::PlainTable ( AipsIO ,
uInt  version,
const String name,
const String type,
uInt  nrrow,
int  option,
const TableLock lockOptions,
const TSMOption tsmOption,
Bool  addToCache,
uInt  locknr 
)

Construct the object for an existing table.

It opens the table file, reads the table control information and creates and initializes the required storage managers.

virtual casacore::PlainTable::~PlainTable ( )
virtual

The destructor flushes (i.e.

writes) the table if it is opened for output and not marked for delete.

casacore::PlainTable::PlainTable ( const PlainTable )
private

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

Declaring it private, makes it unusable.

Member Function Documentation

virtual TableDesc casacore::PlainTable::actualTableDesc ( ) const
virtual

Get the actual table description.

Implements casacore::BaseTable.

virtual void casacore::PlainTable::addColumn ( const ColumnDesc columnDesc,
Bool   
)
virtual

Add a column to the table.

The last Bool argument is not used in PlainTable, but can be used in other classes derived from BaseTable.

Reimplemented from casacore::BaseTable.

virtual void casacore::PlainTable::addColumn ( const ColumnDesc columnDesc,
const String dataManager,
Bool  byName,
Bool   
)
virtual

Reimplemented from casacore::BaseTable.

virtual void casacore::PlainTable::addColumn ( const ColumnDesc columnDesc,
const DataManager dataManager,
Bool   
)
virtual

Reimplemented from casacore::BaseTable.

virtual void casacore::PlainTable::addColumn ( const TableDesc tableDesc,
const DataManager dataManager,
Bool   
)
virtual

Reimplemented from casacore::BaseTable.

virtual void casacore::PlainTable::addRow ( uInt  nrrow,
Bool  initialize 
)
virtual

Add one or more rows and possibly initialize them.

This will fail for tables not supporting addition of rows.

Reimplemented from casacore::BaseTable.

virtual Bool casacore::PlainTable::asBigEndian ( ) const
virtual

Is the table stored in big or little endian format?

Implements casacore::BaseTable.

void casacore::PlainTable::autoReleaseLock ( Bool  always = False)

Do a release of an AutoLock when the inspection interval has expired.

always=True means that the inspection is always done, thus not every 25th call or so.

virtual Bool casacore::PlainTable::canAddRow ( ) const
virtual

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

Reimplemented from casacore::BaseTable.

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

Test if columns can be removed.

Implements casacore::BaseTable.

virtual Bool casacore::PlainTable::canRemoveRow ( ) const
virtual

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

Reimplemented from casacore::BaseTable.

virtual Bool casacore::PlainTable::canRenameColumn ( const String columnName) const
virtual

Test if a column can be renamed (yes).

Implements casacore::BaseTable.

void casacore::PlainTable::checkWritable ( const char *  func) const
private

Throw an exception if the table is not writable.

void casacore::PlainTable::closeObject ( )
private

Close the object which is called by the destructor.

virtual Record casacore::PlainTable::dataManagerInfo ( ) const
virtual

Get the data manager info.

Implements casacore::BaseTable.

MemoryIO* casacore::PlainTable::doReleaseCallBack ( Bool  always)
private
virtual DataManager* casacore::PlainTable::findDataManager ( const String name,
Bool  byColumn 
) const
virtual

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

Implements casacore::BaseTable.

virtual void casacore::PlainTable::flush ( Bool  fsync,
Bool  recursive 
)
virtual

Flush the table, i.e.

write it to disk. Nothing will be done if the table is not writable. A flush can be executed at any time. When a 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.

Implements casacore::BaseTable.

virtual BaseColumn* casacore::PlainTable::getColumn ( uInt  columnIndex) const
virtual

Get a column object using its index.

Implements casacore::BaseTable.

virtual BaseColumn* casacore::PlainTable::getColumn ( const String columnName) const
virtual

Get a column object using its name.

Implements casacore::BaseTable.

static void casacore::PlainTable::getLayout ( TableDesc desc,
AipsIO ios 
)
static

Return the layout of a table (i.e.

description and #rows). This function has the advantage that only the minimal amount of information required is read from the table, thus it is much faster than a normal table open.
The number of rows is returned. The description of the table is stored in desc (its contents will be overwritten).

virtual uInt casacore::PlainTable::getModifyCounter ( ) const
virtual

Get the modify counter.

Implements casacore::BaseTable.

virtual Bool casacore::PlainTable::hasLock ( FileLocker::LockType  ) const
virtual

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

Implements casacore::BaseTable.

virtual Bool casacore::PlainTable::isMultiUsed ( Bool  checkSubTables) const
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.

virtual Bool casacore::PlainTable::isWritable ( ) const
virtual

Test if the table is opened as writable.

Implements casacore::BaseTable.

virtual TableRecord& casacore::PlainTable::keywordSet ( )
virtual

Get readonly access to the table keyword set.

Implements casacore::BaseTable.

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

Try to lock the table for read or write access.

Implements casacore::BaseTable.

virtual const TableLock& casacore::PlainTable::lockOptions ( ) const
virtual

Get the locking info.

Implements casacore::BaseTable.

virtual void casacore::PlainTable::mergeLock ( const TableLock lockOptions)
virtual

Merge the given lock info with the existing one.

Implements casacore::BaseTable.

PlainTable& casacore::PlainTable::operator= ( const PlainTable )
private

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

Declaring it private, makes it unusable.

void casacore::PlainTable::PlainTableCommon ( SetupNewTable ,
uInt  nrrow,
Bool  initialize,
const TableLock lockOptions,
int  endianFormat,
const TSMOption tsmOption 
)

Common part of the constructor shared by MPI and non-MPI.

Bool casacore::PlainTable::putFile ( Bool  always)
private

When needed, write the table control information in an AipsIO file.

Tell the storage managers to flush and close their files. It returns a switch to tell if the table control information has been written.

static MemoryIO* casacore::PlainTable::releaseCallBack ( void *  plainTableObject,
Bool  always 
)
staticprivate

The callback function when a lock is released.

This flushes the table data, writes the synchronization data into the MemoryIO object, and returns a pointer to it.

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

Remove columns.

Implements casacore::BaseTable.

virtual void casacore::PlainTable::removeRow ( uInt  rownr)
virtual

Remove the given row.

This will fail for tables not supporting removal of rows.

Reimplemented from casacore::BaseTable.

virtual void casacore::PlainTable::renameColumn ( const String newName,
const String oldName 
)
virtual

Rename a column.

Implements casacore::BaseTable.

virtual void casacore::PlainTable::renameHypercolumn ( const String newName,
const String oldName 
)
virtual

Rename a hypercolumn.

Implements casacore::BaseTable.

virtual void casacore::PlainTable::renameSubTables ( const String newName,
const String oldName 
)
privatevirtual

Rename the subtables (used by rename function).

Reimplemented from casacore::BaseTable.

virtual void casacore::PlainTable::reopenRW ( )
virtual

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.

Implements casacore::BaseTable.

virtual void casacore::PlainTable::resync ( )
virtual

Resync the Table object with the table file.

Implements casacore::BaseTable.

virtual TableRecord& casacore::PlainTable::rwKeywordSet ( )
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.

void casacore::PlainTable::setEndian ( int  endianFormat)
private

Determine and set the endian format (big or little).

virtual void casacore::PlainTable::setTableChanged ( )
virtual

Set the table to being changed.

Reimplemented from casacore::BaseTable.

virtual const StorageOption& casacore::PlainTable::storageOption ( ) const
virtual

Get the storage option used for the table.

Implements casacore::BaseTable.

void casacore::PlainTable::syncTable ( )
private

Synchronize the table after having acquired a lock which says that main table data has changed.

It check if the columns did not change. It updates the table and column keywords.

static TableCache& casacore::PlainTable::tableCache ( )
inlinestatic

Get access to the TableCache.

Definition at line 260 of file PlainTable.h.

References theirTableCache.

static ByteIO::OpenOption casacore::PlainTable::toAipsIOFoption ( int  tableOption)
static

Convert a Table option to an AipsIO file option.

This is used by storage managers.

virtual void casacore::PlainTable::unlock ( )
virtual

Unlock the table.

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

Implements casacore::BaseTable.

Member Data Documentation

Bool casacore::PlainTable::addToCache_p
private

Definition at line 310 of file PlainTable.h.

Bool casacore::PlainTable::bigEndian_p
private

Definition at line 313 of file PlainTable.h.

ColumnSet* casacore::PlainTable::colSetPtr_p
private

Definition at line 308 of file PlainTable.h.

TableLockData* casacore::PlainTable::lockPtr_p
private

Definition at line 311 of file PlainTable.h.

TableSyncData casacore::PlainTable::lockSync_p
private

Definition at line 312 of file PlainTable.h.

Bool casacore::PlainTable::tableChanged_p
private

Definition at line 309 of file PlainTable.h.

TableCache casacore::PlainTable::theirTableCache
staticprivate

Definition at line 317 of file PlainTable.h.

Referenced by tableCache().

TSMOption casacore::PlainTable::tsmOption_p
private

Definition at line 315 of file PlainTable.h.


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