casacore
Loading...
Searching...
No Matches
MSSelectableTable.h
Go to the documentation of this file.
1// -*- C++ -*-
2//# MSSelectableTable.h: The generic interface for tables that can be used with MSSelection
3//# Copyright (C) 1996,1997,1998,1999,2001
4//# Associated Universities, Inc. Washington DC, USA.
5//#
6//# This library is free software; you can redistribute it and/or modify it
7//# under the terms of the GNU Library General Public License as published by
8//# the Free Software Foundation; either version 2 of the License, or (at your
9//# option) any later version.
10//#
11//# This library is distributed in the hope that it will be useful, but WITHOUT
12//# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13//# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
14//# License for more details.
15//#
16//# You should have received a copy of the GNU Library General Public License
17//# along with this library; if not, write to the Free Software Foundation,
18//# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
19//#
20//# Correspondence concerning AIPS++ should be addressed as follows:
21//# Internet email: casa-feedback@nrao.edu.
22//# Postal address: AIPS++ Project Office
23//# National Radio Astronomy Observatory
24//# 520 Edgemont Road
25//# Charlottesville, VA 22903-2475 USA
26
27#ifndef MS_MSSELECTABLETABLE_H
28#define MS_MSSELECTABLETABLE_H
29
30#include <casacore/casa/aips.h>
31#include <casacore/casa/BasicSL/String.h>
32#include <casacore/casa/Arrays/Vector.h>
33#include <casacore/casa/Arrays/Matrix.h>
34#include <casacore/casa/Arrays/Cube.h>
35#include <casacore/tables/TaQL/ExprNode.h>
36#include <casacore/ms/MeasurementSets/MeasurementSet.h>
37#include <casacore/ms/MeasurementSets/MSMainEnums.h>
38#include <casacore/ms/MSSel/MSSelectionError.h>
39#include <casacore/ms/MSSel/MSSelectableMainColumn.h>
40namespace casacore { //# NAMESPACE CASACORE - BEGIN
41
42// <summary>
43//
44// MSSelectableTable: An interface class used by MSSelection module to
45// access the sub-tables and main-table columns of MS-like tables.
46//
47// </summary>
48
49// <use visibility=export>
50
51// <reviewed reviewer="" date="" tests="" demos="">
52
53// <prerequisite>
54// </prerequisite>
55//
56// <etymology>
57// From "msselection" and "table".
58// </etymology>
59//
60//<synopsis>
61//
62// This is a pure virtual base-class to provide a table-type agnostic
63// interface to the <linkto
64// module="MeasurementSets:description">MSSelection</linkto> module to
65// access sub-tables and main-table columns of MS-like tables.
66//
67// </synopsis>
68//
69// <example>
70// <srcblock>
71// </srcblock>
72// </example>
73//
74// <motivation>
75//
76// To allow use of the <linkto
77// module="MeasurementSets:description">MSSelection</linkto> module
78// for selection on any table that follows the general structure of the
79// MS database. Via this class, minor differences in the database
80// layout can be hidden from the MSSelection module. This also keeps
81// MeasurementSet module from depending on other MS-like database
82// implemention which may use the MSSelection module. Such usage will
83// need to implement a specialization of <linkto
84// module="MeasurementSets:description">MSSelectableTable</linkto> and
85// use it to instantiate the <linkto
86// module="MeasurementSets:description">MSSelection</linkto> object.
87//
88// </motivation>
89//
90// <todo asof="19/03/13">
91// </todo>
92
94 {
95 public:
97
101
102 virtual void setTable(const Table& table) {table_p = &table;}
103 const Table* table() {return table_p;}
104 TableExprNode col(const String& colName) {return table()->col(colName);}
105
106 virtual Bool isMS() = 0;
107 virtual MSSDataType dataType() = 0;
108 virtual const MSAntenna& antenna() = 0;
109 virtual const MSField& field() = 0;
110 virtual const MSSpectralWindow& spectralWindow() = 0;
111 virtual const MSDataDescription& dataDescription() = 0;
112 virtual const MSObservation& observation() = 0;
113
115 virtual const MeasurementSet* asMS() = 0;
116
118
119 protected:
121 };
122
123// <summary>
124//
125// MSInterface: A specialization of MSSelectableTable for accessing
126// MS.
127//
128// </summary>
129
130// <use visibility=export>
131
132// <reviewed reviewer="" date="" tests="" demos="">
133
134// <prerequisite>
135// </prerequisite>
136//
137// <etymology>
138//
139// From "ms" and "interface".
140//
141// </etymology>
142//
143//<synopsis>
144//
145// A class that can be passed around as MSSelectableTable, with most of
146// the methods overloaded to work with the underlaying MS.
147//
148//</synopsis>
149//
150// <example>
151// <srcblock>
152//
153// //
154// // Fill in the expression in the various strings that are passed for
155// // parsing to the MSSelection object later.
156// //
157// String fieldStr,timeStr,spwStr,baselineStr,
158// uvdistStr,taqlStr,scanStr,arrayStr, polnStr,stateObsModeStr,
159// observationStr;
160// baselineStr="1&2";
161// timeStr="*+0:10:0";
162// fieldStr="CygA*";
163// //
164// // Instantiate the MS and the MSInterface objects.
165// //
166// MS ms(MSName),selectedMS(ms);
167// MSInterface msInterface(ms);
168// //
169// // Setup the MSSelection thingi
170// //
171// MSSelection msSelection;
172//
173// msSelection.reset(msInterface,MSSelection::PARSE_NOW,
174// timeStr,baselineStr,fieldStr,spwStr,
175// uvdistStr,taqlStr,polnStr,scanStr,arrayStr,
176// stateObsModeStr,observationStr);
177// if (msSelection.getSelectedMS(selectedMS))
178// cerr << "Got the selected MS!" << endl;
179// else
180// cerr << "The set of expressions resulted into null-selection";
181// </srcblock>
182// </example>
183//
184// <motivation>
185//
186// To generalize the implementation of the MSSelection parsers.
187//
188// </motivation>
189//
190// <todo asof="19/03/13">
191// </todo>
192
194 {
195 public:
198 virtual ~MSInterface() {if (msMainCols_p) delete msMainCols_p;}
199 virtual const MSAntenna& antenna() {return asMS()->antenna();}
200 virtual const MSField& field() {return asMS()->field();}
201 virtual const MSSpectralWindow& spectralWindow() {return asMS()->spectralWindow();}
203 virtual const MSObservation& observation() {return asMS()->observation();}
205 virtual Bool isMS() {return True;}
207
208 virtual const MeasurementSet *asMS(){return static_cast<const MeasurementSet *>(table());}
211 private:
213 };
214} //# NAMESPACE CASACORE - END
215
216#endif
MSInterface: A specialization of MSSelectableTable for accessing MS.
virtual const MSDataDescription & dataDescription()
MSMainColInterface * msMainCols_p
virtual const MSAntenna & antenna()
MSInterface(const Table &table)
virtual const MSObservation & observation()
virtual const MeasurementSet * asMS()
virtual MSSDataType dataType()
virtual MSSelectableMainColumn * mainColumns()
virtual const MSField & field()
virtual const MSSpectralWindow & spectralWindow()
virtual String columnName(MSMainEnums::PredefinedColumns nameEnum)
PredefinedColumns
The Main table colums with predefined meaning.
Definition MSMainEnums.h:62
virtual const MSField & field()=0
virtual const MeasurementSet * asMS()=0
TableExprNode col(const String &colName)
virtual const MSObservation & observation()=0
virtual const MSSpectralWindow & spectralWindow()=0
MSSelectableTable(const Table &table)
virtual void setTable(const Table &table)
virtual const MSAntenna & antenna()=0
virtual String columnName(MSMainEnums::PredefinedColumns nameEnum)=0
virtual MSSDataType dataType()=0
virtual MSSelectableMainColumn * mainColumns()=0
virtual const MSDataDescription & dataDescription()=0
static const String & columnName(ColEnum which)
Convert a ColEnum to the actual column name.
MSAntenna & antenna()
Access functions for the subtables, using the MS-like interface for each.
MSObservation & observation()
MSSpectralWindow & spectralWindow()
MSDataDescription & dataDescription()
String: the storage and methods of handling collections of characters.
Definition String.h:223
TableExprNode col(const String &columnName) const
this file contains all the compiler specific defines
Definition mainpage.dox:28
bool Bool
Define the standard types used by Casacore.
Definition aipstype.h:40
const Bool True
Definition aipstype.h:41