Table.h

Go to the documentation of this file.
00001 //# Table.h: Main interface classes to tables
00002 //# Copyright (C) 1994,1995,1996,1997,1998,1999,2000,2001,2002,2003
00003 //# Associated Universities, Inc. Washington DC, USA.
00004 //#
00005 //# This library is free software; you can redistribute it and/or modify it
00006 //# under the terms of the GNU Library General Public License as published by
00007 //# the Free Software Foundation; either version 2 of the License, or (at your
00008 //# option) any later version.
00009 //#
00010 //# This library is distributed in the hope that it will be useful, but WITHOUT
00011 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00012 //# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
00013 //# License for more details.
00014 //#
00015 //# You should have receied a copy of the GNU Library General Public License
00016 //# along with this library; if not, write to the Free Software Foundation,
00017 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
00018 //#
00019 //# Correspondence concerning AIPS++ should be addressed as follows:
00020 //#        Internet email: aips2-request@nrao.edu.
00021 //#        Postal address: AIPS++ Project Office
00022 //#                        National Radio Astronomy Observatory
00023 //#                        520 Edgemont Road
00024 //#                        Charlottesville, VA 22903-2475 USA
00025 //#
00026 //# $Id$
00027 
00028 #ifndef TABLES_TABLE_H
00029 #define TABLES_TABLE_H
00030 
00031 
00032 //# Includes
00033 #include <casacore/casa/aips.h>
00034 #include <casacore/tables/Tables/BaseTable.h>
00035 #include <casacore/tables/Tables/TableLock.h>
00036 #include <casacore/tables/DataMan/TSMOption.h>
00037 #include <casacore/casa/Utilities/DataType.h>
00038 #include <casacore/casa/Utilities/Sort.h>
00039 
00040 namespace casacore { //# NAMESPACE CASACORE - BEGIN
00041 
00042 //# Forward Declarations
00043 class SetupNewTable;
00044 class TableDesc;
00045 class ColumnDesc;
00046 class TableRecord;
00047 class Record;
00048 class TableExprNode;
00049 class DataManager;
00050 class IPosition;
00051 template<class T> class Vector;
00052 template<class T> class Block;
00053 template<class T> class CountedPtr;
00054 
00055 
00056 // <summary>
00057 // Main interface class to a read/write table
00058 // </summary>
00059 
00060 // <use visibility=export>
00061 
00062 // <reviewed reviewer="TPPR" date="08.11.94" tests="tTable.cc">
00063 // </reviewed>
00064 
00065 // <prerequisite>
00066 //# Classes you should understand before using this one.
00067 //   <li> <linkto class=SetupNewTable>SetupNewTable</linkto>
00068 //   <li> <linkto class=TableDesc>TableDesc</linkto>
00069 //   <li> <linkto class=TableColumn>TableColumn</linkto>
00070 //   <li> <linkto class=ScalarColumn>ScalarColumn</linkto>
00071 //   <li> <linkto class=ArrayColumn>ArrayColum</linkto>
00072 //   <li> <linkto class=TableLock>TableLock</linkto>
00073 // </prerequisite>
00074 
00075 // <synopsis>
00076 // Class Table can be used to create a new table or to access an existing
00077 // table in read/write or readonly mode.
00078 //
00079 // To access the data in a Table, objects have to be created
00080 // to access the columns. These objects are TableColumn,
00081 // ScalarColumn<T> and ArrayColumn<T>, which can be created
00082 // via their constructors.
00083 // Furthermore the Table has a TableRecord object for holding keywords
00084 // which can be read or written using the appropriate functions.
00085 //
00086 // To open an existing table, a simple Table constructor can be used.
00087 // The possible construct options are:
00088 // <ul>
00089 //   <li> Old            readonly table (default option)
00090 //   <li> Update         update existing table
00091 //   <li> Delete         delete table
00092 // </ul>
00093 // The function <src>openTable</src> makes it possible to open a subtable
00094 // of a table in a convenient way, even if the table is only a reference
00095 // to another table (e.g., a selection).
00096 //
00097 // Creating a new table requires more work, because columns have
00098 // to be bound to storage managers or virtual column engines.
00099 // Class SetupNewTable is needed for this purpose. The Tables module
00100 // documentation explains in more detail how to create a table.
00101 // When creating a table, it can be specified which endian format to use.
00102 // By default it uses the format specified in the aipsrc variable
00103 // <code>table.endianformat</code> which defaults to
00104 // <code>Table::LocalEndian</code> (thus the endian format of the
00105 // machine being used).
00106 //
00107 // It is possible to create a Table object as the virtual concatenation of
00108 // Tables having identical table descriptions. Subtables of those tables
00109 // can optionally be concatenated as well.
00110 // E.g. if a MeasurementSet is partioned in time, this mechanism makes it
00111 // possible to view it as a single table. Furthermore, a subtable like
00112 // SYSCAL can be concatenated as well, while the other subtables are identical
00113 // in all partitions and are taken from the first table only.
00114 //
00115 // Other Table objects can be created from a Table using
00116 // the select, project and sort functions. The result in so-called
00117 // reference tables. In this way a subset of a table can be created and
00118 // can be read/written in the same way as a normal Table. Writing has the
00119 // effect that the underlying table gets written.
00120 // </synopsis>
00121 
00122 // <example>
00123 // <srcblock>
00124 // // Open a table to be updated.
00125 // Table myTable ("theTable", Table::Update);
00126 // // Write the column containing the scalar RA.
00127 // ScalarColumn<double> raColumn(myTable, "RA");
00128 // uInt nrrow = myTable.nrow();
00129 // for (uInt i=0; i<nrrow; i++) {
00130 //    raColumn.put (i, i+10);    // Put value i+10 into row i
00131 // }
00132 // </srcblock>
00133 // </example>
00134 
00135 // <motivation>
00136 // Table is the envelope for the underlying counted referenced
00137 // classes derived from BaseTable. In this way no pointers have
00138 // to be used to get polymorphism.
00139 // </motivation>
00140 
00141 // <todo asof="$DATE:$">
00142 //# A List of bugs, limitations, extensions or planned refinements.
00143 //   <li> add, remove, rename columns.
00144 //   <li> virtual concatenation of tables (if still necessary).
00145 //   <li> maybe an isAttached function.
00146 // </todo>
00147 
00148 
00149 class Table
00150 {
00151 friend class TableColumn;
00152 friend class BaseTable;
00153 friend class PlainTable;
00154 friend class MemoryTable;
00155 friend class RefTable;
00156 friend class ConcatTable;
00157 friend class TableIterator;
00158 friend class RODataManAccessor;
00159 friend class TableExprNode;
00160 friend class TableExprNodeRep;
00161 
00162 public:
00163     // Define the possible options how a table can be opened.
00164     enum TableOption {
00165         // existing table
00166         Old=1,
00167         // create table
00168         New,
00169         // create table (may not exist)
00170         NewNoReplace,
00171         // new table, which gets marked for delete
00172         Scratch,
00173         // update existing table
00174         Update,
00175         // delete table
00176         Delete
00177     };
00178 
00179     // Define the possible table types.
00180     enum TableType {
00181         // plain table (stored on disk)
00182         Plain,
00183         // table held in memory
00184         Memory
00185     };
00186 
00187     // Define the possible endian formats in which table data can be stored.
00188     enum EndianFormat {
00189         // store table data in big endian (e.g. SUN) format
00190         BigEndian=1,
00191         // store table data in little endian (e.g. Intel) format
00192         LittleEndian,
00193         // store data in the endian format of the machine used
00194         LocalEndian,
00195         // use endian format defined in the aipsrc variable table.endianformat
00196         // If undefined, it defaults to LocalEndian.
00197         AipsrcEndian
00198     };
00199 
00200 
00201     // Define the signature of the function being called when the state
00202     // of a scratch table changes (i.e. created, closed, renamed,
00203     // (un)markForDelete).
00204     // <br>- <src>isScratch=True</src> indicates that a scratch table
00205     // is created (<src>oldName</src> is empty) or renamed
00206     // (<src>oldName</src> is not empty).
00207     // <br>- <src>isScratch=False</src> indicates that a scratch table
00208     // with name <src>name</src> is not scratch anymore (because it is
00209     // closed or because its state is set to non-scratch).
00210     typedef void ScratchCallback (const String& name, Bool isScratch,
00211                                   const String& oldName);
00212 
00213     // Set the pointer to the ScratchCallback function.
00214     // It returns the current value of the pointer.
00215     // This function is called when changing the state of a table
00216     // (i.e. create, close, rename, (un)markForDelete).
00217     static ScratchCallback* setScratchCallback (ScratchCallback*);
00218 
00219 
00220     // Create a null Table object (i.e. a NullTable is attached).
00221     // The sole purpose of this constructor is to allow construction
00222     // of an array of Table objects.
00223     // The assignment operator can be used to make a null object
00224     // reference a proper table.
00225     Table();
00226 
00227     // Create a table object for an existing table.
00228     // The only options allowed are Old, Update, and Delete.
00229     // If the name of a table description is given, it is checked
00230     // if the table has that description.
00231     // Locking options can be given (see class
00232     // <linkto class=TableLock>TableLock</linkto>.
00233     // If the table with this name was already opened in this process,
00234     // the existing and new locking options are merged using
00235     // <src>TableLock::merge</src>.
00236     // The default locking mechanism is DefaultLocking. If the table
00237     // is not open yet, it comes to AutoLocking with an inspection interval
00238     // of 5 seconds. Otherwise DefaultLocking keeps the locking options
00239     // of the already open table.
00240     // <group>
00241     explicit Table (const String& tableName, TableOption = Table::Old,
00242                     const TSMOption& = TSMOption());
00243     Table (const String& tableName, const TableLock& lockOptions,
00244            TableOption = Table::Old, const TSMOption& = TSMOption());
00245     Table (const String& tableName, const String& tableDescName,
00246            TableOption = Table::Old, const TSMOption& = TSMOption());
00247     Table (const String& tableName, const String& tableDescName,
00248            const TableLock& lockOptions, TableOption = Table::Old,
00249            const TSMOption& = TSMOption());
00250     // </group>
00251 
00252     // Make a new empty table (plain (scratch) or memory type).
00253     // Columns should be added to make it a real one.
00254     // Note that the endian format is only relevant for plain tables.
00255     explicit Table (TableType, EndianFormat = Table::AipsrcEndian,
00256                     const TSMOption& = TSMOption());
00257 
00258     // Make a table object for a new table, which can thereafter be used
00259     // for reading and writing.
00260     // If there are unbound columns, default storage managers an/ord virtual
00261     // column engines will be created and bound to those columns.
00262     // Create the table with the given nr of rows. If a storage manager
00263     // is used which does not allow addition of rows, the number of rows
00264     // in the table must already be given here.
00265     // Optionally the rows can be initialized with the default
00266     // values as defined in the column descriptions.
00267     // Locking options can be given (see class
00268     // <linkto class=TableLock>TableLock</linkto>.
00269     // The default locking mechanism is AutoLocking with a default
00270     // inspection interval of 5 seconds.
00271     // <br>The data will be stored in the given endian format.
00272     // <group>
00273     explicit Table (SetupNewTable&, uInt nrrow = 0, Bool initialize = False,
00274                     EndianFormat = Table::AipsrcEndian,
00275                     const TSMOption& = TSMOption());
00276     Table (SetupNewTable&, TableType,
00277            uInt nrrow = 0, Bool initialize = False,
00278            EndianFormat = Table::AipsrcEndian, const TSMOption& = TSMOption());
00279     Table (SetupNewTable&, TableType, const TableLock& lockOptions,
00280            uInt nrrow = 0, Bool initialize = False,
00281            EndianFormat = Table::AipsrcEndian, const TSMOption& = TSMOption());
00282     Table (SetupNewTable&, TableLock::LockOption,
00283            uInt nrrow = 0, Bool initialize = False,
00284            EndianFormat = Table::AipsrcEndian, const TSMOption& = TSMOption());
00285     Table (SetupNewTable&, const TableLock& lockOptions,
00286            uInt nrrow = 0, Bool initialize = False,
00287            EndianFormat = Table::AipsrcEndian, const TSMOption& = TSMOption());
00288     // </group>
00289 
00290     // Create a table object as the virtual concatenation of
00291     // one or more of existing tables. The descriptions of all those tables
00292     // must be exactly the same.
00293     // <br>The keywordset of the virtual table is the set of the first table
00294     // including its subtables. However, it is possible to specify the names
00295     // of the subtables that have to be concantenated as well.
00296     // <br>In this way a concatenation of multiple MS-s can be made, where it
00297     // can be specified that, say, the SYSCAL table has to be concatenated too.
00298     // <br> When a concatenated table is written and if a non-empty
00299     // <src>subDirName</src> is given, the tables to be concatenated will be
00300     // moved to that subdirectory in the directory of the concatenated table.
00301     // This option is mainly used by the MSS structure used in CASA.
00302     // <br>
00303     // The only open options allowed are Old and Update.
00304     // Locking options can be given (see class
00305     // <linkto class=TableLock>TableLock</linkto>.
00306     // They apply to all underlying tables.
00307     // If a table was already opened in this process,
00308     // the existing and new locking options are merged using
00309     // <src>TableLock::merge</src>.
00310     // The default locking mechanism is DefaultLocking. If the table
00311     // is not open yet, it comes to AutoLocking with an inspection interval
00312     // of 5 seconds. Otherwise DefaultLocking keeps the locking options
00313     // of the already open table.
00314     // <group>
00315     explicit Table (const Block<Table>& tables,
00316                     const Block<String>& subTables = Block<String>(),
00317                     const String& subDirName = String());
00318     explicit Table (const Block<String>& tableNames,
00319                     const Block<String>& subTables = Block<String>(),
00320                     TableOption = Table::Old, const TSMOption& = TSMOption(),
00321                     const String& subDirName = String());
00322     Table (const Block<String>& tableNames,
00323            const Block<String>& subTables,
00324            const TableLock& lockOptions,
00325            TableOption = Table::Old, const TSMOption& = TSMOption());
00326     // </group>
00327 
00328     // Copy constructor (reference semantics).
00329     Table (const Table&);
00330 
00331     // The destructor flushes (i.e. writes) the table if it is opened
00332     // for output and not marked for delete.
00333     // It will flush if the destructor is called due to an exception,
00334     // because the Table object may not be correct.
00335     // Of course, in that case the flush function could be called explicitly.
00336     // <br>It is virtual, so an object of a derived class like MeasurementSet
00337     // is destructed correctly through a Table pointer.
00338     virtual ~Table();
00339 
00340     // Assignment (reference semantics).
00341     Table& operator= (const Table&);
00342 
00343     // Try to open a table. The name of the table can contain subtable names
00344     // using :: as separator. In this way it is possible to directly open a
00345     // subtable of a RefTable or ConcatTable, which is not possible if the
00346     // table name is specified with slashes.
00347     // <br>The open process is as follows:
00348     // <ul>
00349     //  <li> It is tried to open the table with the given name.
00350     //  <li> If unsuccessful, the name is split into its parts using ::
00351     //       The first part is the main table which will be opened temporarily.
00352     //       The other parts are the successive subtable names (usually one).
00353     //       Each subtable is opened by looking it up in the keywords of the
00354     //       table above. The final subtable is returned.
00355     // </ul>
00356     // <br>An exception is thrown if the table cannot be opened.
00357     // <example>
00358     // Open the ANTENNA subtable of an MS which might be a selection of
00359     // a real MS.
00360     // <srcblock>
00361     // Table tab(Table::openTable ("sel.ms::ANTENNA");
00362     // </srcblock>
00363     // </example>
00364     // <group>
00365     static Table openTable (const String& tableName,
00366                             TableOption = Table::Old,
00367                             const TSMOption& = TSMOption());
00368     static Table openTable (const String& tableName,
00369                             const TableLock& lockOptions,
00370                             TableOption = Table::Old,
00371                             const TSMOption& = TSMOption());
00372     // </group>
00373 
00374     // Get the names of the tables this table consists of.
00375     // For a plain table it returns its name,
00376     // for a RefTable the name of the parent, and
00377     // for a ConcatTable the names of all its parts.
00378     // <br>Note that a part can be any type of table (e.g. a ConcatTable).
00379     // The recursive switch tells how to deal with that.
00380     Block<String> getPartNames (Bool recursive=False) const;
00381 
00382     // Is the root table of this table the same as that of the other one?
00383     Bool isSameRoot (const Table& other) const;
00384 
00385     // Can the table be deleted?
00386     // If true, function deleteTable can safely be called.
00387     // If not, message contains the reason why (e.g. 'table is not writable').
00388     // It checks if the table is writable, is not open in this process
00389     // and is not open in another process.
00390     // <br>If <src>checkSubTables</src> is set, it also checks if
00391     // a subtable is not open in another process.
00392     // <group>
00393     static Bool canDeleteTable (const String& tableName,
00394                                 Bool checkSubTables=False);
00395     static Bool canDeleteTable (String& message, const String& tableName,
00396                                 Bool checkSubTables=False);
00397     // </group>
00398 
00399     // Delete the table.
00400     // An exception is thrown if the table cannot be deleted because
00401     // its is not writable or because it is still open in this or
00402     // another process.
00403     // <br>If <src>checkSubTables</src> is set, it is also checked if
00404     // a subtable is used in another process.
00405     static void deleteTable (const String& tableName,
00406                              Bool checkSubTables=False);
00407 
00408     // Close all open subtables.
00409     void closeSubTables() const;
00410 
00411     // Try to reopen the table for read/write access.
00412     // An exception is thrown if the table is not writable.
00413     // Nothing is done if the table is already open for read/write.
00414     void reopenRW();
00415 
00416     // Get the endian format in which the table is stored.
00417     Table::EndianFormat endianFormat() const;
00418 
00419     // Get the storage option used for the table.
00420     const StorageOption& storageOption() const;
00421 
00422     // Is the table used (i.e. open) in this process.
00423     static Bool isOpened (const String& tableName);
00424 
00425     // Is the table used (i.e. open) in another process.
00426     // If <src>checkSubTables</src> is set, it is also checked if
00427     // a subtable is used in another process.
00428     Bool isMultiUsed (Bool checkSubTables=False) const;
00429 
00430     // Get the locking options.
00431     const TableLock& lockOptions() const;
00432 
00433     // Has this process the read or write lock, thus can the table
00434     // be read or written safely?
00435     // <group>
00436     Bool hasLock (FileLocker::LockType = FileLocker::Write) const;
00437     Bool hasLock (Bool write) const;
00438     // </group>
00439 
00440     // Try to lock the table for read or write access (default is write).
00441     // The number of attempts (default = forever) can be specified when
00442     // acquiring the lock does not succeed immediately. If nattempts>1,
00443     // the system waits 1 second between each attempt, so nattempts
00444     // is more or less equal to a wait period in seconds.
00445     // The return value is false if acquiring the lock failed.
00446     // If <src>PermanentLocking</src> is in effect, a lock is already
00447     // present, so nothing will be done.
00448     // <group>
00449     Bool lock (FileLocker::LockType = FileLocker::Write, uInt nattempts = 0);
00450     Bool lock (Bool write, uInt nattempts = 0);
00451     // </group>
00452 
00453     // Unlock the table. This will also synchronize the table data,
00454     // thus force the data to be written to disk.
00455     // If <src>PermanentLocking</src> is in effect, nothing will be done.
00456     void unlock();
00457 
00458     // Determine the number of locked tables opened with the AutoLock option
00459     // (Locked table means locked for read and/or write).
00460     static uInt nAutoLocks();
00461 
00462     // Unlock locked tables opened with the AutoLock option.
00463     // If <src>all=True</src> all such tables will be unlocked.
00464     // If <src>all=False</src> only tables requested by another process
00465     // will be unlocked.
00466     static void relinquishAutoLocks (Bool all = False);
00467 
00468     // Get the names of tables locked in this process.
00469     // By default all locked tables are given (note that a write lock
00470     // implies a read lock), but it is possible to select on lock type
00471     // FileLocker::Write and on option (TableLock::AutoLocking,
00472     // TableLock::ReadLocking, or TableLock::PermanentLocking).
00473     static Vector<String> getLockedTables(FileLocker::LockType=FileLocker::Read,
00474                                           int lockOption=-1);
00475 
00476     // Determine if column or keyword table data have changed
00477     // (or is being changed) since the last time this function was called.
00478     Bool hasDataChanged();
00479 
00480     // Flush the table, i.e. write out the buffers. If <src>sync=True</src>,
00481     // it is ensured that all data are physically written to disk.
00482     // Nothing will be done if the table is not writable.
00483     // At any time a flush can be executed, even if the table is marked
00484     // for delete.
00485     // If the table is marked for delete, the destructor will remove
00486     // files written by intermediate flushes.
00487     // Note that if necessary the destructor will do an implicit flush,
00488     // unless it is executed due to an exception.
00489     // <br>If <src>fsync=True</src> the file contents are fsync-ed to disk,
00490     // thus ensured that the system buffers are actually written to disk.
00491     // <br>If <src>recursive=True</src> all subtables are flushed too.
00492     void flush (Bool fsync=False, Bool recursive=False);
00493 
00494     // Resynchronize the Table object with the table file.
00495     // This function is only useful if no read-locking is used, ie.
00496     // if the table lock option is UserNoReadLocking or AutoNoReadLocking.
00497     // In that cases the table system does not acquire a read-lock, thus
00498     // does not synchronize itself automatically.
00499     void resync();
00500 
00501     // Test if the object is null, i.e. does not reference a proper table.
00502     // This is the case if the default constructor is used.
00503     Bool isNull() const
00504       { return (baseTabPtr_p == 0  ?  True : baseTabPtr_p->isNull()); }
00505 
00506     // Throw an exception if the object is null, i.e.
00507     // if function isNull() is True.
00508     void throwIfNull() const;
00509 
00510     // Test if the given data type is native to the table system.
00511     // If not, a virtual column engine is needed to store data with that type.
00512     // With the function DataType::whatType it can be used in a templated
00513     // function like:
00514     // <srcblock>
00515     //     if (Table::isNativeDataType (whatType(static_cast<T*>(0)))) {
00516     // </srcblock>
00517     static Bool isNativeDataType (DataType dtype);
00518 
00519     // Make the table file name.
00520     static String fileName (const String& tableName);
00521 
00522     // Test if a table with the given name exists and is readable.
00523     // If not, an exception is thrown if <src>throwIf==True</src>.
00524     static Bool isReadable (const String& tableName, bool throwIf=False);
00525 
00526     // Return the layout of a table (i.e. description and #rows).
00527     // This function has the advantage that only the minimal amount of
00528     // information required is read from the table, thus it is much
00529     // faster than a normal table open.
00530     // <br> The number of rows is returned. The description of the table
00531     // is stored in desc (its contents will be overwritten).
00532     // <br> An exception is thrown if the table does not exist.
00533     static uInt getLayout (TableDesc& desc, const String& tableName);
00534 
00535     // Get the table info of the table with the given name.
00536     // An empty object is returned if the table is unknown.
00537     static TableInfo tableInfo (const String& tableName);
00538 
00539     // Show the structure of the table.
00540     // It shows the columns (with types), the data managers, and the subtables.
00541     // Optionally the columns can be sorted alphabetically.
00542     void showStructure (std::ostream&,
00543                         Bool showDataMans=True,
00544                         Bool showColumns=True,
00545                         Bool showSubTables=False,
00546                         Bool sortColumns=False,
00547                         Bool cOrder=False) const;
00548 
00549     // Show the table and/or column keywords, possibly also of all subtables.
00550     // Maximum <src>maxVal> values of Arrays will be shown.
00551     void showKeywords (std::ostream&,
00552                        Bool showSubTables=False,
00553                        Bool showTabKey=True,
00554                        Bool showColKey=False,
00555                        Int maxVal=25) const;
00556   
00557     // Show the table and/or column keywords of this table.
00558     // Maximum <src>maxVal> values of Arrays will be shown.
00559     void showKeywordSets (std::ostream&,
00560                           Bool showTabKey, Bool showColKey,
00561                           Int maxVal) const;
00562 
00563     // Test if a table with the given name exists and is writable.
00564     static Bool isWritable (const String& tableName, bool throwIf=False);
00565 
00566     // Find the non-writable files in a table.
00567     static Vector<String> nonWritableFiles (const String& tableName);
00568 
00569     // Test if this table is the root table (ie. if it is not the subset
00570     // of another table).
00571     Bool isRootTable() const;
00572 
00573     // Test if this table is opened as writable.
00574     Bool isWritable() const;
00575 
00576     // Test if the given column is writable.
00577     // <group>
00578     Bool isColumnWritable (const String& columnName) const;
00579     Bool isColumnWritable (uInt columnIndex) const;
00580     // </group>
00581 
00582     // Test if the given column is stored (otherwise it is virtual).
00583     // <group>
00584     Bool isColumnStored (const String& columnName) const;
00585     Bool isColumnStored (uInt columnIndex) const;
00586     // </group>
00587 
00588     // Get readonly access to the table keyword set.
00589     // If UserLocking is used, it will automatically acquire
00590     // and release a read lock if the table is not locked.
00591     const TableRecord& keywordSet() const;
00592 
00593     // Get read/write access to the table keyword set.
00594     // This requires that the table is locked (or it gets locked
00595     // if using AutoLocking mode).
00596     TableRecord& rwKeywordSet();
00597 
00598     // Get access to the TableInfo object.
00599     // <group>
00600     const TableInfo& tableInfo() const;
00601     TableInfo& tableInfo();
00602     // </group>
00603 
00604     // Write the TableInfo object.
00605     // Usually this is not necessary, because it is done automatically
00606     // when the table gets written (by table destructor or flush function).
00607     // This function is only useful if the table info has to be written
00608     // before the table gets written (e.g. when another process reads
00609     // the table while it gets filled).
00610     void flushTableInfo() const;
00611 
00612     // Get the table description.
00613     // This can be used to get nr of columns, etc..
00614     // <src>tableDesc()</src> gives the table description used when
00615     // constructing the table, while <src>actualTableDesc()</src> gives the
00616     // actual description, thus with the actual data managers used.
00617     // <group>
00618     const TableDesc& tableDesc() const;
00619     TableDesc actualTableDesc() const;
00620     // </group>
00621 
00622     // Return all data managers used and the columns served by them.
00623     // The info is returned in a record. It contains a subrecord per
00624     // data manager. Each subrecord contains the following fields:
00625     // <dl>
00626     //  <dt> TYPE
00627     //  <dd> a string giving the type of the data manager.
00628     //  <dt> NAME
00629     //  <dd> a string giving the name of the data manager.
00630     //  <dt> COLUMNS
00631     //  <dd> a vector of strings giving the columns served by the data manager.
00632     // </dl>
00633     // Data managers may return some additional fields (e.g. BUCKETSIZE).
00634     Record dataManagerInfo() const;
00635 
00636     // Get the table name.
00637     const String& tableName() const;
00638 
00639     // Rename the table and all its subtables.
00640     // The following options can be given:
00641     // <dl>
00642     // <dt> Table::Update
00643     // <dd> A table with this name must already exists, which will be
00644     //      overwritten. When succesfully renamed, the table is unmarked
00645     //      for delete (if necessary).
00646     // <dt> Table::New
00647     // <dd> If a table with this name exists, it will be overwritten.
00648     //      When succesfully renamed, the table is unmarked
00649     //      for delete (if necessary).
00650     // <dt> Table::NewNoReplace
00651     // <dd> If a table with this name already exists, an exception
00652     //      is thrown. When succesfully renamed, the table
00653     //      is unmarked for delete (if necessary).
00654     // <dt> Table::Scratch
00655     // <dd> Same as Table::New, but followed by markForDelete().
00656     // </dl>
00657     // The scratchCallback function is called when needed.
00658     void rename (const String& newName, TableOption);
00659 
00660     // Copy the table and all its subtables.
00661     // Especially for RefTables <src>copy</src> and <src>deepCopy</src> behave
00662     // differently. <src>copy</src> makes a bitwise copy of the table, thus
00663     // the result is still a RefTable. On the other hand <src>deepCopy</src>
00664     // makes a physical copy of all referenced table rows and columns, thus
00665     // the result is a PlainTable.
00666     // <br>For PlainTables <src>deepCopy</src> is the same as <src>copy</src>
00667     // unless <src>valueCopy==True</src> is given. In that case the values
00668     // are copied which takes longer, but reorganizes the data files to get
00669     // rid of gaps in the data. Also if specific DataManager info is given
00670     // or if no rows have to be copied, a deep copy is made.
00671     // <br>The following options can be given:
00672     // <dl>
00673     // <dt> Table::New
00674     // <dd> If a table with this name exists, it will be overwritten.
00675     // <dt> Table::NewNoReplace
00676     // <dd> If a table with this name already exists, an exception
00677     //      is thrown.
00678     // <dt> Table::Scratch
00679     // <dd> Same as Table::New, but followed by markForDelete().
00680     // </dl>
00681     // <group>
00682     // The new table gets the given endian format. Note that the endian option
00683     // is only used if a true deep copy of a table is made.
00684     // <br>When making a deep copy, it is possible to specify the data managers
00685     // using the <src>dataManagerInfo</src> argument.
00686     // See <src>getDataManagerInfo</src> for more info about that record.
00687     // <br>If <src>noRows=True</src> no rows are copied. Also no rows are
00688     // copied in all subtables. It is useful if one wants to make a copy
00689     // of only the Table structure.
00690     void copy (const String& newName, TableOption, Bool noRows=False) const;
00691     void deepCopy (const String& newName,
00692                    TableOption, Bool valueCopy=False,
00693                    EndianFormat=AipsrcEndian,
00694                    Bool noRows=False) const;
00695     void deepCopy (const String& newName, const Record& dataManagerInfo,
00696                    TableOption, Bool valueCopy=False,
00697                    EndianFormat=AipsrcEndian,
00698                    Bool noRows=False) const;
00699     void deepCopy (const String& newName, const Record& dataManagerInfo,
00700                    const StorageOption&,
00701                    TableOption, Bool valueCopy=False,
00702                    EndianFormat=AipsrcEndian,
00703                    Bool noRows=False) const;
00704     // </group>
00705 
00706     // Make a copy of a table to a MemoryTable object.
00707     // Use the given name for the memory table.
00708     Table copyToMemoryTable (const String& name, Bool noRows=False) const;
00709 
00710     // Get the table type.
00711     TableType tableType() const;
00712 
00713     // Get the table option.
00714     int tableOption() const;
00715 
00716     // Mark the table for delete.
00717     // This means that the underlying table gets deleted when it is
00718     // actually destructed.
00719     // The scratchCallback function is called when needed.
00720     void markForDelete();
00721 
00722     // Unmark the table for delete.
00723     // This means the underlying table does not get deleted when destructed.
00724     // The scratchCallback function is called when needed.
00725     void unmarkForDelete();
00726 
00727     // Test if the table is marked for delete.
00728     Bool isMarkedForDelete() const;
00729     
00730     // Get the number of rows.
00731     // It is unsynchronized meaning that it will not check if another
00732     // process updated the table, thus possible increased the number of rows.
00733     // If one wants to take that into account, he should acquire a
00734     // read-lock (using the lock function) before using nrow().
00735     uInt nrow() const;
00736 
00737     // Test if it is possible to add a row to this table.
00738     // It is possible if all storage managers used for the table
00739     // support it.
00740     Bool canAddRow() const;
00741 
00742     // Add one or more rows at the end of the table.
00743     // This will fail for tables not supporting addition of rows.
00744     // Optionally the rows can be initialized with the default
00745     // values as defined in the column descriptions.
00746     void addRow (uInt nrrow = 1, Bool initialize = False);
00747 
00748     // Test if it is possible to remove a row from this table.
00749     // It is possible if all storage managers used for the table
00750     // support it.
00751     Bool canRemoveRow() const;
00752 
00753     // Remove the given row(s).
00754     // The latter form can be useful with the select and rowNumbers functions
00755     // to remove some selected rows from the table.
00756     // <br>It will fail for tables not supporting removal of rows.
00757     // <note role=warning>
00758     // The following code fragments do NOT have the same result:
00759     // <srcblock>
00760     //    tab.removeRow (10);      // remove row 10
00761     //    tab.removeRow (20);      // remove row 20, which was 21
00762     //    Vector<uInt> vec(2);
00763     //    vec(0) = 10;
00764     //    vec(1) = 20;
00765     //    tab.removeRow (vec);     // remove row 10 and 20
00766     // </srcblock>
00767     // because in the first fragment removing row 10 turns the former
00768     // row 21 into row 20.
00769     // </note>
00770     // <group>
00771     void removeRow (uInt rownr);
00772     void removeRow (const Vector<uInt>& rownrs);
00773     // </group>
00774 
00775     // Create a TableExprNode object for a column or for a keyword
00776     // in the table keyword set.
00777     // This can be used in selecting rows from a table using
00778     // <src>operator()</src> described below.
00779     // <br>The functions taking the fieldNames vector are meant for
00780     // the cases where the keyword or column contains records.
00781     // The fieldNames indicate which field to take from that record
00782     // (which can be a record again, etc.).
00783     // <group name=keycol>
00784     TableExprNode key (const String& keywordName) const;
00785     TableExprNode key (const Vector<String>& fieldNames) const;
00786     TableExprNode col (const String& columnName) const;
00787     TableExprNode col (const String& columnName,
00788                        const Vector<String>& fieldNames) const;
00789     TableExprNode keyCol (const String& name,
00790                           const Vector<String>& fieldNames) const;
00791     // </group>
00792 
00793     // Create a TableExprNode object for the rownumber function.
00794     // 'origin' Indicates which rownumber is the first.
00795     // C++ uses origin = 0 (default)
00796     // Glish and TaQL both use origin = 1
00797     TableExprNode nodeRownr (uInt origin=0) const;
00798 
00799     // Create a TableExprNode object for the rand function.
00800     TableExprNode nodeRandom () const;
00801 
00802     // Select rows from a table using an select expression consisting
00803     // of TableExprNode objects.
00804     // Basic TableExprNode objects can be created with the functions
00805     // <linkto file="Table.h#keycol">key</linkto> and especially
00806     // <linkto file="Table.h#keycol">col</linkto>.
00807     // Composite TableExprNode objects, representing an expression,
00808     // can be created by applying operations (like == and +)
00809     // to the basic ones. This is described in class
00810     // <linkto class="TableExprNode:description">TableExprNode</linkto>.
00811     // For example:
00812     // <srcblock>
00813     //    Table result = tab(tab.col("columnName") > 10);
00814     // </srcblock>
00815     // All rows for which the expression is true, will be selected and
00816     // "stored" in the result.
00817     // You need to include ExprNode.h for this purpose.
00818     // <br>The first <src>offset</src> matching rows will be skipped.
00819     // <br>If <src>maxRow>0</src>, the selection process will stop
00820     // when <src>maxRow</src> rows are selected.
00821     // <br>The TableExprNode argument can be empty (null) meaning that only
00822     // the <src>maxRow/offset</src> arguments are taken into account.
00823     Table operator() (const TableExprNode&, uInt maxRow=0, uInt offset=0) const;
00824 
00825     // Select rows using a vector of row numbers.
00826     // This can, for instance, be used to select the same rows as
00827     // were selected in another table (using the rowNumbers function).
00828     // <srcblock>
00829     //     Table result = thisTable (otherTable.rowNumbers());
00830     // </srcblock>
00831     Table operator() (const Vector<uInt>& rownrs) const;
00832 
00833     // Select rows using a mask block.
00834     // The length of the block must match the number of rows in the table.
00835     // If an element in the mask is True, the corresponding row will be
00836     // selected.
00837     Table operator() (const Block<Bool>& mask) const;
00838 
00839     // Project the given columns (i.e. select the columns).
00840     Table project (const Block<String>& columnNames) const;
00841 
00842     //# Virtually concatenate all tables in this column.
00843     //# The column cells must contain tables with the same description.
00844 //#//    Table concatenate (const String& columnName) const;
00845 
00846     // Do logical operations on a table.
00847     // It can be used for row-selected or projected (i.e. column-selected)
00848     // tables. The tables involved must come from the same root table or
00849     // be the root table themselves.
00850     // <group>
00851     // Intersection with another table.
00852     Table operator& (const Table&) const;
00853     // Union with another table.
00854     Table operator| (const Table&) const;
00855     // Subtract another table.
00856     Table operator- (const Table&) const;
00857     // Xor with another table.
00858     Table operator^ (const Table&) const;
00859     // Take complement.
00860     Table operator! () const;
00861     // </group>
00862 
00863     // Sort a table on one or more columns of scalars.
00864     // Per column a compare function can be provided. By default
00865     // the standard compare function defined in Compare.h will be used.
00866     // Default sort order is ascending.
00867     // Default sorting algorithm is the parallel sort.
00868     // <group>
00869     // Sort on one column.
00870     Table sort (const String& columnName,
00871                 int = Sort::Ascending,
00872                 int = Sort::ParSort) const;
00873     // Sort on multiple columns. The principal column has to be the
00874     // first element in the Block of column names.
00875     Table sort (const Block<String>& columnNames,
00876                 int = Sort::Ascending,
00877                 int = Sort::ParSort) const;
00878     // Sort on multiple columns. The principal column has to be the
00879     // first element in the Block of column names.
00880     // The order can be given per column.
00881     Table sort (const Block<String>& columnNames,
00882                 const Block<Int>& sortOrders,
00883                 int = Sort::ParSort) const;
00884     // Sort on multiple columns. The principal column has to be the
00885     // first element in the Block of column names.
00886     // The order can be given per column.
00887     // Provide some special comparisons via CountedPtrs of compare objects.
00888     // A null CountedPtr means using the standard compare object
00889     // from class <linkto class="ObjCompare:description">ObjCompare</linkto>.
00890     Table sort (const Block<String>& columnNames,
00891                 const Block<CountedPtr<BaseCompare> >& compareObjects,
00892                 const Block<Int>& sortOrders,
00893                 int = Sort::ParSort) const;
00894     // </group>
00895 
00896     // Get a vector of row numbers in the root table of rows in this table.
00897     // In case the table is a subset of the root table, this tells which
00898     // rows of the root table are part of the subset.
00899     // In case the table is the root table itself, the result is a vector
00900     // containing the row numbers 0 .. #rows-1.
00901     // <br>Note that in general it is better to use the next
00902     // <src>rowNumbers(Table)</src> function.
00903     Vector<uInt> rowNumbers() const;
00904 
00905     // Get a vector of row numbers in that table of rows in this table.
00906     // In case the table is a subset of that table, this tells which
00907     // rows of that table are part of the subset.
00908     // In case the table is that table itself, the result is a vector
00909     // containing the row numbers 0 .. #rows-1.
00910     // <note role=caution>This function is in principle meant for cases
00911     // where this table is a subset of that table. However, it can be used
00912     // for any table. In that case the returned vector contains a very high
00913     // number (max_uint) for rows in this table not part of that table.
00914     // In that way they are invalid if used elsewhere.
00915     // <br>In the general case creating the row number vector can be slowish,
00916     // because it has to do two mappings. However, if this table is a subset
00917     // of that table and if they are in the same order, the mapping can be done
00918     // in a more efficient way. The argument <src>tryFast</src> can be used to
00919     // tell the function to try a fast conversion first. If that cannot be done,
00920     // it reverts to the slower way at the expense of an unsuccessful fast
00921     // attempt.
00922     // </note>
00923     // <srcblock>
00924     // Table tab("somename");
00925     // Table subset = tab(some_select_expression);
00926     // Vector<uInt> rownrs = subset.rowNumbers(tab);
00927     // </srcblock>
00928     // Note that one cannot be sure that table "somename" is the root
00929     // (i.e. original) table. It may also be a subset of another table.
00930     // In the latter case doing
00931     // <br> <src>    Vector<uInt> rownrs = subset.rowNumbers()</src>
00932     // does not give the row numbers in <src>tab</src>, but in the root table
00933     // (which is probably not what you want).
00934   Vector<uInt> rowNumbers (const Table& that, Bool tryFast=False) const;
00935 
00936     // Add a column to the table.
00937     // The data manager used for the column depend on the function used.
00938     // Exceptions are thrown if the column already exist or if the
00939     // table is not writable.
00940     // <br>If this table is a reference table (result of selection) and if
00941     // <src>addToParent=True</src> the column is also added to the parent
00942     // table.
00943     // <group>
00944     // Use the first appropriate existing storage manager.
00945     // If there is none, a data manager is created using the default
00946     // data manager in the column description.
00947     void addColumn (const ColumnDesc& columnDesc,
00948                     Bool addToParent = True);
00949     // Use an existing data manager with the given name or type.
00950     // If the flag byName is True, a name is given, otherwise a type.
00951     // If a name is given, an exception is thrown if the data manager is
00952     // unknown or does not allow addition of columns.
00953     // If a type is given, a storage manager of the given type will be
00954     // created if there is no such data manager allowing addition of rows.
00955     void addColumn (const ColumnDesc& columnDesc,
00956                     const String& dataManager, Bool byName,
00957                     Bool addToParent = True);
00958     // Use the given data manager (which is a new one).
00959     void addColumn (const ColumnDesc& columnDesc,
00960                     const DataManager& dataManager,
00961                     Bool addToParent = True);
00962     // </group>
00963 
00964     // Add a bunch of columns using the given new data manager.
00965     // All columns and possible hypercolumn definitions in the given table
00966     // description will be copied and added to the table.
00967     // This can be used in case of specific data managers which need to
00968     // be created with more than one column (e.g. the tiled hypercube
00969     // storage managers).
00970     // <br>The data manager can be given directly or by means of a record
00971     // describing the data manager in the standard way with the fields
00972     // TYPE, NAME, and SPEC. The record can contain those fields itself
00973     // or it can contain a single subrecord with those fields.
00974     // <br>If this table is a reference table (result of selection) and if
00975     // <src>addToParent=True</src> the columns are also added to the parent
00976     // table.
00977     // <group>
00978     void addColumn (const TableDesc& tableDesc,
00979                     const DataManager& dataManager,
00980                     Bool addToParent = True);
00981     void addColumn (const TableDesc& tableDesc,
00982                     const Record& dataManagerInfo,
00983                     Bool addToParent = True);
00984     // </group>
00985 
00986     // Test if columns can be removed.
00987     // It can if the columns exist and if the data manager it is using
00988     // supports removal of columns or if all columns from a data manager
00989     // would be removed..
00990     // <br>You can always remove columns from a reference table.
00991     // <group>
00992     Bool canRemoveColumn (const String& columnName) const;
00993     Bool canRemoveColumn (const Vector<String>& columnNames) const;
00994     // </group>
00995 
00996     // Remove columns.
00997     // <br>When removing columns from a reference table, the columns
00998     // are NOT removed from the underlying table.
00999     // <group>
01000     void removeColumn (const String& columnName);
01001     void removeColumn (const Vector<String>& columnName);
01002     // </group>
01003 
01004     // Test if a column can be renamed.
01005     Bool canRenameColumn (const String& columnName) const;
01006 
01007     // Rename a column.
01008     // An exception is thrown if the old name does not exist or
01009     // if the name already exists.
01010     // <note role=caution>
01011     // Renaming a column should be done with care, because other
01012     // columns may be referring this column. Also a hypercolumn definition
01013     // might be using the old name.
01014     // Finally if may also invalidate persistent selections of a table,
01015     // because the reference table cannot find the column anymore.
01016     // </note>
01017     void renameColumn (const String& newName, const String& oldName);
01018 
01019     void renameHypercolumn (const String& newName, const String& oldName);
01020 
01021     // Write a table to AipsIO (for <src>TypedKeywords<Table></src>).
01022     // This will only write the table name.
01023     friend AipsIO& operator<< (AipsIO&, const Table&);
01024 
01025     // Read a table from AipsIO (for <src>TypedKeywords<Table></src>).
01026     // This will read the table name and open the table as writable
01027     // if the table file is writable, otherwise as readonly.
01028     friend AipsIO& operator>> (AipsIO&, Table&);
01029 
01030     // Read a table from AipsIO (for <src>TableKeywords</src>).
01031     // This will read the table name and open the table as writable
01032     // if the switch is set and if the table file is writable.
01033     // otherwise it is opened as readonly.
01034     void getTableKeyword (AipsIO&, Bool openWritable);
01035 
01036     // Write a table to ostream (for <src>TypedKeywords<Table></src>).
01037     // This only shows its name and number of columns and rows.
01038     friend ostream& operator<< (ostream&, const Table&);
01039 
01040     // Find the data manager with the given name or for the given column name.
01041     DataManager* findDataManager (const String& name,
01042                                   Bool byColumn=False) const;
01043 
01044 
01045 protected:
01046     BaseTable*  baseTabPtr_p;                 //# ptr to table representation
01047     //# The isCounted_p flag is normally true.
01048     //# Only for internally used Table objects (i.e. in the DataManager)
01049     //# this flag is False, otherwise a mutual dependency would exist.
01050     //# The DataManager has a Table object, which gets deleted by the
01051     //# DataManager destructor. The DataManager gets deleted by the
01052     //# PlainTable destructor, which gets called when the last Table
01053     //# object gets destructed. That would never be the case if this
01054     //# internally used Table object was counted.
01055     Bool        isCounted_p;
01056     //# Counter of last call to hasDataChanged.
01057     uInt        lastModCounter_p;
01058     //# Pointer to the ScratchCallback function.
01059     static ScratchCallback* scratchCallback_p;
01060 
01061 
01062     // Construct a Table object from a BaseTable*.
01063     // By default the object gets counted.
01064     Table (BaseTable*, Bool countIt = True);
01065 
01066     // Open an existing table.
01067     void open (const String& name, const String& type, int tableOption,
01068                const TableLock& lockOptions, const TSMOption& tsmOpt);
01069 
01070 
01071 private:
01072     // Construct a BaseTable object from the table file.
01073     static BaseTable* makeBaseTable (const String& name, const String& type,
01074                                      int tableOption,
01075                                      const TableLock& lockOptions,
01076                                      const TSMOption& tsmOpt,
01077                                      Bool addToCache, uInt locknr);
01078 
01079 
01080     // Get the pointer to the underlying BaseTable.
01081     // This is needed for some friend classes.
01082     BaseTable* baseTablePtr() const;
01083 
01084     // Look in the cache if the table is already open.
01085     // If so, check if table option matches.
01086     // If needed reopen the table for read/write and merge the lock options.
01087     BaseTable* lookCache (const String& name, int tableOption,
01088                           const TableLock& tableInfo);
01089 
01090     // Try if v1 is a subset of v2 and fill rows with its indices in v2.
01091     // Return False if not a proper subset.
01092     Bool fastRowNumbers (const Vector<uInt>& v1, const Vector<uInt>& v2,
01093                          Vector<uInt>& rows) const;
01094 
01095     // Show the info of the given columns.
01096     // Sort the columns if needed.
01097     void showColumnInfo (ostream& os, const TableDesc&, uInt maxNameLength,
01098                          const Array<String>& columnNames, Bool sort) const;
01099 };
01100 
01101 
01102 
01103 inline Bool Table::isSameRoot (const Table& other) const
01104     { return baseTabPtr_p->root() == other.baseTabPtr_p->root(); }
01105 
01106 inline void Table::reopenRW()
01107     { baseTabPtr_p->reopenRW(); }
01108 inline void Table::flush (Bool fsync, Bool recursive)
01109     { baseTabPtr_p->flush (fsync, recursive); }
01110 inline void Table::resync()
01111     { baseTabPtr_p->resync(); }
01112 
01113 inline const StorageOption& Table::storageOption() const
01114     { return baseTabPtr_p->storageOption(); }
01115 inline Bool Table::isMultiUsed(Bool checkSubTables) const
01116     { return baseTabPtr_p->isMultiUsed(checkSubTables); }
01117 inline const TableLock& Table::lockOptions() const
01118     { return baseTabPtr_p->lockOptions(); }
01119 inline Bool Table::lock (FileLocker::LockType type, uInt nattempts)
01120     { return baseTabPtr_p->lock (type, nattempts); }
01121 inline Bool Table::lock (Bool write, uInt nattempts)
01122 {
01123     return baseTabPtr_p->lock (write ? FileLocker::Write : FileLocker::Read,
01124                                nattempts);
01125 }
01126 inline void Table::unlock()
01127     { baseTabPtr_p->unlock(); }
01128 inline Bool Table::hasLock (FileLocker::LockType type) const
01129     { return baseTabPtr_p->hasLock (type); }
01130 inline Bool Table::hasLock (Bool write) const
01131 {
01132     return baseTabPtr_p->hasLock (write ? FileLocker::Write : FileLocker::Read);
01133 }
01134 
01135 inline Bool Table::isRootTable() const
01136     { return baseTabPtr_p == baseTabPtr_p->root(); }
01137 
01138 inline Bool Table::isWritable() const
01139     { return baseTabPtr_p->isWritable(); }
01140 inline Bool Table::isColumnWritable (const String& columnName) const
01141     { return baseTabPtr_p->isColumnWritable (columnName); }
01142 inline Bool Table::isColumnWritable (uInt columnIndex) const
01143     { return baseTabPtr_p->isColumnWritable (columnIndex); }
01144 
01145 inline Bool Table::isColumnStored (const String& columnName) const
01146     { return baseTabPtr_p->isColumnStored (columnName); }
01147 inline Bool Table::isColumnStored (uInt columnIndex) const
01148     { return baseTabPtr_p->isColumnStored (columnIndex); }
01149 
01150 inline void Table::rename (const String& newName, TableOption option)
01151     { baseTabPtr_p->rename (newName, option); }
01152 inline void Table::deepCopy (const String& newName,
01153                              const Record& dataManagerInfo,
01154                              TableOption option,
01155                              Bool valueCopy,
01156                              EndianFormat endianFormat,
01157                              Bool noRows) const
01158     { baseTabPtr_p->deepCopy (newName, dataManagerInfo, StorageOption(),
01159                               option, valueCopy,
01160                               endianFormat, noRows); }
01161 inline void Table::deepCopy (const String& newName,
01162                              const Record& dataManagerInfo,
01163                              const StorageOption& stopt,
01164                              TableOption option,
01165                              Bool valueCopy,
01166                              EndianFormat endianFormat,
01167                              Bool noRows) const
01168     { baseTabPtr_p->deepCopy (newName, dataManagerInfo, stopt,
01169                               option, valueCopy,
01170                               endianFormat, noRows); }
01171 inline void Table::markForDelete()
01172     { baseTabPtr_p->markForDelete (True, ""); }
01173 inline void Table::unmarkForDelete()
01174     { baseTabPtr_p->unmarkForDelete(True, ""); }
01175 inline Bool Table::isMarkedForDelete() const
01176     { return baseTabPtr_p->isMarkedForDelete(); }
01177 
01178 inline uInt Table::nrow() const
01179     { return baseTabPtr_p->nrow(); }
01180 inline BaseTable* Table::baseTablePtr() const
01181     { return baseTabPtr_p; }
01182 inline const TableDesc& Table::tableDesc() const
01183     { return baseTabPtr_p->tableDesc(); }
01184 inline const TableRecord& Table::keywordSet() const
01185     { return baseTabPtr_p->keywordSet(); }
01186 
01187 inline TableInfo Table::tableInfo (const String& tableName)
01188     { return BaseTable::tableInfo (tableName); }
01189 inline const TableInfo& Table::tableInfo() const
01190     { return baseTabPtr_p->tableInfo(); }
01191 inline TableInfo& Table::tableInfo()
01192     { return baseTabPtr_p->tableInfo(); }
01193 inline void Table::flushTableInfo() const
01194     { baseTabPtr_p->flushTableInfo(); }
01195 
01196 inline const String& Table::tableName() const
01197     { return baseTabPtr_p->tableName(); }
01198 inline Table::TableType Table::tableType() const
01199     { return TableType(baseTabPtr_p->tableType()); }
01200 inline int Table::tableOption() const
01201     { return baseTabPtr_p->tableOption(); }
01202 
01203 inline Bool Table::canAddRow() const
01204     { return baseTabPtr_p->canAddRow(); }
01205 inline Bool Table::canRemoveRow() const
01206     { return baseTabPtr_p->canRemoveRow(); }
01207 inline Bool Table::canRemoveColumn (const Vector<String>& columnNames) const
01208     { return baseTabPtr_p->canRemoveColumn (columnNames); }
01209 inline Bool Table::canRenameColumn (const String& columnName) const
01210     { return baseTabPtr_p->canRenameColumn (columnName); }
01211 
01212 inline void Table::addRow (uInt nrrow, Bool initialize)
01213     { baseTabPtr_p->addRow (nrrow, initialize); }
01214 inline void Table::removeRow (uInt rownr)
01215     { baseTabPtr_p->removeRow (rownr); }
01216 inline void Table::removeRow (const Vector<uInt>& rownrs)
01217     { baseTabPtr_p->removeRow (rownrs); }
01218 inline void Table::addColumn (const ColumnDesc& columnDesc, Bool addToParent)
01219     { baseTabPtr_p->addColumn (columnDesc, addToParent); }
01220 inline void Table::addColumn (const ColumnDesc& columnDesc,
01221                               const String& dataManager, Bool byName,
01222                               Bool addToParent)
01223     { baseTabPtr_p->addColumn (columnDesc, dataManager, byName, addToParent); }
01224 inline void Table::addColumn (const ColumnDesc& columnDesc,
01225                               const DataManager& dataManager, Bool addToParent)
01226     { baseTabPtr_p->addColumn (columnDesc, dataManager, addToParent); }
01227 inline void Table::addColumn (const TableDesc& tableDesc,
01228                               const DataManager& dataManager, Bool addToParent)
01229     { baseTabPtr_p->addColumn (tableDesc, dataManager, addToParent); }
01230 inline void Table::addColumn (const TableDesc& tableDesc,
01231                               const Record& dataManagerInfo, Bool addToParent)      { baseTabPtr_p->addColumns (tableDesc, dataManagerInfo, addToParent); }
01232 inline void Table::removeColumn (const Vector<String>& columnNames)
01233     { baseTabPtr_p->removeColumn (columnNames); }
01234 inline void Table::renameColumn (const String& newName, const String& oldName)
01235     { baseTabPtr_p->renameColumn (newName, oldName); }
01236 inline void Table::renameHypercolumn (const String& newName, const String& oldName)
01237     { baseTabPtr_p->renameHypercolumn (newName, oldName); }
01238 
01239 inline DataManager* Table::findDataManager (const String& name,
01240                                             Bool byColumn) const
01241 {
01242   return baseTabPtr_p->findDataManager (name, byColumn);
01243 }
01244 
01245 inline void Table::showStructure (std::ostream& os,
01246                                   Bool showDataMans,
01247                                   Bool showColumns,
01248                                   Bool showSubTables,
01249                                   Bool sortColumns,
01250                                   Bool cOrder) const
01251     { baseTabPtr_p->showStructure (os, showDataMans, showColumns,
01252                                    showSubTables, sortColumns, cOrder); }
01253 
01254 
01255 
01256 } //# NAMESPACE CASACORE - END
01257 
01258 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 31 Aug 2016 for casa by  doxygen 1.6.1