MSKeys.h

Go to the documentation of this file.
00001 //# Copyright (C) 1998,1999,2000,2001
00002 //# Associated Universities, Inc. Washington DC, USA.
00003 //#
00004 //# This library is free software; you can redistribute it and/or modify it
00005 //# under the terms of the GNU Library General Public License as published by
00006 //# the Free Software Foundation; either version 2 of the License, or (at your
00007 //# option) any later version.
00008 //#
00009 //# This library is distributed in the hope that it will be useful, but WITHOUT
00010 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00011 //# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
00012 //# License for more details.
00013 //#
00014 //# You should have received a copy of the GNU Library General Public License
00015 //# along with this library; if not, write to the Free Software Foundation,
00016 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
00017 //#
00018 //# Correspondence concerning AIPS++ should be addressed as follows:
00019 //#        Internet email: aips2-request@nrao.edu.
00020 //#        Postal address: AIPS++ Project Office
00021 //#                        National Radio Astronomy Observatory
00022 //#                        520 Edgemont Road
00023 //#                        Charlottesville, VA 22903-2475 USA
00024 //#
00025 //# $Id$
00026 
00027 #ifndef MS_MSKEYS_H
00028 #define MS_MSKEYS_H
00029 
00030 #include <casacore/casa/aips.h>
00031 
00032 #include <set>
00033 #include <ostream>
00034 
00035 namespace casacore {
00036 
00037 class String;
00038 
00039 // A sub scan is a unique combination of observation ID, array ID, scan number,
00040 // and field ID. Negative values are allowed to indicate all values of the particular
00041 // ID are desired.
00042 struct SubScanKey {
00043     Int obsID;
00044     Int arrayID;
00045     Int scan;
00046     Int fieldID;
00047 };
00048 
00049 // define operator<() so it can be used as a key in std::map
00050 Bool operator<(const SubScanKey& lhs, const SubScanKey& rhs);
00051 
00052 String toString(const SubScanKey& subScanKey);
00053 
00054 std::ostream& operator<<(std::ostream& os, const SubScanKey& scanKey);
00055 
00056 // A scan is a unique combination of observation ID, array ID, and scan number
00057 // Negative values are allowed to indicate all values of the particular
00058 // ID are desired.
00059 struct ScanKey {
00060     Int obsID;
00061     Int arrayID;
00062     Int scan;
00063 };
00064 
00065 // create a ScanKey from a SubScanKey, just omits the SubScanKey's fieldID
00066 inline ScanKey scanKey(const SubScanKey& subScanKey) {
00067     ScanKey key;
00068     key.obsID = subScanKey.obsID;
00069     key.arrayID = subScanKey.arrayID;
00070     key.scan = subScanKey.scan;
00071     return key;
00072 }
00073 
00074 String toString(const ScanKey& scanKey);
00075 
00076 // define operator<() so it can be used as a key in std::map
00077 Bool operator<(const ScanKey& lhs, const ScanKey& rhs);
00078 
00079 Bool operator==(const ScanKey& lhs, const ScanKey& rhs);
00080 
00081 // extract all the unique scan numbers from the specified scans
00082 std::set<Int> scanNumbers(const std::set<ScanKey>& scanKeys);
00083 
00084 std::ostream& operator<<(std::ostream& os, const ScanKey& scanKey);
00085 
00086 // An ArrayKey is a unique combination of observation ID and array ID
00087 // Negative values are allowed to indicate all values of the particular
00088 // ID are desired.
00089 struct ArrayKey {
00090     Int obsID;
00091     Int arrayID;
00092 };
00093 
00094 // define operator<() so it can be used as a key in std::map
00095 Bool operator<(const ArrayKey& lhs, const ArrayKey& rhs);
00096 
00097 inline Bool operator==(const ArrayKey& lhs, const ArrayKey& rhs) {
00098     return lhs.arrayID == rhs.arrayID && lhs.obsID == rhs.obsID;
00099 }
00100 
00101 inline Bool operator!=(const ArrayKey& lhs, const ArrayKey& rhs) {
00102     return ! (lhs == rhs);
00103 }
00104 
00105 // construct scan keys given a set of scan numbers and an ArrayKey
00106 std::set<ScanKey> scanKeys(const std::set<Int>& scans, const ArrayKey& arrayKey);
00107 
00108 // represents primary key in the SOURCE table
00109 struct SourceKey {
00110     // SOURCE_ID column
00111     uInt id;
00112     uInt spw;
00113 };
00114 
00115 // define operator<() so it can be used as a key in std::map
00116 Bool operator<(const SourceKey& lhs, const SourceKey& rhs);
00117 
00118 // get a set of unique ArrayKeys from a set of ScanKeys
00119 std::set<ArrayKey> uniqueArrayKeys(const std::set<ScanKey>& scanKeys);
00120 
00121 // given a set of scan keys, return the subset that matches the given array key
00122 std::set<ScanKey> filter(const std::set<ScanKey> scans, const ArrayKey& arrayKey);
00123 
00124 }
00125 
00126 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 31 Aug 2016 for casa by  doxygen 1.6.1