casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Public Member Functions | Static Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | Static Private Attributes
casa::PlainTable Class Reference

Class defining a plain regular table. More...

#include <PlainTable.h>

Inheritance diagram for casa::PlainTable:
casa::BaseTable

List of all members.

Public Member Functions

 PlainTable (SetupNewTable &, uInt nrrow, Bool initialize, const TableLock &lockOptions, int endianFormat, const TSMOption &tsmOption)
 Construct the object for a new table.
 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.
virtual ~PlainTable ()
 The destructor flushes (i.e.
virtual void reopenRW ()
 Try to reopen the table for read/write access.
virtual Bool asBigEndian () const
 Is the table stored in big or little endian format?
virtual Bool isMultiUsed (Bool checkSubTables) const
 Is the table in use (i.e.
virtual const TableLocklockOptions () const
 Get the locking info.
virtual void mergeLock (const TableLock &lockOptions)
 Merge the given lock info with the existing one.
virtual Bool hasLock (FileLocker::LockType) const
 Has this process the read or write lock, thus can the table be read or written safely?
virtual Bool lock (FileLocker::LockType, uInt nattempts)
 Try to lock the table for read or write access.
virtual void unlock ()
 Unlock the table.
void autoReleaseLock (Bool always=False)
 Do a release of an AutoLock when the inspection interval has expired.
virtual void flush (Bool fsync, Bool recursive)
 Flush the table, i.e.
virtual void resync ()
 Resync the Table object with the table file.
virtual uInt getModifyCounter () const
 Get the modify counter.
virtual void setTableChanged ()
 Set the table to being changed.
virtual Bool isWritable () const
 Test if the table is opened as writable.
virtual TableDesc actualTableDesc () const
 Get the actual table description.
virtual Record dataManagerInfo () const
 Get the data manager info.
virtual TableRecordkeywordSet ()
 Get readonly access to the table keyword set.
virtual TableRecordrwKeywordSet ()
 Get read/write access to the table keyword set.
virtual BaseColumngetColumn (uInt columnIndex) const
 Get a column object using its index.
virtual BaseColumngetColumn (const String &columnName) const
 Get a column object using its name.
virtual Bool canAddRow () const
 Test if it is possible to add a row to this table.
virtual void addRow (uInt nrrow, Bool initialize)
 Add one or more rows and possibly initialize them.
virtual Bool canRemoveRow () const
 Test if it is possible to remove a row from this table.
virtual void removeRow (uInt rownr)
 Remove the given row.
virtual void addColumn (const ColumnDesc &columnDesc, Bool)
 Add a column to the table.
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.
virtual void removeColumn (const Vector< String > &columnNames)
 Remove columns.
virtual Bool canRenameColumn (const String &columnName) const
 Test if a column can be renamed (yes).
virtual void renameColumn (const String &newName, const String &oldName)
 Rename a column.
virtual void renameHypercolumn (const String &newName, const String &oldName)
 Rename a hypercolumn.
virtual DataManagerfindDataManager (const String &name, Bool byColumn) const
 Find the data manager with the given name or for the given column.

Static Public Member Functions

static void getLayout (TableDesc &desc, AipsIO &ios)
 Return the layout of a table (i.e.
static ByteIO::OpenOption toAipsIOFoption (int tableOption)
 Convert a Table option to an AipsIO file option.
static TableCachetableCache ()
 Get access to the TableCache.

Private Member Functions

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

Static Private Member Functions

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

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

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

casa::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.

casa::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 casa::PlainTable::~PlainTable ( ) [virtual]

The destructor flushes (i.e.

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

casa::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 casa::PlainTable::actualTableDesc ( ) const [virtual]

Get the actual table description.

Implements casa::BaseTable.

virtual void casa::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 casa::BaseTable.

virtual void casa::PlainTable::addColumn ( const ColumnDesc columnDesc,
const String dataManager,
Bool  byName,
Bool   
) [virtual]

Reimplemented from casa::BaseTable.

virtual void casa::PlainTable::addColumn ( const ColumnDesc columnDesc,
const DataManager dataManager,
Bool   
) [virtual]

Reimplemented from casa::BaseTable.

virtual void casa::PlainTable::addColumn ( const TableDesc tableDesc,
const DataManager dataManager,
Bool   
) [virtual]

Reimplemented from casa::BaseTable.

virtual void casa::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 casa::BaseTable.

virtual Bool casa::PlainTable::asBigEndian ( ) const [virtual]

Is the table stored in big or little endian format?

Implements casa::BaseTable.

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 casa::PlainTable::canAddRow ( ) const [virtual]

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

Reimplemented from casa::BaseTable.

virtual Bool casa::PlainTable::canRemoveColumn ( const Vector< String > &  columnNames) const [virtual]

Test if columns can be removed.

Implements casa::BaseTable.

virtual Bool casa::PlainTable::canRemoveRow ( ) const [virtual]

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

Reimplemented from casa::BaseTable.

virtual Bool casa::PlainTable::canRenameColumn ( const String columnName) const [virtual]

Test if a column can be renamed (yes).

Implements casa::BaseTable.

void casa::PlainTable::checkWritable ( const char *  func) const [private]

Throw an exception if the table is not writable.

void casa::PlainTable::closeObject ( ) [private]

Close the object which is called by the destructor.

virtual Record casa::PlainTable::dataManagerInfo ( ) const [virtual]

Get the data manager info.

Implements casa::BaseTable.

virtual DataManager* casa::PlainTable::findDataManager ( const String name,
Bool  byColumn 
) const [virtual]

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

Implements casa::BaseTable.

virtual void casa::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 casa::BaseTable.

virtual BaseColumn* casa::PlainTable::getColumn ( uInt  columnIndex) const [virtual]

Get a column object using its index.

Implements casa::BaseTable.

virtual BaseColumn* casa::PlainTable::getColumn ( const String columnName) const [virtual]

Get a column object using its name.

Implements casa::BaseTable.

static void casa::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 casa::PlainTable::getModifyCounter ( ) const [virtual]

Get the modify counter.

Implements casa::BaseTable.

virtual Bool casa::PlainTable::hasLock ( FileLocker::LockType  ) const [virtual]

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

Implements casa::BaseTable.

virtual Bool casa::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 casa::BaseTable.

virtual Bool casa::PlainTable::isWritable ( ) const [virtual]

Test if the table is opened as writable.

Implements casa::BaseTable.

virtual TableRecord& casa::PlainTable::keywordSet ( ) [virtual]

Get readonly access to the table keyword set.

Implements casa::BaseTable.

virtual Bool casa::PlainTable::lock ( FileLocker::LockType  ,
uInt  nattempts 
) [virtual]

Try to lock the table for read or write access.

Implements casa::BaseTable.

virtual const TableLock& casa::PlainTable::lockOptions ( ) const [virtual]

Get the locking info.

Implements casa::BaseTable.

virtual void casa::PlainTable::mergeLock ( const TableLock lockOptions) [virtual]

Merge the given lock info with the existing one.

Implements casa::BaseTable.

PlainTable& casa::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.

Bool casa::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* casa::PlainTable::releaseCallBack ( void *  plainTableObject,
Bool  always 
) [static, private]

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 casa::PlainTable::removeColumn ( const Vector< String > &  columnNames) [virtual]

Remove columns.

Implements casa::BaseTable.

virtual void casa::PlainTable::removeRow ( uInt  rownr) [virtual]

Remove the given row.

This will fail for tables not supporting removal of rows.

Reimplemented from casa::BaseTable.

virtual void casa::PlainTable::renameColumn ( const String newName,
const String oldName 
) [virtual]

Rename a column.

Implements casa::BaseTable.

virtual void casa::PlainTable::renameHypercolumn ( const String newName,
const String oldName 
) [virtual]

Rename a hypercolumn.

Implements casa::BaseTable.

virtual void casa::PlainTable::renameSubTables ( const String newName,
const String oldName 
) [private, virtual]

Rename the subtables (used by rename function).

Reimplemented from casa::BaseTable.

virtual void casa::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 casa::BaseTable.

virtual void casa::PlainTable::resync ( ) [virtual]

Resync the Table object with the table file.

Implements casa::BaseTable.

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 casa::BaseTable.

void casa::PlainTable::setEndian ( int  endianFormat) [private]

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

virtual void casa::PlainTable::setTableChanged ( ) [virtual]

Set the table to being changed.

Reimplemented from casa::BaseTable.

void casa::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& casa::PlainTable::tableCache ( ) [inline, static]

Get access to the TableCache.

Definition at line 245 of file PlainTable.h.

References theirTableCache.

static ByteIO::OpenOption casa::PlainTable::toAipsIOFoption ( int  tableOption) [static]

Convert a Table option to an AipsIO file option.

This is used by storage managers.

virtual void casa::PlainTable::unlock ( ) [virtual]

Unlock the table.

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

Implements casa::BaseTable.


Member Data Documentation

Definition at line 295 of file PlainTable.h.

Definition at line 298 of file PlainTable.h.

Definition at line 293 of file PlainTable.h.

Definition at line 296 of file PlainTable.h.

Definition at line 297 of file PlainTable.h.

Definition at line 294 of file PlainTable.h.

Definition at line 302 of file PlainTable.h.

Referenced by tableCache().

Definition at line 300 of file PlainTable.h.


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