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

Class indicating a null Table object. More...

#include <NullTable.h>

Inheritance diagram for casa::NullTable:
casa::BaseTable

List of all members.

Public Member Functions

 NullTable ()
 Default constructor.
virtual ~NullTable ()
virtual Bool isNull () const
 The table is a null table.
virtual void reopenRW ()
 All functions throw a "null table" exception.
virtual Bool asBigEndian () const
 Is the table stored in big or little endian format?
virtual Bool isMultiUsed (Bool checkSubTable) 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.
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 Bool isWritable () const
 Test if this table is writable.
virtual void deepCopy (const String &newName, const Record &dataManagerInfo, int tableOption, Bool valueCopy, int endianFormat, Bool noRows) const
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 rows.
virtual DataManagerfindDataManager (const String &name, Bool byColumn) const
 Find the data manager with the given name or for the given column.
virtual void addColumn (const ColumnDesc &columnDesc, Bool addToParent)
 Add one or more columns to the table.
virtual void addColumn (const ColumnDesc &columnDesc, const String &dataManager, Bool byName, Bool addToParent)
virtual void addColumn (const ColumnDesc &columnDesc, const DataManager &dataManager, Bool addToParent)
virtual void addColumn (const TableDesc &tableDesc, const DataManager &dataManager, Bool addToParent)
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.
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 Vector< uIntrowNumbers () const
 Get a vector of row numbers.
virtual BaseTableroot ()
 Get pointer to root table (i.e.
virtual Bool rowOrder () const
 Tell if the table is in row order.
virtual Vector< uInt > * rowStorage ()
 By the default the table cannot return the storage of rownrs.
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.
virtual BaseTabledoSort (PtrBlock< BaseColumn * > &, const Block< CountedPtr< BaseCompare > > &, const Block< Int > &sortOrder, int sortOption)
 Do the actual sort.
virtual void renameSubTables (const String &newName, const String &oldName)
 Rename the subtables (used by rename function).

Private Member Functions

 NullTable (const NullTable &)
 
   

NullTableoperator= (const NullTable &)
 Assignment is forbidden, because copying a table requires some more knowledge (like table name of result).
void throwError (const String &name) const
 Throw an exception with the name of the function.

Detailed Description

Class indicating a null Table object.

Intended use:

Internal

Review Status

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

Prerequisite

Etymology

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

Synopsis

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

Definition at line 67 of file NullTable.h.


Constructor & Destructor Documentation

Default constructor.

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

Get the actual table description.

Implements casa::BaseTable.

virtual void casa::NullTable::addColumn ( const ColumnDesc columnDesc,
Bool  addToParent 
) [virtual]

Add one or more columns to the table.

The default implementation throws an "invalid operation" exception.

Reimplemented from casa::BaseTable.

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

Reimplemented from casa::BaseTable.

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

Reimplemented from casa::BaseTable.

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

Reimplemented from casa::BaseTable.

virtual void casa::NullTable::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::NullTable::adjustRownrs ( uInt  nrrow,
Vector< uInt > &  rownrs,
Bool  determineOrder 
) const [virtual]

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

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

Reimplemented from casa::BaseTable.

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

Is the table stored in big or little endian format?

Implements casa::BaseTable.

virtual Bool casa::NullTable::canAddRow ( ) const [virtual]

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

Reimplemented from casa::BaseTable.

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

Test if columns can be removed.

Implements casa::BaseTable.

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

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

Reimplemented from casa::BaseTable.

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

Test if a column can be renamed.

Implements casa::BaseTable.

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

Get the data manager info.

Implements casa::BaseTable.

virtual void casa::NullTable::deepCopy ( const String newName,
const Record dataManagerInfo,
int  tableOption,
Bool  valueCopy,
int  endianFormat,
Bool  noRows 
) const [virtual]

Reimplemented from casa::BaseTable.

virtual BaseTable* casa::NullTable::doSort ( PtrBlock< BaseColumn * > &  ,
const Block< CountedPtr< BaseCompare > > &  ,
const Block< Int > &  sortOrder,
int  sortOption 
) [virtual]

Do the actual sort.

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

Reimplemented from casa::BaseTable.

virtual DataManager* casa::NullTable::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::NullTable::flush ( Bool  fsync,
Bool  recursive 
) [virtual]

Flush the table, i.e.

write it to disk.

Implements casa::BaseTable.

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

Get a column object using its index.

Implements casa::BaseTable.

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

Get a column object using its name.

Implements casa::BaseTable.

virtual uInt casa::NullTable::getModifyCounter ( ) const [virtual]

Get the modify counter.

Implements casa::BaseTable.

virtual Bool casa::NullTable::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::NullTable::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::NullTable::isNull ( ) const [virtual]

The table is a null table.

Reimplemented from casa::BaseTable.

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

Test if this table is writable.

This tells if values can be put into a column.

Implements casa::BaseTable.

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

Get readonly access to the table keyword set.

Implements casa::BaseTable.

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

Try to lock the table for read or write access.

Implements casa::BaseTable.

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

Get the locking info.

Implements casa::BaseTable.

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

Merge the given lock info with the existing one.

Implements casa::BaseTable.

NullTable& casa::NullTable::operator= ( const NullTable ) [private]

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

Declaring it private, makes it unusable.

virtual void casa::NullTable::removeColumn ( const Vector< String > &  columnNames) [virtual]

Remove columns.

Implements casa::BaseTable.

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

Remove rows.

   This will fail for tables not supporting removal of rows.
   <br><strong>Tip:</strong><em> 
   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<uInt> vec(2);
           vec(0) = 10;
           vec(1) = 20;
           tab;removeRow (vec);     // remove row 10 and 20

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

Reimplemented from casa::BaseTable.

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

Rename a column.

Implements casa::BaseTable.

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

Rename a hypercolumn.

Implements casa::BaseTable.

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

Rename the subtables (used by rename function).

Reimplemented from casa::BaseTable.

virtual void casa::NullTable::reopenRW ( ) [virtual]

All functions throw a "null table" exception.

Implements casa::BaseTable.

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

Resync the Table object with the table file.

Implements casa::BaseTable.

virtual BaseTable* casa::NullTable::root ( ) [virtual]

Get pointer to root table (i.e.

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

Reimplemented from casa::BaseTable.

virtual Vector<uInt> casa::NullTable::rowNumbers ( ) const [virtual]

Get a vector of row numbers.

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

Reimplemented from casa::BaseTable.

virtual Bool casa::NullTable::rowOrder ( ) const [virtual]

Tell if the table is in row order.

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

Reimplemented from casa::BaseTable.

virtual Vector<uInt>* casa::NullTable::rowStorage ( ) [virtual]

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

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

Reimplemented from 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::NullTable::throwError ( const String name) const [private]

Throw an exception with the name of the function.

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

Unlock the table.

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

Implements casa::BaseTable.


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