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{
81public:
82 // add a column to a TableDesc
83 // An exception is thrown for an invalid data type. This indicates a
84 // programming error in this class when this occurs.
85 // If option!=0 shape is used to set the shape of the column and
86 // option defines the type of column (ColumnDesc::Fixed/Direct).
87 // If option==0, shape is ignored and ndim is used to specify the
88 // array dimension if any.
89 // If refCol is not empty, a column with variable reference will be
90 // created, note that refCol should already exist in td.
91 // <thrown>
92 // <li> AipsError
93 // </thrown>
94 static void addColumnToDesc(TableDesc &td, const String& colName,
95 Int colDType, const String& colComment,
96 const String& colUnit,
97 const String& colMeasure,
98 Int ndim, const IPosition & shape,
99 Int option, const String& refCol);
100
101 // add a keyword to a TableDesc
102 // An exception is thrown for an invalid data type. This indicates a
103 // missing data type in the code..
104 // <thrown>
105 // <li> AipsError
106 // </thrown>
107 static void addKeyToDesc(TableDesc& td, const String& keyName,
108 Int keyDType, const String& keyComment);
109
110 // add a MeasureColumn for the specified Measure, with default reference
111 static void addMeasColumn(TableDesc &td, const String& colName,
112 const String& colMeasure, const String& refCol);
113
114 // Add the compress option for the given column to the TableDesc.
115 static void addColumnCompression (TableDesc&, const String& colName,
116 Bool autoScale, const String& type);
117
118 // Setup the compression data managers if needed.
120
121 // Define an entry in the column maps
122 static void colMapDef(std::map<Int,String>& colMap,
123 std::map<Int,Int>& colDTypeMap,
124 std::map<Int,String>& colCommentMap,
125 std::map<Int,String>& colUnitMap,
126 std::map<Int,String>& colMeasureTypeMap,
127 Int col,
128 const String& colName,
129 Int colType,
130 const String& colComment,
131 const String& colUnit,
132 const String& colMeasureType);
133
134 // Define an entry in the keyword maps
135 static void keyMapDef(std::map<Int,String>& keyMap,
136 std::map<Int,Int>& keyDTypeMap,
137 std::map<Int,String>& keyCommentMap,
138 Int key,
139 const String& keyName,
140 Int keyType,
141 const String& keyComment);
142
143 // tableDesc convenience functions
144 // <group>
145
146 // check that a TableDesc is valid
147 static Bool validate(const TableDesc& tabDesc,
148 const TableDesc& requiredTD);
149
150 // check that the keyword set is valid
151 static Bool validate(const TableRecord& tabRec,
152 const TableDesc& requiredTD);
153
154 // </group>
155
156 // Return a table that references all columns in this table except for
157 // those given in writableColumns, those are empty and writable.
158 static Table referenceCopy(const Table& tab, const String& newTableName,
159 const Block<String>& writableColumns);
160
161 // Define the initialization function for each MS table type.
162 // <group>
181 // </group>
182};
183
184
185} //# NAMESPACE CASACORE - END
186
187#endif
simple 1-D array
Definition Block.h:198
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:223
this file contains all the compiler specific defines
Definition mainpage.dox:28
LatticeExprNode ndim(const LatticeExprNode &expr)
1-argument function to get the dimensionality of a lattice.
TableExprNode shape(const TableExprNode &array)
Function operating on any scalar or array resulting in a Double array containing the shape.
Definition ExprNode.h:1991
int Int
Definition aipstype.h:48
bool Bool
Define the standard types used by Casacore.
Definition aipstype.h:40