PlotMSAveraging.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #ifndef PLOTMSAVERAGING_H_
00028 #define PLOTMSAVERAGING_H_
00029
00030 #include <plotms/PlotMS/PlotMSConstants.h>
00031
00032 #include <map>
00033
00034 namespace casa {
00035
00036
00037 class PlotMSAveraging {
00038 public:
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050 PMS_ENUM1(Field, fields, fieldStrings, field,
00051 CHANNEL, TIME, SCAN, FIELD, BASELINE, ANTENNA, SPW,
00052 SCALARAVE)
00053 PMS_ENUM2(Field, fields, fieldStrings, field,
00054 "channel", "time", "scan", "field", "baseline",
00055 "antenna", "spw",
00056 "scalar")
00057
00058
00059
00060
00061 static bool fieldHasValue(Field f);
00062
00063
00064
00065
00066
00067 static const vector<Field>& fieldMutuallyExclusiveGroup(Field f);
00068
00069
00070
00071 static bool fieldIsInMutuallyExclusiveGroup(Field f) {
00072 return fieldMutuallyExclusiveGroup(f).size() > 0; }
00073
00074
00075
00076
00077
00078 PlotMSAveraging();
00079
00080
00081 ~PlotMSAveraging();
00082
00083
00084
00085
00086
00087
00088
00089 void fromRecord(const RecordInterface& record);
00090 Record toRecord(bool useStrings = false) const;
00091
00092
00093
00094
00095 bool getFlag(Field f) const;
00096 void getFlag(Field f, bool& flag) const { flag = getFlag(f); }
00097 void setFlag(Field f, bool on);
00098
00099
00100
00101
00102 double getValue(Field f) const;
00103 void getValue(Field f, double& value) const { value = getValue(f); }
00104 void setValue(Field f, double value);
00105
00106
00107
00108
00109
00110
00111 String getValueStr(Field f) const;
00112 void getValue(Field f, String& value) const { value = getValueStr(f); }
00113 void setValue(Field f, const String& value);
00114
00115
00116
00117
00118 bool anyAveraging() const { return (channel() || time() ||
00119 baseline() || antenna() ||spw()); }
00120
00121
00122
00123 bool channel() const { return getFlag(CHANNEL); }
00124 double channelValue() const { return getValue(CHANNEL); }
00125 String channelStr() const { return getValueStr(CHANNEL); }
00126 bool time() const { return getFlag(TIME); }
00127 double timeValue() const { return getValue(TIME); }
00128 String timeStr() const { return getValueStr(TIME); }
00129 bool scan() const { return getFlag(SCAN); }
00130 bool field() const { return getFlag(FIELD); }
00131 bool baseline() const { return getFlag(BASELINE); }
00132 bool antenna() const { return getFlag(ANTENNA); }
00133 bool spw() const { return getFlag(SPW); }
00134 bool scalarAve() const { return getFlag(SCALARAVE); }
00135
00136
00137
00138
00139 void setChannel(const String& value) { setValue(CHANNEL, value); }
00140 void setChannel(bool flag) { setFlag(CHANNEL, flag); }
00141 void setChannelValue(double value) { setValue(CHANNEL, value); }
00142 void setTime(const String& value) { setValue(TIME, value); }
00143 void setTime(bool flag) { setFlag(TIME, flag); }
00144 void setTimeValue(double value) { setValue(TIME, value); }
00145 void setScan(bool flag) { setFlag(SCAN, flag); }
00146 void setField(bool flag) { setFlag(FIELD, flag); }
00147 void setBaseline(bool flag) { setFlag(BASELINE, flag); }
00148 void setAntenna(bool flag) { setFlag(ANTENNA, flag); }
00149 void setSpw(bool flag) { setFlag(SPW, flag); }
00150 void setScalarAve(bool flag) { setFlag(SCALARAVE,flag); }
00151
00152
00153
00154
00155
00156 bool operator==(const PlotMSAveraging& other) const;
00157 bool operator!=(const PlotMSAveraging& other) const {
00158 return !(operator==(other)); }
00159
00160
00161
00162 String summary() const;
00163
00164
00165 String toStringShort() const;
00166
00167 private:
00168
00169 std::map<Field, bool> itsFlags_;
00170
00171
00172 std::map<Field, double> itsValues_;
00173
00174
00175
00176 void setDefaults();
00177
00178
00179
00180
00181 static const String RKEY_VALUE;
00182 };
00183
00184 }
00185
00186 #endif