casacore
MSKeys.h
Go to the documentation of this file.
1 //# Copyright (C) 1998,1999,2000,2001
2 //# Associated Universities, Inc. Washington DC, USA.
3 //#
4 //# This library is free software; you can redistribute it and/or modify it
5 //# under the terms of the GNU Library General Public License as published by
6 //# the Free Software Foundation; either version 2 of the License, or (at your
7 //# option) any later version.
8 //#
9 //# This library is distributed in the hope that it will be useful, but WITHOUT
10 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
12 //# License for more details.
13 //#
14 //# You should have received a copy of the GNU Library General Public License
15 //# along with this library; if not, write to the Free Software Foundation,
16 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
17 //#
18 //# Correspondence concerning AIPS++ should be addressed as follows:
19 //# Internet email: aips2-request@nrao.edu.
20 //# Postal address: AIPS++ Project Office
21 //# National Radio Astronomy Observatory
22 //# 520 Edgemont Road
23 //# Charlottesville, VA 22903-2475 USA
24 //#
25 //# $Id$
26 
27 #ifndef MS_MSKEYS_H
28 #define MS_MSKEYS_H
29 
30 #include <casacore/casa/aips.h>
31 
32 #include <set>
33 #include <ostream>
34 
35 namespace casacore {
36 
37 class String;
38 
39 // A sub scan is a unique combination of observation ID, array ID, scan number,
40 // and field ID. Negative values are allowed to indicate all values of the particular
41 // ID are desired.
42 struct SubScanKey {
47 };
48 
49 // define operator<() so it can be used as a key in std::map
50 Bool operator<(const SubScanKey& lhs, const SubScanKey& rhs);
51 
52 String toString(const SubScanKey& subScanKey);
53 
54 std::ostream& operator<<(std::ostream& os, const SubScanKey& scanKey);
55 
56 // A scan is a unique combination of observation ID, array ID, and scan number
57 // Negative values are allowed to indicate all values of the particular
58 // ID are desired.
59 struct ScanKey {
63 };
64 
65 // create a ScanKey from a SubScanKey, just omits the SubScanKey's fieldID
66 inline ScanKey scanKey(const SubScanKey& subScanKey) {
67  ScanKey key;
68  key.obsID = subScanKey.obsID;
69  key.arrayID = subScanKey.arrayID;
70  key.scan = subScanKey.scan;
71  return key;
72 }
73 
75 
76 // define operator<() so it can be used as a key in std::map
77 Bool operator<(const ScanKey& lhs, const ScanKey& rhs);
78 
79 Bool operator==(const ScanKey& lhs, const ScanKey& rhs);
80 
81 // extract all the unique scan numbers from the specified scans
82 std::set<Int> scanNumbers(const std::set<ScanKey>& scanKeys);
83 
84 std::ostream& operator<<(std::ostream& os, const ScanKey& scanKey);
85 
86 // An ArrayKey is a unique combination of observation ID and array ID
87 // Negative values are allowed to indicate all values of the particular
88 // ID are desired.
89 struct ArrayKey {
92 };
93 
94 // define operator<() so it can be used as a key in std::map
95 Bool operator<(const ArrayKey& lhs, const ArrayKey& rhs);
96 
97 inline Bool operator==(const ArrayKey& lhs, const ArrayKey& rhs) {
98  return lhs.arrayID == rhs.arrayID && lhs.obsID == rhs.obsID;
99 }
100 
101 inline Bool operator!=(const ArrayKey& lhs, const ArrayKey& rhs) {
102  return ! (lhs == rhs);
103 }
104 
105 // construct scan keys given a set of scan numbers and an ArrayKey
106 std::set<ScanKey> scanKeys(const std::set<Int>& scans, const ArrayKey& arrayKey);
107 
108 // represents primary key in the SOURCE table
109 struct SourceKey {
110  // SOURCE_ID column
113 };
114 
115 // define operator<() so it can be used as a key in std::map
116 Bool operator<(const SourceKey& lhs, const SourceKey& rhs);
117 
118 // get a set of unique ArrayKeys from a set of ScanKeys
119 std::set<ArrayKey> uniqueArrayKeys(const std::set<ScanKey>& scanKeys);
120 
121 // given a set of scan keys, return the subset that matches the given array key
122 std::set<ScanKey> filter(const std::set<ScanKey> scans, const ArrayKey& arrayKey);
123 
124 }
125 
126 #endif
String: the storage and methods of handling collections of characters.
Definition: String.h:225
this file contains all the compiler specific defines
Definition: mainpage.dox:28
std::set< ScanKey > scanKeys(const std::set< Int > &scans, const ArrayKey &arrayKey)
construct scan keys given a set of scan numbers and an ArrayKey
std::set< ScanKey > filter(const std::set< ScanKey > scans, const ArrayKey &arrayKey)
given a set of scan keys, return the subset that matches the given array key
std::set< Int > scanNumbers(const std::set< ScanKey > &scanKeys)
extract all the unique scan numbers from the specified scans
std::set< ArrayKey > uniqueArrayKeys(const std::set< ScanKey > &scanKeys)
get a set of unique ArrayKeys from a set of ScanKeys
unsigned int uInt
Definition: aipstype.h:51
ScanKey scanKey(const SubScanKey &subScanKey)
create a ScanKey from a SubScanKey, just omits the SubScanKey's fieldID
Definition: MSKeys.h:66
bool operator==(const casacore_allocator< T, ALIGNMENT > &, const casacore_allocator< T, ALIGNMENT > &)
Definition: Allocator.h:129
bool operator!=(const casacore_allocator< T, ALIGNMENT > &, const casacore_allocator< T, ALIGNMENT > &)
Definition: Allocator.h:135
LatticeExprNode operator<(const LatticeExprNode &left, const LatticeExprNode &right)
String toString(const SubScanKey &subScanKey)
int Int
Definition: aipstype.h:50
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
ostream & operator<<(ostream &os, const IComplex &)
Show on ostream.
An ArrayKey is a unique combination of observation ID and array ID Negative values are allowed to ind...
Definition: MSKeys.h:89
A scan is a unique combination of observation ID, array ID, and scan number Negative values are allow...
Definition: MSKeys.h:59
represents primary key in the SOURCE table
Definition: MSKeys.h:109
uInt id
SOURCE_ID column.
Definition: MSKeys.h:111
A sub scan is a unique combination of observation ID, array ID, scan number, and field ID.
Definition: MSKeys.h:42