casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
FlagMSHandler.h
Go to the documentation of this file.
00001 //# FlagMSHandler.h: This file contains the interface definition of the FlagMSHandler class.
00002 //#
00003 //#  CASA - Common Astronomy Software Applications (http://casa.nrao.edu/)
00004 //#  Copyright (C) Associated Universities, Inc. Washington DC, USA 2011, All rights reserved.
00005 //#  Copyright (C) European Southern Observatory, 2011, All rights reserved.
00006 //#
00007 //#  This library is free software; you can redistribute it and/or
00008 //#  modify it under the terms of the GNU Lesser General Public
00009 //#  License as published by the Free software Foundation; either
00010 //#  version 2.1 of the License, or (at your option) any later version.
00011 //#
00012 //#  This library is distributed in the hope that it will be useful,
00013 //#  but WITHOUT ANY WARRANTY, without even the implied warranty of
00014 //#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015 //#  Lesser General Public License for more details.
00016 //#
00017 //#  You should have received a copy of the GNU Lesser General Public
00018 //#  License along with this library; if not, write to the Free Software
00019 //#  Foundation, Inc., 59 Temple Place, Suite 330, Boston,
00020 //#  MA 02111-1307  USA
00021 //# $Id: $
00022 
00023 #ifndef FlagMSHandler_H_
00024 #define FlagMSHandler_H_
00025 
00026 #include <flagging/Flagging/FlagDataHandler.h>
00027 
00028 namespace casa { //# NAMESPACE CASA - BEGIN
00029 
00030 // Flag Data Handler class definition
00031 class FlagMSHandler: public FlagDataHandler
00032 {
00033 
00034 public:
00035 
00036         // Default constructor
00037         // NOTE: Time interval 0 groups all time steps together in one chunk.
00038         FlagMSHandler(string msname, uShort iterationApproach = SUB_INTEGRATION, Double timeInterval = 0);
00039 
00040         // Default destructor
00041         ~FlagMSHandler();
00042 
00043         // Open Measurement Set
00044         bool open();
00045 
00046         // Close Measurement Set
00047         bool close();
00048 
00049         // Generate selected Measurement Set
00050         bool selectData();
00051 
00052         // Parse MSSelection expression
00053         bool parseExpression(MSSelection &parser);
00054 
00055         // Generate Visibility Iterator
00056         bool generateIterator();
00057 
00058         // Move to next chunk
00059         bool nextChunk();
00060 
00061         // Move to next buffer
00062         bool nextBuffer();
00063 
00064         // Write flag cube into MS
00065         bool flushFlags();
00066 
00067         // Provide table name (for flag version)
00068         String getTableName();
00069 
00070         // Check if a given column is available in the MS
00071         // (typically for checking existence of CORRECTED_DATA
00072         bool checkIfColumnExists(String column);
00073 
00074         // Signal true when a progress summary has to be printed
00075         bool summarySignal();
00076 
00077 private:
00078 
00079         // Mapping functions
00080         virtual void generateScanStartStopMap();
00081 
00082         // Swap MS to check what is the maximum RAM memory needed
00083         void preSweep();
00084 
00085         // Apply channel selection for asyn or normal iterator
00086         // NOTE: We always have to do this, even if there is no SPW:channel selection
00087         void applyChannelSelection(vi::VisibilityIterator2 *visIter);
00088 
00089         // Measurement set section
00090         MeasurementSet *selectedMeasurementSet_p;
00091         MeasurementSet *originalMeasurementSet_p;
00092 
00093         // RO Visibility Iterator
00094         vi::VisibilityIterator2 *visibilityIterator_p;
00095 
00096 };
00097 
00098 } //# NAMESPACE CASA - END
00099 
00100 #endif /* FlagMSHandler_H_ */