casacore
Loading...
Searching...
No Matches
MSTableImpl.h
Go to the documentation of this file.
1// # MSTableImpl.h: Helper class to implement common functions for MS Tables
2// # Copyright (C) 1996,2000,2001,2002
3// # Associated Universities, Inc. Washington DC, USA.
4// #
5// # This library is free software; you can redistribute it and/or modify it
6// # under the terms of the GNU Library General Public License as published by
7// # the Free Software Foundation; either version 2 of the License, or (at your
8// # option) any later version.
9// #
10// # This library is distributed in the hope that it will be useful, but WITHOUT
11// # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12// # FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
13// # License for more details.
14// #
15// # You should have received a copy of the GNU Library General Public License
16// # along with this library; if not, write to the Free Software Foundation,
17// # Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
18// #
19// # Correspondence concerning AIPS++ should be addressed as follows:
20// # Internet email: casa-feedback@nrao.edu.
21// # Postal address: AIPS++ Project Office
22// # National Radio Astronomy Observatory
23// # 520 Edgemont Road
24// # Charlottesville, VA 22903-2475 USA
25
26#ifndef MS_MSTABLEIMPL_H
27#define MS_MSTABLEIMPL_H
28
29// # Includes
30#include <casacore/casa/aips.h>
31#include <casacore/ms/MeasurementSets/MeasurementSet.h>
32#include <casacore/casa/Utilities/DataType.h>
33#include <casacore/tables/Tables/Table.h>
34#include <casacore/casa/BasicSL/String.h>
35#include <casacore/tables/Tables/TableDesc.h>
36#include <casacore/casa/Arrays/Vector.h>
37#include <map>
38
39namespace casacore { // # NAMESPACE CASACORE - BEGIN
40
41// # Forward declarations
42class SetupNewTable;
43
44// <summary>
45// An implementation class for the MeasurementSet to share code.
46// </summary>
47
48// <use visibility=local>
49
50// <reviewed reviewer="Bob Garwood" date="1997/02/01" tests="" demos="">
51
52// <prerequisite>
53// <li> <linkto class=MeasurementSet:description">MeasurementSet</linkto>
54// </prerequisite>
55//
56// <etymology>
57// The MSTableImpl implements non-templated static functions shared by
58// all MSTable objects.
59// </etymology>
60//
61// <synopsis>
62// MSTableImpl is only for internal use by the MeasurementSet base class
63// MSTable.
64// </synopsis>
65//
66// <example>
67// </example>
68//
69//
70// <motivation>
71// The reasons for existance for this class are: sharing of code between
72// the various MeasurementSet Tables and avoiding duplicate code in the
73// instantiations of MSTable
74// </motivation>
75//
76// <todo asof="1996/2/22">
77// </todo>
78
80 public:
81 // add a column to a TableDesc
82 // An exception is thrown for an invalid data type. This indicates a
83 // programming error in this class when this occurs.
84 // If option!=0 shape is used to set the shape of the column and
85 // option defines the type of column (ColumnDesc::Fixed/Direct).
86 // If option==0, shape is ignored and ndim is used to specify the
87 // array dimension if any.
88 // If refCol is not empty, a column with variable reference will be
89 // created, note that refCol should already exist in td.
90 // <thrown>
91 // <li> AipsError
92 // </thrown>
93 static void addColumnToDesc(TableDesc& td, const String& colName, Int colDType,
94 const String& colComment, const String& colUnit,
95 const String& colMeasure, Int ndim, const IPosition& shape,
96 Int option, const String& refCol);
97
98 // add a keyword to a TableDesc
99 // An exception is thrown for an invalid data type. This indicates a
100 // missing data type in the code..
101 // <thrown>
102 // <li> AipsError
103 // </thrown>
104 static void addKeyToDesc(TableDesc& td, const String& keyName, Int keyDType,
105 const String& keyComment);
106
107 // add a MeasureColumn for the specified Measure, with default reference
108 static void addMeasColumn(TableDesc& td, const String& colName, const String& colMeasure,
109 const String& refCol);
110
111 // Add the compress option for the given column to the TableDesc.
112 static void addColumnCompression(TableDesc&, const String& colName, Bool autoScale,
113 const String& type);
114
115 // Setup the compression data managers if needed.
117
118 // Define an entry in the column maps
119 static void colMapDef(std::map<Int, String>& colMap, std::map<Int, Int>& colDTypeMap,
120 std::map<Int, String>& colCommentMap, std::map<Int, String>& colUnitMap,
121 std::map<Int, String>& colMeasureTypeMap, Int col, const String& colName,
122 Int colType, const String& colComment, const String& colUnit,
123 const String& colMeasureType);
124
125 // Define an entry in the keyword maps
126 static void keyMapDef(std::map<Int, String>& keyMap, std::map<Int, Int>& keyDTypeMap,
127 std::map<Int, String>& keyCommentMap, Int key, const String& keyName,
128 Int keyType, const String& keyComment);
129
130 // tableDesc convenience functions
131 // <group>
132
133 // check that a TableDesc is valid
134 static Bool validate(const TableDesc& tabDesc, const TableDesc& requiredTD);
135
136 // check that the keyword set is valid
137 static Bool validate(const TableRecord& tabRec, const TableDesc& requiredTD);
138
139 // </group>
140
141 // Return a table that references all columns in this table except for
142 // those given in writableColumns, those are empty and writable.
143 static Table referenceCopy(const Table& tab, const String& newTableName,
144 const Block<String>& writableColumns);
145
146 // Define the initialization function for each MS table type.
147 // <group>
166 // </group>
167};
168
169} // namespace casacore
170
171#endif
Enums for the MeasurementSet ANTENNA table.
Enums for the MeasurementSet DATA_DESCRIPTION table.
Enums for the MeasurementSet DOPPLER table.
Enums for the MeasurementSet FEED table.
Definition MSFeedEnums.h:57
Enums for the MeasurementSet FIELD table.
Enums for the MeasurementSet FLAG_CMD table.
Enums for the MeasurementSet FREQ_OFFSET table.
Enums for the MeasurementSet HISTORY table.
Enums for the MeasurementSet main table.
Definition MSMainEnums.h:59
Enums for the MeasurementSet OBSERVATION table.
Definition MSObsEnums.h:57
Enums for the MeasurementSet POINTING table.
Enums for the MeasurementSet POLARIZATION table.
Definition MSPolEnums.h:57
Enums for the MeasurementSet PROCESSER table.
Enums for the MeasurementSet SOURCE table.
Enums for the MeasurementSet SPECTRAL_WINDOW table.
Enums for the MeasurementSet STATE table.
Enums for the MeasurementSet SYSCAL table.
static SetupNewTable & setupCompression(SetupNewTable &)
Setup the compression data managers if needed.
static MSTableMaps initMaps(MSSpectralWindowEnums *)
static void addColumnCompression(TableDesc &, const String &colName, Bool autoScale, const String &type)
Add the compress option for the given column to the TableDesc.
static Bool validate(const TableRecord &tabRec, const TableDesc &requiredTD)
check that the keyword set is valid
static MSTableMaps initMaps(MSWeatherEnums *)
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,...
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.
static MSTableMaps initMaps(MSDopplerEnums *)
static MSTableMaps initMaps(MSObservationEnums *)
static MSTableMaps initMaps(MSProcessorEnums *)
static MSTableMaps initMaps(MSFlagCmdEnums *)
static Bool validate(const TableDesc &tabDesc, const TableDesc &requiredTD)
tableDesc convenience functions
static MSTableMaps initMaps(MSFeedEnums *)
static MSTableMaps initMaps(MSFreqOffsetEnums *)
static MSTableMaps initMaps(MSSysCalEnums *)
static MSTableMaps initMaps(MSMainEnums *)
Define the initialization function for each MS table type.
static MSTableMaps initMaps(MSPolarizationEnums *)
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.
static MSTableMaps initMaps(MSStateEnums *)
static MSTableMaps initMaps(MSHistoryEnums *)
static MSTableMaps initMaps(MSDataDescriptionEnums *)
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.
static MSTableMaps initMaps(MSAntennaEnums *)
static MSTableMaps initMaps(MSSourceEnums *)
static void addMeasColumn(TableDesc &td, const String &colName, const String &colMeasure, const String &refCol)
add a MeasureColumn for the specified Measure, with default reference
static MSTableMaps initMaps(MSFieldEnums *)
static MSTableMaps initMaps(MSPointingEnums *)
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.
Enums for the MeasurementSet WEATHER table.
Create a new table - define shapes, data managers, etc.
String: the storage and methods of handling collections of characters.
Definition String.h:355
For temporary backward namespace compatibility, use casa as alias for casacore.
Definition mainpage.dox:28
LatticeExprNode ndim(const LatticeExprNode &expr)
1-argument function to get the dimensionality of a lattice.
IPosition shape(const RecordFieldId &) const
Get the actual shape of this field.
int Int
Definition aipstype.h:48
bool Bool
Define the standard types used by Casacore.
Definition aipstype.h:40