casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | Static Protected Attributes
casa::MSTable< ColEnum, KeyEnum > Class Template Reference

A Table intended to hold astronomical data. More...

#include <MSTable.h>

Inheritance diagram for casa::MSTable< ColEnum, KeyEnum >:
casa::Table

List of all members.

Public Member Functions

Bool validate () const
 validate self (make sure that this MS is valid)

Static Public Member Functions

static Bool validate (const TableDesc &tabDesc)
 tableDesc convenience functions
static Bool validate (const TableRecord &tabKeySet)
 check that the keyword set is valid
static const TableDescrequiredTableDesc ()
 return the required table description
static void addColumnCompression (TableDesc &td, ColEnum which, Bool autoScale=True, const String &type=String())
 Add the compress option for the given column to the TableDesc.

Protected Member Functions

 ~MSTable ()
MSTableoperator= (const MSTable< ColEnum, KeyEnum > &)
 Assignment operator, reference semantics.
Table referenceCopy (const String &newTableName, const Block< String > &writableColumns) const
 Return a table that references all columns in this table except for those given in writableColumns, those are empty and writable.
 MSTable ()
 
     

 MSTable (const String &tableName, TableOption option)
 MSTable (const String &tableName, const TableLock &lockOptions, TableOption option)
 MSTable (const String &tableName, const String &tableDescName, TableOption option)
 MSTable (const String &tableName, const String &tableDescName, const TableLock &lockOptions, TableOption option)
 MSTable (SetupNewTable &newTab, uInt nrrow, Bool initialize)
 MSTable (SetupNewTable &newTab, const TableLock &lockOptions, uInt nrrow, Bool initialize)
 MSTable (const Table &table)
 MSTable (const MSTable< ColEnum, KeyEnum > &other)

Static Protected Member Functions

static void colMapDef (ColEnum col, const String &colName, DataType colType, const String &colComment, const String &colUnit="", const String &colMeasureType="")
 Define an entry in the column maps.
static void keyMapDef (KeyEnum key, const String &keyName, DataType keyType, const String &keyComment)
 Define an entry in the keyword maps.

Static Protected Attributes

static SimpleOrderedMap< Int,
String
columnMap_p
 These are the static ordered maps which contain the above info ColEnum -> name.
static SimpleOrderedMap< Int, IntcolDTypeMap_p
 ColEnum -> DataType.
static SimpleOrderedMap< Int,
String
colCommentMap_p
 ColEnum -> comment string.
static SimpleOrderedMap< Int,
String
colUnitMap_p
 ColEnum -> UNIT string.
static SimpleOrderedMap< Int,
String
colMeasureTypeMap_p
 ColEnum -> MEASURE_TYPE string.
static SimpleOrderedMap< Int,
String
keywordMap_p
 KeyEnum -> name.
static SimpleOrderedMap< Int, IntkeyDTypeMap_p
 KeyEnum -> DataType.
static SimpleOrderedMap< Int,
String
keyCommentMap_p
 KeyEnum -> comment string.
static SimpleCountedConstPtr
< TableDesc
requiredTD_p
 The required TableDesc.
Bool isColumn (ColEnum which) const
 ColEnum convenience functions.
Bool isColumnWritable (ColEnum which) const
 check to see if a column is writable
Bool isColumnWritable (const String &columnName) const
 Test if the given column is writable.
Bool isColumnWritable (uInt columnIndex) const
Bool isScalar (ColEnum which) const
 Information about scalar vs array of a column.
Bool isArray (ColEnum which) const
const Stringunit (const String &which) const
 Return the UNIT keyword value associated with the specified column.
const Stringunit (ColEnum which) const
Bool isKeyword (KeyEnum which) const
 check to see if a keyword exists
static const StringcolumnName (ColEnum which)
 Convert a ColEnum to the actual column name.
static ColEnum columnType (const String &name)
 Convert a name to a ColEnum.
static DataType columnDataType (ColEnum which)
 return the data type for a given ColEnum
static const StringcolumnStandardComment (ColEnum which)
 return the standard comment for a given ColEnum
static const StringcolumnUnit (ColEnum which)
 return the UNIT string for a given ColEnum
static const StringcolumnMeasureType (ColEnum which)
 return the MEASURE_TYPE string for a given ColEnum
static void addColumnToDesc (TableDesc &tabDesc, ColEnum which, Int ndim=-1, const String &refCol="")
 add a column to a TableDesc An exception is thrown for an invalid data type.
