Loading...
Searching...
No Matches
MSTableImpl.h
Go to the documentation of this file.
//# MSTableImpl.h: Helper class to implement common functions for MS Tables
//# Copyright (C) 1996,2000,2001,2002
//# Associated Universities, Inc. Washington DC, USA.
//#
//# This library is free software; you can redistribute it and/or modify it
//# under the terms of the GNU Library General Public License as published by
//# the Free Software Foundation; either version 2 of the License, or (at your
//# option) any later version.
//#
//# This library is distributed in the hope that it will be useful, but WITHOUT
//# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
//# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
//# License for more details.
//#
//# You should have received a copy of the GNU Library General Public License
//# along with this library; if not, write to the Free Software Foundation,
//# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
//#
//# Correspondence concerning AIPS++ should be addressed as follows:
//# Internet email: casa-feedback@nrao.edu.
//# Postal address: AIPS++ Project Office
//# National Radio Astronomy Observatory
//# 520 Edgemont Road
//# Charlottesville, VA 22903-2475 USA
#ifndef MS_MSTABLEIMPL_H
#define MS_MSTABLEIMPL_H
//# Includes
#include <casacore/casa/aips.h>
#include <casacore/ms/MeasurementSets/MeasurementSet.h>
#include <casacore/casa/Utilities/DataType.h>
#include <casacore/tables/Tables/Table.h>
#include <casacore/casa/BasicSL/String.h>
#include <casacore/tables/Tables/TableDesc.h>
#include <casacore/casa/Arrays/Vector.h>
#include <map>
namespace casacore { //# NAMESPACE CASACORE - BEGIN
//# Forward declarations
class SetupNewTable;
// <summary>
// An implementation class for the MeasurementSet to share code.
// </summary>
// <use visibility=local>
// <reviewed reviewer="Bob Garwood" date="1997/02/01" tests="" demos="">
// <prerequisite>
// <li> <linkto class=MeasurementSet:description">MeasurementSet</linkto>
// </prerequisite>
//
// <etymology>
// The MSTableImpl implements non-templated static functions shared by
// all MSTable objects.
// </etymology>
//
// <synopsis>
// MSTableImpl is only for internal use by the MeasurementSet base class
// MSTable.
// </synopsis>
//
// <example>
// </example>
//
//
// <motivation>
// The reasons for existance for this class are: sharing of code between
// the various MeasurementSet Tables and avoiding duplicate code in the
// instantiations of MSTable
// </motivation>
//
// <todo asof="1996/2/22">
// </todo>
class MSTableImpl
{
public:
// 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.
// If option!=0 shape is used to set the shape of the column and
// option defines the type of column (ColumnDesc::Fixed/Direct).
// If option==0, shape is ignored and ndim is used to specify the
// array dimension if any.
// If refCol is not empty, a column with variable reference will be
// created, note that refCol should already exist in td.
// <thrown>
// <li> AipsError
// </thrown>
static void addColumnToDesc(TableDesc &td, const String& colName,
Int colDType, const String& colComment,
const String& colUnit,
const String& colMeasure,
Int ndim, const IPosition & shape,
Int option, const String& refCol);
// 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>
// <li> AipsError
// </thrown>
static void addKeyToDesc(TableDesc& td, const String& keyName,
Int keyDType, const String& keyComment);
// add a MeasureColumn for the specified Measure, with default reference
static void addMeasColumn(TableDesc &td, const String& colName,
const String& colMeasure, const String& refCol);
// Add the compress option for the given column to the TableDesc.
static void addColumnCompression (TableDesc&, const String& colName,
Bool autoScale, const String& type);
// Setup the compression data managers if needed.
static SetupNewTable& setupCompression (SetupNewTable&);
// Define an entry in the column maps
static void colMapDef(std::map<Int,String>& colMap,
std::map<Int,Int>& colDTypeMap,
std::map<Int,String>& colCommentMap,
std::map<Int,String>& colUnitMap,
std::map<Int,String>& colMeasureTypeMap,
Int col,
const String& colName,
Int colType,
const String& colComment,
const String& colUnit,
const String& colMeasureType);
// Define an entry in the keyword maps
static void keyMapDef(std::map<Int,String>& keyMap,
std::map<Int,Int>& keyDTypeMap,
std::map<Int,String>& keyCommentMap,
Int key,
const String& keyName,
Int keyType,
const String& keyComment);
// tableDesc convenience functions
// <group>
// check that a TableDesc is valid
static Bool validate(const TableDesc& tabDesc,
const TableDesc& requiredTD);
// check that the keyword set is valid
static Bool validate(const TableRecord& tabRec,
const TableDesc& requiredTD);
// </group>
// Return a table that references all columns in this table except for
// those given in writableColumns, those are empty and writable.
static Table referenceCopy(const Table& tab, const String& newTableName,
const Block<String>& writableColumns);
// Define the initialization function for each MS table type.
// <group>
static MSTableMaps initMaps(MSMainEnums*);
static MSTableMaps initMaps(MSAntennaEnums*);
static MSTableMaps initMaps(MSDataDescriptionEnums*);
static MSTableMaps initMaps(MSDopplerEnums*);
static MSTableMaps initMaps(MSFeedEnums*);
static MSTableMaps initMaps(MSFieldEnums*);
static MSTableMaps initMaps(MSFlagCmdEnums*);
static MSTableMaps initMaps(MSFreqOffsetEnums*);
static MSTableMaps initMaps(MSHistoryEnums*);
static MSTableMaps initMaps(MSObservationEnums*);
static MSTableMaps initMaps(MSPointingEnums*);
static MSTableMaps initMaps(MSPolarizationEnums*);
static MSTableMaps initMaps(MSProcessorEnums*);
static MSTableMaps initMaps(MSSourceEnums*);
static MSTableMaps initMaps(MSSpectralWindowEnums*);
static MSTableMaps initMaps(MSStateEnums*);
static MSTableMaps initMaps(MSSysCalEnums*);
static MSTableMaps initMaps(MSWeatherEnums*);
// </group>
};
} //# NAMESPACE CASACORE - END
#endif
casacore::type
casacore::Block
simple 1-D array
Definition Block.h:198
casacore::IPosition
Definition IPosition.h:117
casacore::MSAntennaEnums
Enums for the MeasurementSet ANTENNA table.
Definition MSAntennaEnums.h:57
casacore::MSDataDescriptionEnums
Enums for the MeasurementSet DATA_DESCRIPTION table.
Definition MSDataDescEnums.h:57
casacore::MSDopplerEnums
Enums for the MeasurementSet DOPPLER table.
Definition MSDopplerEnums.h:57
casacore::MSFeedEnums
Enums for the MeasurementSet FEED table.
Definition MSFeedEnums.h:57
casacore::MSFieldEnums
Enums for the MeasurementSet FIELD table.
Definition MSFieldEnums.h:57
casacore::MSFlagCmdEnums
Enums for the MeasurementSet FLAG_CMD table.
Definition MSFlagCmdEnums.h:57
casacore::MSFreqOffsetEnums
Enums for the MeasurementSet FREQ_OFFSET table.
Definition MSFreqOffEnums.h:57
casacore::MSHistoryEnums
Enums for the MeasurementSet HISTORY table.
Definition MSHistoryEnums.h:57
casacore::MSMainEnums
Enums for the MeasurementSet main table.
Definition MSMainEnums.h:59
casacore::MSObservationEnums
Enums for the MeasurementSet OBSERVATION table.
Definition MSObsEnums.h:57
casacore::MSPointingEnums
Enums for the MeasurementSet POINTING table.
Definition MSPointingEnums.h:57
casacore::MSPolarizationEnums
Enums for the MeasurementSet POLARIZATION table.
Definition MSPolEnums.h:57
casacore::MSProcessorEnums
Enums for the MeasurementSet PROCESSER table.
Definition MSProcessorEnums.h:57
casacore::MSSourceEnums
Enums for the MeasurementSet SOURCE table.
Definition MSSourceEnums.h:57
casacore::MSSpectralWindowEnums
Enums for the MeasurementSet SPECTRAL_WINDOW table.
Definition MSSpWindowEnums.h:58
casacore::MSStateEnums
Enums for the MeasurementSet STATE table.
Definition MSStateEnums.h:57
casacore::MSSysCalEnums
Enums for the MeasurementSet SYSCAL table.
Definition MSSysCalEnums.h:57
casacore::MSTableImpl
Definition MSTableImpl.h:80
casacore::MSTableImpl::setupCompression
static SetupNewTable & setupCompression(SetupNewTable &)
Setup the compression data managers if needed.
casacore::MSTableImpl::initMaps
static MSTableMaps initMaps(MSSpectralWindowEnums *)
casacore::MSTableImpl::addColumnCompression
static void addColumnCompression(TableDesc &, const String &colName, Bool autoScale, const String &type)
Add the compress option for the given column to the TableDesc.
casacore::MSTableImpl::validate
static Bool validate(const TableRecord &tabRec, const TableDesc &requiredTD)
check that the keyword set is valid
casacore::MSTableImpl::initMaps
static MSTableMaps initMaps(MSWeatherEnums *)
casacore::MSTableImpl::referenceCopy
static Table referenceCopy(const Table &tab, const String &newTableName, const Block< String > &writableColumns)
Return a table that references all columns in this table except for those given in writableColumns,...
casacore::MSTableImpl::addColumnToDesc
static void addColumnToDesc(TableDesc &td, const String &colName, Int colDType, const String &colComment, const String &colUnit, const String &colMeasure, Int ndim, const IPosition &shape, Int option, const String &refCol)
add a column to a TableDesc An exception is thrown for an invalid data type.
casacore::MSTableImpl::initMaps
static MSTableMaps initMaps(MSDopplerEnums *)
casacore::MSTableImpl::initMaps
static MSTableMaps initMaps(MSObservationEnums *)
casacore::MSTableImpl::initMaps
static MSTableMaps initMaps(MSProcessorEnums *)
casacore::MSTableImpl::initMaps
static MSTableMaps initMaps(MSFlagCmdEnums *)
casacore::MSTableImpl::validate
static Bool validate(const TableDesc &tabDesc, const TableDesc &requiredTD)
tableDesc convenience functions
casacore::MSTableImpl::initMaps
static MSTableMaps initMaps(MSFeedEnums *)
casacore::MSTableImpl::initMaps
static MSTableMaps initMaps(MSFreqOffsetEnums *)
casacore::MSTableImpl::initMaps
static MSTableMaps initMaps(MSSysCalEnums *)
casacore::MSTableImpl::initMaps
static MSTableMaps initMaps(MSMainEnums *)
Define the initialization function for each MS table type.
casacore::MSTableImpl::initMaps
static MSTableMaps initMaps(MSPolarizationEnums *)
casacore::MSTableImpl::addKeyToDesc
static void addKeyToDesc(TableDesc &td, const String &keyName, Int keyDType, const String &keyComment)
add a keyword to a TableDesc An exception is thrown for an invalid data type.
casacore::MSTableImpl::initMaps
static MSTableMaps initMaps(MSStateEnums *)
casacore::MSTableImpl::initMaps
static MSTableMaps initMaps(MSHistoryEnums *)
casacore::MSTableImpl::initMaps
static MSTableMaps initMaps(MSDataDescriptionEnums *)
casacore::MSTableImpl::colMapDef
static void colMapDef(std::map< Int, String > &colMap, std::map< Int, Int > &colDTypeMap, std::map< Int, String > &colCommentMap, std::map< Int, String > &colUnitMap, std::map< Int, String > &colMeasureTypeMap, Int col, const String &colName, Int colType, const String &colComment, const String &colUnit, const String &colMeasureType)
Define an entry in the column maps.
casacore::MSTableImpl::initMaps
static MSTableMaps initMaps(MSAntennaEnums *)
casacore::MSTableImpl::initMaps
static MSTableMaps initMaps(MSSourceEnums *)
casacore::MSTableImpl::addMeasColumn
static void addMeasColumn(TableDesc &td, const String &colName, const String &colMeasure, const String &refCol)
add a MeasureColumn for the specified Measure, with default reference
casacore::MSTableImpl::initMaps
static MSTableMaps initMaps(MSFieldEnums *)
casacore::MSTableImpl::initMaps
static MSTableMaps initMaps(MSPointingEnums *)
casacore::MSTableImpl::keyMapDef
static void keyMapDef(std::map< Int, String > &keyMap, std::map< Int, Int > &keyDTypeMap, std::map< Int, String > &keyCommentMap, Int key, const String &keyName, Int keyType, const String &keyComment)
Define an entry in the keyword maps.
casacore::MSWeatherEnums
Enums for the MeasurementSet WEATHER table.
Definition MSWeatherEnums.h:57
casacore::SetupNewTable
Create a new table - define shapes, data managers, etc.
Definition SetupNewTab.h:337
casacore::String
String: the storage and methods of handling collections of characters.
Definition String.h:223
casacore::TableDesc
Definition TableDesc.h:189
casacore::TableRecord
Definition TableRecord.h:183
casacore::Table
Definition Table.h:157
casacore
this file contains all the compiler specific defines
Definition mainpage.dox:28
casacore::ndim
LatticeExprNode ndim(const LatticeExprNode &expr)
1-argument function to get the dimensionality of a lattice.
casacore::shape
IPosition shape(const RecordFieldId &) const
Get the actual shape of this field.
casacore::Int
int Int
Definition aipstype.h:48
casacore::Bool
bool Bool
Define the standard types used by Casacore.
Definition aipstype.h:40
casacore::MSTableMaps
Definition MSTable.h:48