casa
$Rev:20696$
|
00001 // -*- C++ -*- 00002 //# MSSelectableMainColumn.h: The generic interface for tables that can be used with MSSelection 00003 //# Copyright (C) 1996,1997,1998,1999,2001 00004 //# Associated Universities, Inc. Washington DC, USA. 00005 //# 00006 //# This library is free software; you can redistribute it and/or modify it 00007 //# under the terms of the GNU Library General Public License as published by 00008 //# the Free Software Foundation; either version 2 of the License, or (at your 00009 //# option) any later version. 00010 //# 00011 //# This library is distributed in the hope that it will be useful, but WITHOUT 00012 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00013 //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public 00014 //# License for more details. 00015 //# 00016 //# You should have received a copy of the GNU Library General Public License 00017 //# along with this library; if not, write to the Free Software Foundation, 00018 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA. 00019 //# 00020 //# Correspondence concerning AIPS++ should be addressed as follows: 00021 //# Internet email: aips2-request@nrao.edu. 00022 //# Postal address: AIPS++ Project Office 00023 //# National Radio Astronomy Observatory 00024 //# 520 Edgemont Road 00025 //# Charlottesville, VA 22903-2475 USA 00026 //# 00027 //# 00028 //# $Id$ 00029 00030 #ifndef MS_MSSELECTABLEMAINCOLUMN_H 00031 #define MS_MSSELECTABLEMAINCOLUMN_H 00032 00033 #include <casa/aips.h> 00034 #include <casa/BasicSL/String.h> 00035 #include <casa/Arrays/Vector.h> 00036 #include <casa/Arrays/Matrix.h> 00037 #include <casa/Arrays/Cube.h> 00038 #include <casa/Containers/OrderedMap.h> 00039 #include <casa/Containers/MapIO.h> 00040 #include <tables/Tables/ExprNode.h> 00041 #include <ms/MeasurementSets/MeasurementSet.h> 00042 #include <ms/MeasurementSets/MSMainEnums.h> 00043 #include <ms/MeasurementSets/MSSelectionError.h> 00044 #include <ms/MeasurementSets/MSSelectableTable.h> 00045 #include <ms/MeasurementSets/MSMainColumns.h> 00046 namespace casa { //# NAMESPACE CASA - BEGIN 00047 00048 class MSSelectableMainColumn 00049 { 00050 public: 00051 MSSelectableMainColumn(const Table& msLikeTable) {init(msLikeTable);}; 00052 MSSelectableMainColumn() {table_p=NULL;} 00053 virtual ~MSSelectableMainColumn() {}; 00054 00055 virtual void init(const Table& msLikeTable) {table_p=&msLikeTable;}; 00056 const Table* table() {return table_p;} 00057 virtual const ROArrayColumn<Bool>& flag() = 0; 00058 virtual const Bool flagRow(const Int& i) = 0; 00059 virtual const ROScalarQuantColumn<Double>& exposureQuant() = 0; 00060 virtual const ROScalarQuantColumn<Double>& timeQuant() = 0; 00061 virtual const MeasurementSet *asMS() = 0; 00062 00063 protected: 00064 const Table *table_p; 00065 }; 00066 00067 class MSMainColInterface: public MSSelectableMainColumn 00068 { 00069 public: 00070 MSMainColInterface():MSSelectableMainColumn(), msCols_p(NULL) {}; 00071 MSMainColInterface(const Table& msAsTable): MSSelectableMainColumn(msAsTable) 00072 {init(msAsTable);} 00073 00074 virtual ~MSMainColInterface() {if (msCols_p) delete msCols_p;}; 00075 00076 virtual void init(const Table& msAsTable) 00077 {MSSelectableMainColumn::init(msAsTable);ms_p = MeasurementSet(msAsTable); msCols_p=new ROMSMainColumns(ms_p);} 00078 virtual const ROArrayColumn<Bool>& flag() {return msCols_p->flag();} 00079 00080 // virtual const Bool flagRow(const Int& i) {return allTrue(msCols_p->flag()(i));} 00081 virtual const Bool flagRow(const Int& i) {return msCols_p->flagRow()(i);} 00082 virtual const ROScalarQuantColumn<Double>& exposureQuant() {return msCols_p->exposureQuant();}; 00083 virtual const ROScalarQuantColumn<Double>& timeQuant() {return msCols_p->timeQuant();} 00084 00085 virtual const MeasurementSet *asMS(){return static_cast<const MeasurementSet *>(table());}; 00086 private: 00087 MeasurementSet ms_p; 00088 ROMSMainColumns *msCols_p; 00089 00090 }; 00091 00092 } //# NAMESPACE CASA - END 00093 00094 #endif