casa
$Rev:20696$
|
00001 //# MSStateIndex: index or lookup in a MeasurementSet FIELD subtable 00002 //# Copyright (C) 2000,2001 00003 //# Associated Universities, Inc. Washington DC, USA. 00004 //# 00005 //# This library is free software; you can redistribute it and/or modify it 00006 //# under the terms of the GNU Library General Public License as published by 00007 //# the Free Software Foundation; either version 2 of the License, or (at your 00008 //# option) any later version. 00009 //# 00010 //# This library is distributed in the hope that it will be useful, but WITHOUT 00011 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00012 //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public 00013 //# License for more details. 00014 //# 00015 //# You should have received a copy of the GNU Library General Public License 00016 //# along with this library; if not, write to the Free Software Foundation, 00017 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA. 00018 //# 00019 //# Correspondence concerning AIPS++ should be addressed as follows: 00020 //# Internet email: aips2-request@nrao.edu. 00021 //# Postal address: AIPS++ Project Office 00022 //# National Radio Astronomy Observatory 00023 //# 520 Edgemont Road 00024 //# Charlottesville, VA 22903-2475 USA 00025 //# 00026 //# 00027 //# $Id: $ 00028 00029 #ifndef MS_MSSTATEINDEX_H 00030 #define MS_MSSTATEINDEX_H 00031 00032 //# includes 00033 #include <casa/aips.h> 00034 #include <ms/MeasurementSets/MSState.h> 00035 #include <ms/MeasurementSets/MSSelectionError.h> 00036 #include <ms/MeasurementSets/MSStateColumns.h> 00037 #include <casa/Arrays/Vector.h> 00038 #include <casa/BasicSL/String.h> 00039 00040 namespace casa { //# NAMESPACE CASA - BEGIN 00041 00042 //# forward declarations 00043 00044 // <summary> 00045 // Class to handle lookup or indexing into a MS FIELD subtable 00046 // </summary> 00047 00048 // <use visibility=export> 00049 // 00050 // <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos=""> 00051 // </reviewed> 00052 00053 // <prerequisite> 00054 // <li> MeasurementSet 00055 // <li> MSState 00056 // </prerequisite> 00057 // 00058 // <etymology> 00059 // From "MeasurementSet", "FIELD subtable" and "index". 00060 // </etymology> 00061 // 00062 // <synopsis> 00063 // This class provides lookup and indexing into an MS FIELD 00064 // subtable. These services include returning rows numbers 00065 // (which for the FIELD subtable are FIELD_ID's) associated 00066 // with specific data in the subtable. 00067 // </synopsis> 00068 // 00069 // <example> 00070 // </example> 00071 // 00072 // <motivation> 00073 // Collect together all subtable indexing and lookup for the 00074 // FIELD subtable, for encapsulation and efficiency. 00075 // </motivation> 00076 // 00077 // <thrown> 00078 // <li> 00079 // <li> 00080 // </thrown> 00081 // 00082 00083 class MSStateIndex 00084 { 00085 public: 00086 // Construct from an MS FIELD subtable 00087 MSStateIndex(const MSState &state); 00088 00089 // Null destructor 00090 virtual ~MSStateIndex() {}; 00091 00092 Vector<Int> matchStateIntent(const String& name); 00093 Vector<Int> matchStateIntent(const Vector<String>& names); 00094 00095 //ADD for file name wildcard selection 00096 Vector<Int> matchStateObsMode(const String& name); 00097 Vector<Int> matchStateObsMode(const Vector<String>& names); 00098 00099 // Look up FIELD_ID's for a given pattern/regex for source name/code 00100 Vector<Int> matchStateRegexOrPattern(const String& pattern, 00101 const Bool regex=False); 00102 Vector<Int> matchStateObsModeRegexOrPattern(const String& pattern, 00103 const Bool regex=False); 00104 // Look up FIELD_ID's for a given source id 00105 Vector<Int> matchStateId(const Int& sourceId); 00106 Vector<Int> matchStateId(const Vector<Int>& sourceIds); 00107 00108 Vector<Int> maskStateIDs(const Vector<Int>& ids); 00109 00110 Vector<Int> matchStateIDLT(const Int n); 00111 Vector<Int> matchStateIDGT(const Int n); 00112 Vector<Int> matchStateIDGTAndLT(const Int n0, const int n1); 00113 private: 00114 // Disallow null constructor 00115 MSStateIndex(); 00116 00117 // FIELD subtable column accessor 00118 ROMSStateColumns msStateCols_p; 00119 00120 // Vector cache of field id's 00121 Vector<Int> stateIds_p; 00122 Int nrows_p; 00123 Int matchAnyRegex(const Vector<String>& strList, const Regex& regex, const Int pos=0); 00124 }; 00125 00126 00127 } //# NAMESPACE CASA - END 00128 00129 #endif 00130