casa
$Rev:20696$
|
00001 //# VLABaselineRecord: 00002 //# Copyright (C) 1999 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 NRAO_VLABASELINERECORD_H 00030 #define NRAO_VLABASELINERECORD_H 00031 00032 #include <casa/aips.h> 00033 #include <casa/IO/ByteSource.h> 00034 //# The following should be a forward declaration. But our Complex & DComplex 00035 //# classes are a typedef hence this does not work. Replace the following with 00036 //# forward declarations when Complex and DComplex are no longer typedefs. 00037 #include <casa/BasicSL/Complex.h> 00038 00039 #include <casa/namespace.h> 00040 namespace casa { //# NAMESPACE CASA - BEGIN 00041 class String; 00042 template <class T> class Vector; 00043 template <class T> class Array; 00044 } //# NAMESPACE CASA - END 00045 00046 00047 // <summary></summary> 00048 00049 // <use visibility=export> 00050 00051 // <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos=""> 00052 // </reviewed> 00053 00054 // <prerequisite> 00055 // <li> SomeClass 00056 // <li> SomeOtherClass 00057 // <li> some concept 00058 // </prerequisite> 00059 // 00060 // <etymology> 00061 // </etymology> 00062 // 00063 // <synopsis> 00064 // </synopsis> 00065 // 00066 // <example> 00067 // </example> 00068 // 00069 // <motivation> 00070 // </motivation> 00071 // 00072 // <templating arg=T> 00073 // <li> 00074 // <li> 00075 // </templating> 00076 // 00077 // <thrown> 00078 // <li> 00079 // <li> 00080 // </thrown> 00081 // 00082 // <todo asof="yyyy/mm/dd"> 00083 // <li> add this feature 00084 // <li> fix this bug 00085 // <li> start discussion of this possible extension 00086 // </todo> 00087 00088 class VLABaselineRecord 00089 { 00090 public: 00091 // The shapes of all the components 00092 enum Type { 00093 // A simple point component 00094 CONTINUUM = 0, 00095 // A elliptical Gaussian component 00096 SPECTRALLINE, 00097 // An unknown Component 00098 UNKNOWN_TYPE, 00099 // The number of types in this enumerator 00100 NUMBER_TYPES 00101 }; 00102 00103 // A virtual destructor is needed to ensure that the destructor of derived 00104 // classes is actually used. 00105 virtual ~VLABaselineRecord(); 00106 00107 // returns the correlations for this baseline. The returned Vector contains 00108 // all the data for this baseline and has been scaled. 00109 virtual Vector<Complex> data() const; 00110 00111 // Returns the correlations for this baseline in the supplied Array. The 00112 // supplied Array may have any number of dimensions, but all except one must 00113 // have a length on 1. The axis that is not of length one must be the right 00114 // length to hold all the data contained in the record. Alternatively the 00115 // Array may contain no elements in which case it will be resized to a Vector 00116 // of the correct length. The returned values have been scaled. 00117 virtual void data(Array<Complex>& values) const = 0; 00118 00119 // returns the flags for the correlations for this baseline. 00120 virtual Vector<Bool> flags() const = 0; 00121 00122 // returns the scaling factor used to convert the internal data to the actual 00123 // values. 00124 virtual uInt scale() const = 0; 00125 00126 // returns the antenna 1 index for this baseline. 00127 virtual uInt ant1() const = 0; 00128 00129 // returns the antenna 2 index for this baseline. 00130 virtual uInt ant2() const = 0; 00131 00132 // return the type of this class 00133 virtual VLABaselineRecord::Type type() const = 0; 00134 00135 // Convert a Type enum into a String 00136 static String name(VLABaselineRecord::Type typeEnum); 00137 00138 // Convert a given String to a Type enumerator 00139 static VLABaselineRecord::Type type(const String& typeName); 00140 00141 protected: 00142 //# The default constructor creates a unusable object. Use the attach 00143 //function to turn an object constructed this way into a usable object. 00144 VLABaselineRecord(); 00145 00146 //# Initialise this VLABaselineRecord from the given record with the 00147 //# specified offset. 00148 VLABaselineRecord(ByteSource& record, uInt offset); 00149 00150 //# Initialise this VLABaselineRecord from the given record with the 00151 //# specified offset. 00152 void attach(ByteSource& record, uInt offset); 00153 00154 //# reads the scaling factor given the offset from the start of the record 00155 uInt scale(uInt headerOffset) const; 00156 00157 //# returns the antenna 1 index for this baseline given the offset in bytes 00158 //# from the start of the record. 00159 uInt ant1(uInt headerOffset) const; 00160 00161 //# returns the antenna 2 index for this baseline given the offset in bytes 00162 //# from the start of the record. 00163 uInt ant2(uInt headerOffset) const; 00164 00165 //# Contains a VLA record 00166 mutable ByteSource itsRecord; 00167 00168 //# the offset to the start of the data for this object in the VLA record. 00169 uInt itsOffset; 00170 private: 00171 //# The copy constructor is private and undefined 00172 VLABaselineRecord(const VLABaselineRecord& other); 00173 00174 //# The assignment operator is private and undefined. 00175 VLABaselineRecord& operator=(const VLABaselineRecord& other); 00176 }; 00177 #endif 00178 00179