static void addColumnToDesc (TableDesc &tabDesc, ColEnum which, const IPosition &shape, ColumnDesc::Option option, const String &refCol="")
 add a column to a TableDesc, defining the shape and setting the ColumnDesc option (Fixed, Undefined, Direct) For Measure columns you can define a variable reference column.
static const StringkeywordName (KeyEnum which)
 KeyEnum convenience functions.
static KeyEnum keywordType (const String &name)
static DataType keywordDataType (KeyEnum which)
static const StringkeywordStandardComment (KeyEnum which)
static void addKeyToDesc (TableDesc &tabDesc, KeyEnum key)
 add a keyword to a TableDesc An exception is thrown for an invalid data type.

Detailed Description

template<class ColEnum, class KeyEnum>
class casa::MSTable< ColEnum, KeyEnum >

A Table intended to hold astronomical data.

Intended use:

Public interface

Review Status

Reviewed By:
Bob Garwood
Date Reviewed:
1997/02/01

Prerequisite

Etymology

The MSTable is the base class for all MeasurementSet Tables, hence the name.

Synopsis

A MSTable is a Table. Most operations on a MSTable are Table operations. See the Tables module for a list of those operations. The member functions provided by this class are primarily convenience functions to help users follow the agreed upon column and keyword naming conventions. They are useful when creating a Table following the MSTable conventions from scratch as well as when creating the column objects to access those columns. All actual MeasurementSet Tables will be derived from this class.

The standard way of accessing table columns is through Strings. Mistakes in typing the column name will not be caught at compile time (and may not be caught at run time). We have therefore decided to use an enumeration to specify columns so that many mistakes will be caught at compile time. This requires functions to map to and from this enumeration to the strings that are ultimately used.

Upon destruction, the table is checked to see that all required columns and keywords are still present. If not an exception is thrown. Nevertheless, the table will be flushed to disk if it is writable - preserving its state.

Example

For examples of use, see the MeasurementSet class.

Motivation

The Table module is more than adequate as a container of data. However, in order for applications to be useful with data from different sources, some conventions need to be adopted in the use of Tables to store data. The MSTable provides the framework for these conventions and conversion functions. The actual definitions of columns and keywords are found in the derived classes and their "enum" base class (e.g. MSAntenna and MSAntennaEnums).

To Do

Definition at line 112 of file MSTable.h.


Constructor & Destructor Documentation

template<class ColEnum, class KeyEnum>
casa::MSTable< ColEnum, KeyEnum >::MSTable ( ) [protected]

     

These constructors mirror the Table ones Default constructor for use by derived classes

template<class ColEnum, class KeyEnum>
casa::MSTable< ColEnum, KeyEnum >::MSTable ( const String tableName,
TableOption  option 
) [protected]
template<class ColEnum, class KeyEnum>
casa::MSTable< ColEnum, KeyEnum >::MSTable ( const String tableName,
const TableLock lockOptions,
TableOption  option 
) [protected]
template<class ColEnum, class KeyEnum>
casa::MSTable< ColEnum, KeyEnum >::MSTable ( const String tableName,
const String tableDescName,
TableOption  option 
) [protected]
template<class ColEnum, class KeyEnum>
casa::MSTable< ColEnum, KeyEnum >::MSTable ( const String tableName,
const String tableDescName,
const TableLock lockOptions,
TableOption  option 
) [protected]
template<class ColEnum, class KeyEnum>
casa::MSTable< ColEnum, KeyEnum >::MSTable ( SetupNewTable newTab,
uInt  nrrow,
Bool  initialize 
) [protected]
template<class ColEnum, class KeyEnum>
casa::MSTable< ColEnum, KeyEnum >::MSTable ( SetupNewTable newTab,
const TableLock lockOptions,
uInt  nrrow,
Bool  initialize 
) [protected]
template<class ColEnum, class KeyEnum>
casa::MSTable< ColEnum, KeyEnum >::MSTable ( const Table table) [protected]
template<class ColEnum, class KeyEnum>
casa::MSTable< ColEnum, KeyEnum >::MSTable ( const MSTable< ColEnum, KeyEnum > &  other) [protected]
template<class ColEnum, class KeyEnum>
casa::MSTable< ColEnum, KeyEnum >::~MSTable ( ) [protected]

Member Function Documentation

template<class ColEnum, class KeyEnum>
static void casa::MSTable< ColEnum, KeyEnum >::addColumnCompression ( TableDesc td,
ColEnum  which,
Bool  autoScale = True,
const String type = String() 
) [static]

Add the compress option for the given column to the TableDesc.

It can only be used for a Float or a Complex column. For complex columns the type determines which CompressComplex engine is used. "SD" means that CompressComplexSD is used; otherwise CompressComplex is used.

