casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
TableProxy.h
Go to the documentation of this file.
00001 //# TableProxy.h: High-level interface to tables
00002 //# Copyright (C) 1994,1995,1996,1997,1998,1999,2000,2001,2002,2003,2005
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 received 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: TableProxy.h 21025 2011-03-03 15:09:00Z gervandiepen $
00027 
00028 #ifndef TABLES_TABLEPROXY_H
00029 #define TABLES_TABLEPROXY_H
00030 
00031 
00032 //# Includes
00033 #include <casa/aips.h>
00034 #include <tables/Tables/Table.h>
00035 #include <casa/Containers/Record.h>
00036 #include <casa/Arrays/Vector.h>
00037 #include <vector>
00038 
00039 #include <casa/namespace.h>
00040 
00041 //# Forward Declarations
00042 namespace casa { //# NAMESPACE CASA - BEGIN
00043   class ValueHolder;
00044   class RecordFieldId;
00045   class Table;
00046   class TableLock;
00047   class ColumnDesc;
00048   class TableExprNode;
00049   template<class T> class Vector;
00050   class Slicer;
00051 
00052 
00053 // <summary>
00054 // High-level interface to tables
00055 // </summary>
00056 
00057 // <use visibility=export>
00058 
00059 // <reviewed reviewer="Paul Shannon" date="1995/09/15" tests="tgtable.g" demos="">
00060 // </reviewed>
00061 
00062 // <prerequisite>
00063 //# Classes you should understand before using this one.
00064 //   <li> class Table
00065 //   <li> class GlishTableHolder
00066 //   <li> class GlishTableIteratorHolder
00067 //   <li> class GlishTableRowHolder
00068 //   <li> program gtable
00069 //   <li> script gtable.g
00070 // </prerequisite>
00071 
00072 // <etymology>
00073 // TableProxy is a proxy for access to tables from any script.
00074 // </etymology>
00075 
00076 // <synopsis> 
00077 // TableProxy gives access to most of the functionality in the Table System.
00078 // It is primarily meant to be used in classes that wrap access to it
00079 // from scripting languages (like Glish and Python).
00080 // However, it can also be used directly from other C++ code.
00081 //
00082 // It has functions to open, create, read, write, and query tables.
00083 // Accompying proxy classes give access to other functionality. They are:
00084 // <ul>
00085 //  <li> <linkto class=TableIterProxy>TableIterProxy</linkto> for iteration
00086 //       through a table using class
00087 //       <linkto class=TableIterator>TableIterator</linkto>.
00088 //  <li> <linkto class=TableRowProxy>TableRowProxy</linkto> for access to
00089 //       table rows using class <linkto class=TableRow>TableRow</linkto>.
00090 //  <li> <linkto class=TableIndexProxy>TableIterProxy</linkto> for faster
00091 //       indexed access to using classes
00092 //       <linkto class=ColumnsIndex>ColumnsIndex</linkto> and
00093 //       <linkto class=ColumnsIndexArray>ColumnsIndexArray</linkto>.
00094 // </ul>
00095 //
00096 // TableProxy does not have the TableRecord type in its interface, because
00097 // such a type cannot be handled by e.g. Glish or Python. Instead it
00098 // converts TableRecords to/from Records. If a TableRecord contains a field
00099 // with a Table object, it is represented in the Record as a string
00100 // with the value "Table: NAME" where NAME is the table name.
00101 // </synopsis>
00102 
00103 // <motivation>
00104 // TableProxy is the Tasking-independent high-level table interface.
00105 // Different front-ends (e.g. GlishTableProxy) can be put on top of it.
00106 // </motivation>
00107 
00108 class TableProxy
00109 {
00110 public:
00111   // Default constructor initializes to not open.
00112   // This constructor is only needed for containers.
00113   TableProxy();
00114 
00115   // Create the object from an existing table (used by some methods).
00116   TableProxy (const Table& table)
00117     : table_p (table) {}
00118 
00119   // Open the table with a given name.
00120   TableProxy (const String& tableName,
00121               const Record& lockOptions,
00122               int option);
00123 
00124   // Create a table with given name and description, etc.
00125   TableProxy (const String& tableName,
00126               const Record& lockOptions,
00127               const String& endianFormat,
00128               const String& memType,
00129               int nrow,
00130               const Record& tableDesc,
00131               const Record& dmInfo);
00132 
00133   // Create a table object to concatenate a number of similar tables.
00134   // The keyword set of the first table is take as the keyword set of the
00135   // entire concatenation. However, it can be specified which subtables
00136   // have to be concatenated as well which means that for each subtable name
00137   // the subtable in the keywordsets are concatenated.
00138   // <note>For Boost-Python the constructors must have different nr of arguments.
00139   // Hence some dummy arguments are added.
00140   //</note>
00141   // <group>
00142   TableProxy (const Vector<String>& tableNames,
00143               const Vector<String>& concatenateSubTableNames, 
00144               const Record& lockOptions,
00145               int option);
00146   TableProxy (const std::vector<TableProxy>& tables,
00147               const Vector<String>& concatenateSubTableNames,
00148               int dummy1=0, int dummy2=0, int dummy3=0);
00149   // </group>
00150 
00151   // Create a table object from a table command (as defined in TableGram).
00152   // <br>If a CALC command was given, the resulting values are stored in
00153   // the a record and a null TableProxy object is returned.
00154   // The result can be obtained using getCalcResult.
00155   // <note>
00156   // If the command string contains no GIVING part, the resulting
00157   // table is temporary and its name is blank.
00158   // </note>
00159   TableProxy (const String& command,
00160               const std::vector<TableProxy>& tables);
00161 
00162   // Create a table from an Ascii file.
00163   // It fills a string containing the names and types
00164   // of the columns (in the form COL1=R, COL2=D, ...).
00165   // The string can be obtained using getAsciiFormat.
00166   TableProxy (const String& fileName,
00167               const String& headerName,
00168               const String& tableName,
00169               Bool autoHeader,
00170               const IPosition& autoShape,
00171               const String& separator,
00172               const String& commentMarker,
00173               Int firstLine,
00174               Int lastLine,
00175               const Vector<String>& columnNames = Vector<String>(),
00176               const Vector<String>& dataTypes = Vector<String>());
00177 
00178   // Copy constructor.
00179   TableProxy (const TableProxy&);
00180 
00181   // Close the table.
00182   ~TableProxy();
00183 
00184   // Assignment.
00185   TableProxy& operator= (const TableProxy&);
00186 
00187   // Select the given rows from the table and create a new (reference) table.
00188   // If outName is not empty, the new table is made persistent with that name.
00189   TableProxy selectRows (const Vector<Int>& rownrs,
00190                          const String& outName);
00191 
00192   // Reopen the table for read/write.
00193   void reopenRW();
00194 
00195   // Resync the table.
00196   void resync();
00197 
00198   // Flush the table and optionally all its subtables.
00199   void flush (Bool recursive);
00200 
00201   // Flush and close the table and all its subtables.
00202   void close();
00203 
00204   // Get the endian format of the table.
00205   // It fills the result with value "big" or "little".
00206   String endianFormat() const;
00207 
00208   // Acquire a (read or write) lock on the table.
00209   void lock (Bool mode, Int nattempts);
00210 
00211   // Release a lock on the table.
00212   void unlock();
00213 
00214   // Determine if data in the table has changed.
00215   Bool hasDataChanged();
00216 
00217   // Determine if the process has a read or write lock on the table.
00218   Bool hasLock (Bool mode);
00219 
00220   // Get the lock options of the table.
00221   // It fills the record with the fields option, interval and maxwait.
00222   Record lockOptions();
00223 
00224   // Determine if the table (and optionally its subtables) are in use
00225   // in another process.
00226   Bool isMultiUsed (Bool checkSubTables);
00227 
00228   // Write the table to an ASCII file
00229   // (approximately the inverse of the from-ASCII-contructor).
00230   // If <src>headerFile</src> is empty or equal to <src>asciiFile</src>, the
00231   // headers are written in the same file as the data, otherwise in a separate
00232   // file.
00233   // If no columns are given (or if the first column name is empty), all
00234   // table columns are written. Columns containing records are also printed
00235   // (enclosed in {}), but a warning message is returned.
00236   // <br>Argument <src>sep</src> is used as separator between columns and
00237   // array values. If it is empty, a blank is used.
00238   // <br>For each column the precision can be given. It is only used for
00239   // columns containing floating point numbers. A value <=0 means using the
00240   // default which is 9 for single and 18 for double precision.
00241   // <br>If <src>useBrackets=True</src>, arrays are enclosed in [] (for each
00242   // dimension), so variable shaped arrays can be read back unambiguously.
00243   // The type in the header will be something like D[4,64]. If the column is
00244   // variable shaped, the type is like D[].
00245   // If <src>useBracket=False</src>, arrays are written linearly where a
00246   // shape [4,64] is given in the header like D4,64. If the column is variable
00247   // shaped, the shape of the first cell is used and a warning message is
00248   // returned.
00249   String toAscii (const String& asciiFile, 
00250                   const String& headerFile, 
00251                   const Vector<String>& columns, 
00252                   const String& sep,
00253                   const Vector<Int>& precision,
00254                   Bool useBrackets);
00255 
00256   // Rename the table
00257   void rename (const String& newTableName);
00258 
00259   // Copy the table (possibly a deep copy).
00260   // If noRows=True, an empty table is created.
00261   TableProxy copy (const String& newTableName,
00262                    Bool toMemoryTable,
00263                    Bool deepCopy,
00264                    Bool valueCopy,
00265                    const String& endianFormat,
00266                    const Record& dminfo,
00267                    Bool noRows);
00268 
00269   // Copy rows from one table to another.
00270   // If startOut<0, it is set to the end of the output table.
00271   void copyRows (TableProxy& out,
00272                  Int startIn,
00273                  Int startOut,
00274                  Int nrow);
00275 
00276   // Close and delete the table.
00277   void deleteTable (Bool checkSubTables);
00278 
00279   // Get the table info of the table.
00280   Record tableInfo();
00281 
00282   // Put the table info of the table.
00283   void putTableInfo (const Record& value);
00284 
00285   // Add a line to the TableInfo readme.
00286   void addReadmeLine (const String& line);
00287 
00288   // Test if a table is readable.
00289   Bool isReadable() const;
00290 
00291   // Test if a table is writable.
00292   Bool isWritable() const;
00293 
00294   // Set the maximum cache size for the given column in the table.
00295   void setMaximumCacheSize (const String& columnName,
00296                             Int nbytes);
00297 
00298   // Add one or more columns to the table.
00299   void addColumns (const Record& tableDesc,
00300                    const Record& dminfo,
00301                    Bool addToParent);
00302 
00303   // Rename a column in the table.
00304   void renameColumn (const String& nameOld,
00305                      const String& nameNew);
00306 
00307   // Remove one or more columns from the table.
00308   void removeColumns (const Vector<String>& columnNames);
00309 
00310   // Add rows to the table.
00311   void addRow (Int nrow);
00312 
00313   // Remove rows from the table.
00314   void removeRow (const Vector<Int>& rownrs);
00315 
00316   // Get some or all values from a column in the table.
00317   // row is the starting row number (0-relative).
00318   // nrow=-1 means until the end of the table.
00319   // incr is the step in row number.
00320   // <group>
00321   ValueHolder getColumn (const String& columnName,
00322                          Int row,
00323                          Int nrow,
00324                          Int incr);
00325   Record getVarColumn (const String& columnName,
00326                        Int row,
00327                        Int nrow,
00328                        Int incr);
00329   // </group>
00330 
00331   // Get some or all value slices from a column in the table.
00332   // If the inc vector is empty, it defaults to all 1.
00333   // <group>
00334   ValueHolder getColumnSlice (const String& columnName,
00335                               Int row,
00336                               Int nrow,
00337                               Int incr,
00338                               const Vector<Int>& blc,
00339                               const Vector<Int>& trc,
00340                               const Vector<Int>& inc);
00341   ValueHolder getColumnSliceIP (const String& columnName,
00342                                 const IPosition& blc,
00343                                 const IPosition& trc,
00344                                 const IPosition& inc,
00345                                 Int row,
00346                                 Int nrow,
00347                                 Int incr);
00348   // </group>
00349 
00350   // Put some or all values into a column in the table.
00351   // row is the starting row number (0-relative).
00352   // nrow=-1 means until the end of the table.
00353   // incr is the step in row number.
00354   // <group>
00355   void putColumn (const String& columnName,
00356                   Int row,
00357                   Int nrow,
00358                   Int incr,
00359                   const ValueHolder&);
00360   void putVarColumn (const String& columnName,
00361                      Int row,
00362                      Int nrow,
00363                      Int incr,
00364                      const Record& values);
00365   // </group>
00366 
00367   // Put some or all value slices into a column in the table.
00368   // <group>
00369   void putColumnSlice (const String& columnName,
00370                        Int row,
00371                        Int nrow,
00372                        Int incr,
00373                        const Vector<Int>& blc,
00374                        const Vector<Int>& trc,
00375                        const Vector<Int>& inc,
00376                        const ValueHolder&);
00377   void putColumnSliceIP (const String& columnName,
00378                          const ValueHolder&,
00379                          const IPosition& blc,
00380                          const IPosition& trc,
00381                          const IPosition& inc,
00382                          Int row,
00383                          Int nrow,
00384                          Int incr);
00385   // </group>
00386 
00387   // Tests if the contents of a cell are defined.
00388   // Only a column with variable shaped arrays can have an empty cell.
00389   Bool cellContentsDefined (const String& columnName,
00390                             Int rownr);
00391 
00392   // Get a value from a column in the table.
00393   ValueHolder getCell (const String& columnName,
00394                        Int row);
00395 
00396   // Get a value slice from a column in the table.
00397   // If the inc vector is empty, it defaults to all 1.
00398   // <group>
00399   ValueHolder getCellSlice (const String& columnName,
00400                             Int row,
00401                             const Vector<Int>& blc,
00402                             const Vector<Int>& trc,
00403                             const Vector<Int>& inc);
00404   ValueHolder getCellSliceIP (const String& columnName,
00405                               Int row,
00406                               const IPosition& blc,
00407                               const IPosition& trc,
00408                               const IPosition& inc);
00409   // </group>
00410 
00411   // Put a value into a column in the table.
00412   void putCell (const String& columnName,
00413                 const Vector<Int>& rownrs,
00414                 const ValueHolder&);
00415 
00416   // Put a value slice into a column in the table.
00417   // If the inc vector is empty, it defaults to all 1.
00418   // <group>
00419   void putCellSlice (const String& columnName,
00420                      Int row,
00421                      const Vector<Int>& blc,
00422                      const Vector<Int>& trc,
00423                      const Vector<Int>& inc,
00424                      const ValueHolder&);
00425   void putCellSliceIP (const String& columnName,
00426                        Int row,
00427                        const ValueHolder&,
00428                        const IPosition& blc,
00429                        const IPosition& trc,
00430                        const IPosition& inc);
00431   // </group>
00432 
00433   // Get the shape of one or more cells in a column as a vector of Strings
00434   // containing the shapes as [a,b,c].
00435   // If the shape is fixed, a single String is returned.
00436   Vector<String> getColumnShapeString (const String& columnName,
00437                                        Int rownr,
00438                                        Int nrow,
00439                                        Int incr,
00440                                        Bool cOrder = False);
00441 
00442   // Get a table or column keyword value in the table.
00443   // If the columnName is empty, a given keyword is a table keyword.
00444   // The keyword can be given as a name or a 0-based index.
00445   ValueHolder getKeyword (const String& columnName,
00446                           const String& keywordName,
00447                           Int keywordIndex);
00448 
00449   // Get the table or column keyword values in the table.
00450   // If the columnName is empty, the table keyword values are returned.
00451   Record getKeywordSet (const String& columnName);
00452 
00453   // Define a table or column keyword in the table.
00454   // If the column name is empty, a table keyword is defined.
00455   // The keyword can be given as a name or a 0-based number.
00456   // The value should be a record containing the value of the keyword.
00457   // The value can be any type (including a record).
00458   void putKeyword (const String& columnName,
00459                    const String& keywordName,
00460                    Int keywordIndex,
00461                    Bool makeSubRecord,
00462                    const ValueHolder&);
00463 
00464   // Define multiple table or column keywords in the table.
00465   // If the column name is empty, a table keywords are defined.
00466   // The value should be a record containing the values of the keywords.
00467   // The values can be any type (including a record).
00468   // The field names are the keyword names.
00469   void putKeywordSet (const String& columnName,
00470                       const Record& valueSet);
00471 
00472   // Remove a table or column keyword from the table.
00473   // If the column name is empty, a table keyword is removed.
00474   void removeKeyword (const String& columnName,
00475                       const String& keywordName,
00476                       Int keywordIndex);
00477 
00478   // Get the names of all field in a record in the table.
00479   // If the column name is empty, the table keywords are used.
00480   // If the keyword name is empty, the names of all keywords are returned.
00481   // Otherwise the names of all fields in the keyword value are returned.
00482   // In that case the value has to be a record.
00483   Vector<String> getFieldNames (const String& columnName,
00484                                 const String& keywordName,
00485                                 Int keywordIndex);
00486 
00487   // Get table name.
00488   String tableName();
00489 
00490   // Get the names of the parts the table consists of (e.g. for a ConcatTable).
00491   Vector<String> getPartNames (Bool recursive);
00492 
00493   // Get #columns of the table.
00494   Int ncolumns();
00495 
00496   // Get #rows of the table.
00497   Int nrows();
00498 
00499   // Get the shape (#columns, #rows) of the table.
00500   Vector<Int> shape();
00501 
00502   // Get the row numbers of the table.
00503   Vector<Int> rowNumbers (TableProxy& other);
00504 
00505   // Get all column names in the table.
00506   Vector<String> columnNames();
00507 
00508   // Return in result if the column contains scalars.
00509   Bool isScalarColumn (const String& columnName);
00510 
00511   // Return the data type of the column as:
00512   //  Bool, UChar, Short, UShort, Int, UInt, 
00513   //  Float, Double, Complex, DComplex, String, Table, or unknown.
00514   String columnDataType (const String& columnName);
00515 
00516   // Return the type of array in the column as:
00517   //    Direct
00518   //    Undefined
00519   //    FixedShape
00520   //    Direct,Undefined
00521   //    Direct,FixedShape
00522   //    Undefined,FixedShape
00523   //    Direct,Undefined,FixedShape
00524   // or Error -- unexpected column type
00525   String columnArrayType (const String& columnName);
00526 
00527   // Get the data manager info of the table.
00528   Record getDataManagerInfo();
00529 
00530   // Get the properties of a data manager given by column or data manager name.
00531   Record getProperties (const String& name, Bool byColumn);
00532 
00533   // Set the properties of a data manager given by column or data manager name.
00534   void setProperties (const String& name, Bool byColumn,
00535                       const Record& properties);
00536 
00537   // Get the table description of the table.
00538   // It returns a record containing the description.
00539   Record getTableDescription (Bool actual,         //# use actual description?
00540                               Bool cOrder=False);
00541 
00542   // Get the column description of a column in the table.
00543   // It returns a record containing the description.
00544   Record getColumnDescription (const String& columnName,
00545                                Bool actual,        //# use actual description?
00546                                Bool cOrder=False);
00547 
00548   // Get ascii format string.
00549   String getAsciiFormat() const;
00550 
00551   // Get result of possible CALC statement.
00552   Record getCalcResult() const;
00553 
00554   // Show the structure of a table.
00555   String showStructure (Bool showDataMan=True, Bool showColumns=True,
00556                         Bool showSubTables=False, Bool sortColumns=False) const;
00557 
00558   // Return the table object.
00559   // <group>
00560   Table& table()
00561     { return table_p; }
00562   const Table& table() const
00563     { return table_p; }
00564   // </group>
00565 
00566   // Get or put the values of all keywords.
00567   // Thus convert from TableRecord to/from Record.
00568   // Keywords containing a table are converted to a string containing
00569   // the table name preceeded by 'Table: '.
00570   // <group>
00571   static Record getKeyValues (const TableRecord& keySet);
00572   static void putKeyValues (TableRecord& keySet, const Record& valueSet);
00573   // </group>
00574 
00575 
00576 private:
00577   // Get the lock options from the fields in the record.
00578   // If the record or lockoption is invalid, an exception is thrown.
00579   static TableLock makeLockOptions (const Record& options);
00580 
00581   // Turn the string into the endian format option.
00582   // An exception is thrown if the string is invalid.
00583   static Table::EndianFormat makeEndianFormat (const String& endianFormat);
00584 
00585   // Make hypercolumn definitions for the given hypercolumns.
00586   static Bool makeHC (const Record& gdesc, TableDesc& tabdesc,
00587                       String& message);
00588 
00589   // Get the column info for toAscii.
00590   Bool getColInfo (const String& colName, Bool useBrackets,
00591                    String& type, String& message);
00592 
00593   // Print the data in a table cell for toAscii.
00594   // <group>
00595   void printValueHolder (const ValueHolder& vh, ostream& os,
00596                          const String& sep, Int prec, Bool useBrackets) const;
00597   template<typename T>
00598   void printArray (const Array<T>& arr, ostream& os,
00599                    const String& sep) const;
00600   void printArrayValue (ostream& os, Bool v, const String&) const
00601     {os << v;}
00602   void printArrayValue (ostream& os, Int v, const String&) const
00603     {os << v;}
00604   void printArrayValue (ostream& os, Int64 v, const String&) const
00605     {os << v;}
00606   void printArrayValue (ostream& os, Double v, const String&) const
00607     {os << v;}
00608   void printArrayValue (ostream& os, const DComplex& v, const String&) const
00609     {os << v;}
00610   void printArrayValue (ostream& os, const String& v, const String&) const
00611     {os << '"' << v << '"';}
00612   // </group>
00613 
00614   // Check if the column name and row numbers are valid.
00615   // Return the recalculated nrow so that it does not exceed #rows.
00616   Int checkRowColumn (Table& table,
00617                       const String& colName,
00618                       Int rownr, Int nrow, Int incr,
00619                       const Char* caller);
00620 
00621   // Get values from the column.
00622   // Nrow<0 means till the end of the column.
00623   ValueHolder getValueFromTable (const String& colName, 
00624                                  Int rownr, Int nrow, Int incr,
00625                                  Bool isCell);
00626 
00627   // Get value slices from the column.
00628   // Nrow<0 means till the end of the column.
00629   ValueHolder getValueSliceFromTable(const String& colName, 
00630                                      const Slicer& slicer,
00631                                      Int rownr, Int nrow, Int incr,
00632                                      Bool isCell);
00633 
00634   // Put values into the column.
00635   // Nrow<0 means till the end of the column.
00636   void putValueInTable (const String& colName,
00637                         Int rownr, Int nrow, Int incr,
00638                         Bool isCell, const ValueHolder&);
00639 
00640   // Put value slices into the column.
00641   // Nrow<0 means till the end of the column.
00642   void putValueSliceInTable (const String& colName,
00643                              const Slicer& slicer,
00644                              Int rownr, Int nrow, Int incr,
00645                              Bool isCell, const ValueHolder&);
00646 
00647   // Split the keyname into its separate parts (separator is .).
00648   // Check if each part exists and is a subrecord (except last part).
00649   // When putting, subrecords are created if undefined and if
00650   // makeSubRecord is set.
00651   // On return it fills in the fieldid with the latest keyword part.
00652   // KeySet is set to the last subrecord.
00653   // <group>
00654   void findKeyId (RecordFieldId& fieldid,
00655                   const TableRecord*& keySet,
00656                   const String& keyname,
00657                   const String& column);
00658   void findKeyId (RecordFieldId& fieldid,
00659                   TableRecord*& keySet,
00660                   const String& keyname,
00661                   const String& column,
00662                   Bool mustExist, Bool change, Bool makeSubRecord);
00663   // </group>
00664 
00665   // Get the value of a keyword.
00666   static ValueHolder getKeyValue (const TableRecord& keySet,
00667                                   const RecordFieldId& fieldId);
00668 
00669   // Put the value of a keyword.
00670   static void putKeyValue (TableRecord& keySet,
00671                            const RecordFieldId& fieldId,
00672                            const ValueHolder& value);
00673 
00674   // Make a real table description from a table description in a record.
00675   // An exception is thrown if the record table description is invalid.
00676   // A record table description is a Record object as returned by
00677   // getDesc.
00678   static Bool makeTableDesc (const Record& gdesc, TableDesc& tabdesc,
00679                              String& message);
00680 
00681   // Add an array column description to the table description.
00682   // It is used by the function makeDesc.
00683   static Bool addArrayColumnDesc (TableDesc& tableDesc,
00684                                   const String& valueType,
00685                                   const String& columnName,
00686                                   const String& comment,
00687                                   const String& dataManagerType,
00688                                   const String& dataManagerGroup,
00689                                   int options,
00690                                   Int ndim, const Vector<Int>& shape,
00691                                   Bool cOrder,
00692                                   String& message);
00693 
00694   // Make a record containing the column description.
00695   static Record recordColumnDesc (const ColumnDesc&, Bool cOrder);
00696 
00697   // Make a record containing the description of all hypercolumns.
00698   static Record recordHCDesc (const TableDesc& tableDesc);
00699 
00700   // Replace the user-given default value (<0) by the default value
00701   // used by Slicer (i.e. by Slicer::MimicSource).
00702   void setDefaultForSlicer (IPosition& vec) const;
00703 
00704   // Calculate the values of a CALC expression and store them in field
00705   // 'values' in rec.
00706   static void calcValues (Record& rec, const TableExprNode& expr);
00707 
00708   // Synchronize table if readlocking is in effect.
00709   // In this way the number of rows is up-to-date.
00710   void syncTable (Table& table);
00711 
00712   // Get the type string as used externally (in e.g. glish).
00713   static String getTypeStr (DataType);
00714 
00715   // Optionally reverse the axes.
00716   static IPosition fillAxes (const IPosition&, Bool cOrder);
00717 
00718 
00719   //# The data members.
00720   Table  table_p;
00721   String asciiFormat_p;
00722   Record calcResult_p;
00723 };
00724 
00725 } //# NAMESPACE CASA - END
00726 
00727 #endif