casacore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MSSourceIndex.h
Go to the documentation of this file.
1 //# MSSourceIndex: index into a MeasurementSet SOURCE subtable
2 //# Copyright (C) 2000,2001,2002
3 //# Associated Universities, Inc. Washington DC, USA.
4 //#
5 //# This library is free software; you can redistribute it and/or modify it
6 //# under the terms of the GNU Library General Public License as published by
7 //# the Free Software Foundation; either version 2 of the License, or (at your
8 //# option) any later version.
9 //#
10 //# This library is distributed in the hope that it will be useful, but WITHOUT
11 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
13 //# License for more details.
14 //#
15 //# You should have received a copy of the GNU Library General Public License
16 //# along with this library; if not, write to the Free Software Foundation,
17 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
18 //#
19 //# Correspondence concerning AIPS++ should be addressed as follows:
20 //# Internet email: aips2-request@nrao.edu.
21 //# Postal address: AIPS++ Project Office
22 //# National Radio Astronomy Observatory
23 //# 520 Edgemont Road
24 //# Charlottesville, VA 22903-2475 USA
25 //#
26 //#
27 //# $Id$
28 
29 #ifndef MS_MSSOURCEINDEX_H
30 #define MS_MSSOURCEINDEX_H
31 
32 #include <casacore/casa/aips.h>
35 
37 
38 namespace casacore { //# NAMESPACE CASACORE - BEGIN
39 
40 //# forward declarations
41 class MSSource;
42 
43 // <summary>
44 // </summary>
45 
46 // <use visibility=export>
47 
48 // <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos="">
49 // </reviewed>
50 
51 // <prerequisite>
52 // <li> MeasurementSet
53 // <li> MSTableIndex
54 // </prerequisite>
55 //
56 // <etymology>
57 // </etymology>
58 //
59 // <synopsis>
60 // </synopsis>
61 //
62 // <example>
63 // </example>
64 //
65 // <motivation>
66 // </motivation>
67 //
68 // <thrown>
69 // <li>
70 // <li>
71 // </thrown>
72 //
73 
75 {
76 public:
77  // no index attached, use the attach function or assignment operator to change that
78  MSSourceIndex();
79 
80  // construct one using the indicated SOURCE table
81  MSSourceIndex(const MSSource &source);
82 
83  // construct one from another
84  MSSourceIndex(const MSSourceIndex &other);
85 
86  virtual ~MSSourceIndex();
87 
88  MSSourceIndex &operator=(const MSSourceIndex &other);
89 
90  void attach(const MSSource &source);
91 
92  // access to the source ID key, throws an exception if isNull() is False
93  Int &sourceId() {return *sourceId_p;}
94 
95  // access to the spectral window ID key, throws an
96  // exception if isNull() is False
98 
99  // Match a source name or list of source names to a set of SOURCE_ID's
100  Vector<Int> matchSourceName(const String& name);
102 
103  //add for source code selection
104  Vector<Int> matchSourceCode(const String& code);
105 
106  //Return rows matching a SourceID
108 
109 
110 protected:
111  // the specialized compare function to pass to the
112  // <linkto class=ColumnsIndex>ColumnsIndex</linkto> object. This supports -1
113  // values for the SPECTRAL_WINDOW_ID
114  static Int compare (const Block<void*>& fieldPtrs,
115  const Block<void*>& dataPtrs,
116  const Block<Int>& dataTypes,
117  rownr_t index);
118 
119 private:
120  // Pointer to local MSSourceColumns object
122 
124 
125  void attachIds();
126 
127 };
128 
129 
130 } //# NAMESPACE CASACORE - END
131 
132 #endif
133 
int Int
Definition: aipstype.h:50
MSSourceIndex & operator=(const MSSourceIndex &other)
Vector< Int > matchSourceCode(const String &code)
add for source code selection
RecordFieldPtr< Int > spwId_p
Int & spectralWindowId()
access to the spectral window ID key, throws an exception if isNull() is False
Definition: MSSourceIndex.h:97
RowNumbers getRowNumbersOfSourceID(const Int sid)
Return rows matching a SourceID.
MSSourceIndex()
no index attached, use the attach function or assignment operator to change that
A class to provide easy access to MSSource columns.
A Table intended to hold a MeasurementSet SOURCE table.
Definition: MSSource.h:77
void attach(const MSSource &source)
RecordFieldPtr< Int > sourceId_p
MSSourceColumns * msSourceCols_p
Pointer to local MSSourceColumns object.
uInt64 rownr_t
Define the type of a row number in a table.
Definition: aipsxtype.h:46
Int & sourceId()
access to the source ID key, throws an exception if isNull() is False
Definition: MSSourceIndex.h:93
static Int compare(const Block< void * > &fieldPtrs, const Block< void * > &dataPtrs, const Block< Int > &dataTypes, rownr_t index)
the specialized compare function to pass to the ColumnsIndex object.
String: the storage and methods of handling collections of characters.
Definition: String.h:225
Vector< Int > matchSourceName(const String &name)
Match a source name or list of source names to a set of SOURCE_ID&#39;s.