template<class ColEnum, class KeyEnum>
static void casa::MSTable< ColEnum, KeyEnum >::addColumnToDesc ( TableDesc tabDesc,
ColEnum  which,
Int  ndim = -1,
const String refCol = "" 
) [static]

add a column to a TableDesc An exception is thrown for an invalid data type.

This indicates a programming error in this class when this occurs. For Array columns you can optionally define the dimension here. For Measure columns you can define a variable reference column.

Thrown Exceptions

template<class ColEnum, class KeyEnum>
static void casa::MSTable< ColEnum, KeyEnum >::addColumnToDesc ( TableDesc tabDesc,
ColEnum  which,
const IPosition shape,
ColumnDesc::Option  option,
const String refCol = "" 
) [static]

add a column to a TableDesc, defining the shape and setting the ColumnDesc option (Fixed, Undefined, Direct) For Measure columns you can define a variable reference column.

template<class ColEnum, class KeyEnum>
static void casa::MSTable< ColEnum, KeyEnum >::addKeyToDesc ( TableDesc tabDesc,
KeyEnum  key 
) [static]

add a keyword to a TableDesc An exception is thrown for an invalid data type.

This indicates a missing data type in the code..

Thrown Exceptions

template<class ColEnum, class KeyEnum>
static void casa::MSTable< ColEnum, KeyEnum >::colMapDef ( ColEnum  col,
const String colName,
DataType  colType,
const String colComment,
const String colUnit = "",
const String colMeasureType = "" 
) [static, protected]

Define an entry in the column maps.

template<class ColEnum, class KeyEnum>
static DataType casa::MSTable< ColEnum, KeyEnum >::columnDataType ( ColEnum  which) [static]

return the data type for a given ColEnum

template<class ColEnum, class KeyEnum>
static const String& casa::MSTable< ColEnum, KeyEnum >::columnMeasureType ( ColEnum  which) [static]

return the MEASURE_TYPE string for a given ColEnum

template<class ColEnum, class KeyEnum>
static const String& casa::MSTable< ColEnum, KeyEnum >::columnName ( ColEnum  which) [static]
template<class ColEnum, class KeyEnum>
static const String& casa::MSTable< ColEnum, KeyEnum >::columnStandardComment ( ColEnum  which) [static]

return the standard comment for a given ColEnum

template<class ColEnum, class KeyEnum>
static ColEnum casa::MSTable< ColEnum, KeyEnum >::columnType ( const String name) [static]

Convert a name to a ColEnum.

template<class ColEnum, class KeyEnum>
static const String& casa::MSTable< ColEnum, KeyEnum >::columnUnit ( ColEnum  which) [static]

return the UNIT string for a given ColEnum

template<class ColEnum, class KeyEnum>
Bool casa::MSTable< ColEnum, KeyEnum >::isArray ( ColEnum  which) const
template<class ColEnum, class KeyEnum>
Bool casa::MSTable< ColEnum, KeyEnum >::isColumn ( ColEnum  which) const

ColEnum convenience functions.

check to see if a column exists

template<class ColEnum, class KeyEnum>
Bool casa::MSTable< ColEnum, KeyEnum >::isColumnWritable ( ColEnum  which) const
template<class ColEnum, class KeyEnum>
Bool casa::MSTable< ColEnum, KeyEnum >::isColumnWritable ( const String columnName) const [inline]

Test if the given column is writable.

Reimplemented from casa::Table.

Definition at line 123 of file MSTable.h.

template<class ColEnum, class KeyEnum>
Bool casa::MSTable< ColEnum, KeyEnum >::isColumnWritable ( uInt  columnIndex) const [inline]

Reimplemented from casa::Table.

Definition at line 125 of file MSTable.h.

template<class ColEnum, class KeyEnum>
Bool casa::MSTable< ColEnum, KeyEnum >::isKeyword ( KeyEnum  which) const

check to see if a keyword exists

template<class ColEnum, class KeyEnum>
Bool casa::MSTable< ColEnum, KeyEnum >::isScalar ( ColEnum  which) const

Information about scalar vs array of a column.

template<class ColEnum, class KeyEnum>
static void casa::MSTable< ColEnum, KeyEnum >::keyMapDef ( KeyEnum  key,
const String keyName,
DataType  keyType,
const String keyComment 
) [static, protected]

Define an entry in the keyword maps.

template<class ColEnum, class KeyEnum>
static DataType casa::MSTable< ColEnum, KeyEnum >::keywordDataType ( KeyEnum  which) [static]
template<class ColEnum, class KeyEnum>
static const String& casa::MSTable< ColEnum, KeyEnum >::keywordName ( KeyEnum  which) [static]

