SourceRecord.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008 #ifndef SINGLEDISH_FILLER_SOURCERECORD_H_
00009 #define SINGLEDISH_FILLER_SOURCERECORD_H_
00010
00011 #include <casacore/casa/Arrays/Matrix.h>
00012 #include <casacore/casa/BasicSL/String.h>
00013 #include <casacore/measures/Measures/MDirection.h>
00014 #include <casacore/ms/MeasurementSets/MSSource.h>
00015 #include <casacore/ms/MeasurementSets/MSSourceColumns.h>
00016
00017 namespace casa {
00018 namespace sdfiller {
00019
00020 struct SourceRecord {
00021 typedef MSSource AssociatingTable;
00022 typedef MSSourceColumns AssociatingColumns;
00023
00024
00025 Int source_id;
00026 Int spw_id;
00027 String name;
00028 Double time;
00029 Double interval;
00030 MDirection direction;
00031 Int num_lines;
00032
00033
00034 String code;
00035 Int calibration_group;
00036 Vector<String> transition;
00037 Vector<Double> rest_frequency;
00038 Vector<Double> sysvel;
00039 Vector<Double> proper_motion;
00040
00041
00042 void clear() {
00043 source_id = -1;
00044 spw_id = -1;
00045 name = "";
00046 time = -1.0;
00047 interval = -1.0;
00048 direction = MDirection();
00049 num_lines = 0;
00050 code = "";
00051 calibration_group = -1;
00052 transition.resize();
00053 rest_frequency.resize();
00054 sysvel.resize();
00055 proper_motion.resize();
00056 }
00057
00058 SourceRecord &operator=(SourceRecord const &other) {
00059 source_id = other.source_id;
00060 spw_id = other.spw_id;
00061 name = other.name;
00062 time = other.time;
00063 interval = other.interval;
00064 direction = other.direction;
00065 num_lines = other.num_lines;
00066 code = other.code;
00067 calibration_group = other.calibration_group;
00068 transition = other.transition;
00069 rest_frequency = other.rest_frequency;
00070 sysvel = other.sysvel;
00071 proper_motion = other.proper_motion;
00072 return *this;
00073 }
00074
00075 void add(AssociatingTable &table, AssociatingColumns &columns) {
00076 if (columns.nrow() == 0) {
00077
00078 TableRecord &record = columns.direction().rwKeywordSet();
00079 Record meas_info = record.asRecord("MEASINFO");
00080 meas_info.define("Ref", direction.getRefString());
00081 record.defineRecord("MEASINFO", meas_info);
00082 }
00083
00084 table.addRow(1, True);
00085 }
00086
00087 Bool fill(uInt irow, AssociatingColumns &columns) {
00088 if (columns.nrow() <= irow) {
00089 return False;
00090 }
00091
00092 columns.sourceId().put(irow, source_id);
00093 columns.spectralWindowId().put(irow, spw_id);
00094 columns.name().put(irow, name);
00095 columns.time().put(irow, time);
00096 columns.interval().put(irow, interval);
00097 columns.directionMeas().put(irow, direction);
00098 columns.numLines().put(irow, num_lines);
00099 columns.calibrationGroup().put(irow, calibration_group);
00100 if (code.size() > 0) {
00101 columns.code().put(irow, code);
00102 }
00103 if (transition.size() > 0) {
00104 columns.transition().put(irow, transition);
00105 }
00106 if (rest_frequency.size() > 0) {
00107 columns.restFrequency().put(irow, rest_frequency);
00108 }
00109 if (sysvel.size() > 0) {
00110 columns.sysvel().put(irow, sysvel);
00111 }
00112 if (proper_motion.size() > 0) {
00113 columns.properMotion().put(irow, proper_motion);
00114 }
00115
00116 return True;
00117 }
00118 };
00119
00120 }
00121 }
00122
00123 #endif