KeyEnum convenience functions.

template<class ColEnum, class KeyEnum>
static const String& casa::MSTable< ColEnum, KeyEnum >::keywordStandardComment ( KeyEnum  which) [static]
template<class ColEnum, class KeyEnum>
static KeyEnum casa::MSTable< ColEnum, KeyEnum >::keywordType ( const String name) [static]
template<class ColEnum, class KeyEnum>
MSTable& casa::MSTable< ColEnum, KeyEnum >::operator= ( const MSTable< ColEnum, KeyEnum > &  ) [protected]

Assignment operator, reference semantics.

template<class ColEnum, class KeyEnum>
Table casa::MSTable< ColEnum, KeyEnum >::referenceCopy ( const String newTableName,
const Block< String > &  writableColumns 
) const [protected]
template<class ColEnum, class KeyEnum>
static const TableDesc& casa::MSTable< ColEnum, KeyEnum >::requiredTableDesc ( ) [static]

return the required table description

template<class ColEnum, class KeyEnum>
const String& casa::MSTable< ColEnum, KeyEnum >::unit ( const String which) const

Return the UNIT keyword value associated with the specified column.

template<class ColEnum, class KeyEnum>
const String& casa::MSTable< ColEnum, KeyEnum >::unit ( ColEnum  which) const [inline]
template<class ColEnum, class KeyEnum>
static Bool casa::MSTable< ColEnum, KeyEnum >::validate ( const TableDesc tabDesc) [static]

tableDesc convenience functions

check that a TableDesc is valid

template<class ColEnum, class KeyEnum>
static Bool casa::MSTable< ColEnum, KeyEnum >::validate ( const TableRecord tabKeySet) [static]

check that the keyword set is valid

template<class ColEnum, class KeyEnum>
Bool casa::MSTable< ColEnum, KeyEnum >::validate ( ) const [inline]

validate self (make sure that this MS is valid)

Definition at line 204 of file MSTable.h.

Referenced by casa::MSTable< MSPointingEnums::PredefinedColumns, MSPointingEnums::PredefinedKeywords >::validate().


Member Data Documentation

template<class ColEnum, class KeyEnum>
SimpleOrderedMap<Int, String> casa::MSTable< ColEnum, KeyEnum >::colCommentMap_p [static, protected]

ColEnum -> comment string.

Definition at line 251 of file MSTable.h.

template<class ColEnum, class KeyEnum>
SimpleOrderedMap<Int, Int> casa::MSTable< ColEnum, KeyEnum >::colDTypeMap_p [static, protected]

ColEnum -> DataType.

Definition at line 249 of file MSTable.h.

template<class ColEnum, class KeyEnum>
SimpleOrderedMap<Int, String> casa::MSTable< ColEnum, KeyEnum >::colMeasureTypeMap_p [static, protected]

ColEnum -> MEASURE_TYPE string.

Definition at line 255 of file MSTable.h.

template<class ColEnum, class KeyEnum>
SimpleOrderedMap<Int, String> casa::MSTable< ColEnum, KeyEnum >::columnMap_p [static, protected]

These are the static ordered maps which contain the above info ColEnum -> name.

Definition at line 247 of file MSTable.h.

template<class ColEnum, class KeyEnum>
SimpleOrderedMap<Int, String> casa::MSTable< ColEnum, KeyEnum >::colUnitMap_p [static, protected]

ColEnum -> UNIT string.

Definition at line 253 of file MSTable.h.

template<class ColEnum, class KeyEnum>
SimpleOrderedMap<Int, String> casa::MSTable< ColEnum, KeyEnum >::keyCommentMap_p [static, protected]

KeyEnum -> comment string.

Definition at line 263 of file MSTable.h.

template<class ColEnum, class KeyEnum>
SimpleOrderedMap<Int, Int> casa::MSTable< ColEnum, KeyEnum >::keyDTypeMap_p [static, protected]

KeyEnum -> DataType.

Definition at line 261 of file MSTable.h.

template<class ColEnum, class KeyEnum>
SimpleOrderedMap<Int, String> casa::MSTable< ColEnum, KeyEnum >::keywordMap_p [static, protected]

KeyEnum -> name.

Definition at line 259 of file MSTable.h.

template<class ColEnum, class KeyEnum>
SimpleCountedConstPtr<TableDesc> casa::MSTable< ColEnum, KeyEnum >::requiredTD_p [static, protected]

The required TableDesc.

static TableDesc requiredTD_p;

Definition at line 268 of file MSTable.h.


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