casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SourceRecord.h
Go to the documentation of this file.
1 /*
2  * SourceRecord.h
3  *
4  * Created on: Jan 27, 2016
5  * Author: nakazato
6  */
7 
8 #ifndef SINGLEDISH_FILLER_SOURCERECORD_H_
9 #define SINGLEDISH_FILLER_SOURCERECORD_H_
10 
16 
17 namespace casa { //# NAMESPACE CASA - BEGIN
18 namespace sdfiller { //# NAMESPACE SDFILLER - BEGIN
19 
20 struct SourceRecord {
23 
24  // mandatory
32 
33  // optional
40 
41  // method
42  void clear() {
43  source_id = -1;
44  spw_id = -1;
45  name = "";
46  time = -1.0;
47  interval = -1.0;
49  num_lines = 0;
50  code = "";
51  calibration_group = -1;
54  sysvel.resize();
56  }
57 
59  source_id = other.source_id;
60  spw_id = other.spw_id;
61  name = other.name;
62  time = other.time;
63  interval = other.interval;
64  direction = other.direction;
65  num_lines = other.num_lines;
66  code = other.code;
68  transition = other.transition;
70  sysvel = other.sysvel;
72  return *this;
73  }
74 
75  void add(AssociatingTable &table, AssociatingColumns &columns) {
76  if (columns.nrow() == 0) {
77  // set frame info
78  casacore::TableRecord &record = columns.direction().rwKeywordSet();
79  casacore::Record meas_info = record.asRecord("MEASINFO");
80  meas_info.define("Ref", direction.getRefString());
81  record.defineRecord("MEASINFO", meas_info);
82  }
83 
84  table.addRow(1, true);
85  }
86 
88  if (columns.nrow() <= irow) {
89  return false;
90  }
91 
92  columns.sourceId().put(irow, source_id);
93  columns.spectralWindowId().put(irow, spw_id);
94  columns.name().put(irow, name);
95  columns.time().put(irow, time);
96  columns.interval().put(irow, interval);
97  columns.directionMeas().put(irow, direction);
98  columns.numLines().put(irow, num_lines);
99  columns.calibrationGroup().put(irow, calibration_group);
100  if (code.size() > 0) {
101  columns.code().put(irow, code);
102  }
103  if (transition.size() > 0) {
104  columns.transition().put(irow, transition);
105  }
106  if (rest_frequency.size() > 0) {
107  columns.restFrequency().put(irow, rest_frequency);
108  }
109  if (sysvel.size() > 0) {
110  columns.sysvel().put(irow, sysvel);
111  }
112  if (proper_motion.size() > 0) {
113  columns.properMotion().put(irow, proper_motion);
114  }
115 
116  return true;
117  }
118 };
119 
120 } //# NAMESPACE SDFILLER - END
121 } //# NAMESPACE CASA - END
122 
123 #endif /* SINGLEDISH_FILLER_SOURCERECORD_H_ */
ScalarColumn< Int > & calibrationGroup()
Read-write access to required columns.
casacore::String code
optional
Definition: SourceRecord.h:34
A Measure: astronomical direction.
Definition: MDirection.h:174
void addRow(uInt nrrow=1, Bool initialize=False)
Add one or more rows at the end of the table.
Definition: Table.h:1235
ArrayColumn< Double > & restFrequency()
int Int
Definition: aipstype.h:50
casacore::Vector< casacore::Double > sysvel
Definition: SourceRecord.h:38
casacore::MSSource AssociatingTable
Definition: SourceRecord.h:21
ArrayColumn< Double > & properMotion()
uInt nrow() const
Convenience function that returns the number of rows in any of the columns.
ScalarColumn< Double > & interval()
ScalarColumn< Int > & sourceId()
casacore::Int source_id
mandatory
Definition: SourceRecord.h:25
casacore::Vector< casacore::String > transition
Definition: SourceRecord.h:36
void put(uInt rownr, const Array< T > &array)
Put the array in a particular cell (i.e.
ScalarColumn< String > & code()
casacore::Bool fill(casacore::uInt irow, AssociatingColumns &columns)
Definition: SourceRecord.h:87
size_type size() const
Capacity, size.
Definition: String.h:342
void defineRecord(const RecordFieldId &, const TableRecord &value, RecordType type=Variable)
Define a value for the given field.
ScalarColumn< Double > & time()
A class to provide easy read-write access to MSSource columns.
void add(AssociatingTable &table, AssociatingColumns &columns)
Definition: SourceRecord.h:75
A Table intended to hold a MeasurementSet SOURCE table.
Definition: MSSource.h:77
casacore::Int calibration_group
Definition: SourceRecord.h:35
double Double
Definition: aipstype.h:55
SourceRecord & operator=(SourceRecord const &other)
Definition: SourceRecord.h:58
A hierarchical collection of named fields of various types.
Definition: Record.h:180
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
ArrayColumn< Double > & sysvel()
casacore::Vector< casacore::Double > rest_frequency
Definition: SourceRecord.h:37
ArrayColumn< String > & transition()
A hierarchical collection of named fields of various types.
Definition: TableRecord.h:182
ScalarColumn< Int > & spectralWindowId()
ScalarColumn< Int > & numLines()
TableRecord & rwKeywordSet()
Get read/write access to the column keyword set.
virtual const RecordInterface & asRecord(const RecordFieldId &) const
casacore::MDirection direction
Definition: SourceRecord.h:30
casacore::Vector< casacore::Double > proper_motion
Definition: SourceRecord.h:39
ArrayColumn< Double > & direction()
casacore::Double interval
Definition: SourceRecord.h:29
void put(uInt rownr, const T &value)
Put the value in a particular cell (i.e.
Definition: ScalarColumn.h:198
String: the storage and methods of handling collections of characters.
Definition: String.h:223
void put(uInt rownr, const M &meas)
Put a Measure into the given row.
size_t size() const
Definition: ArrayBase.h:101
void resize(size_t len, Bool copyValues=False)
Definition: Vector.h:167
void define(const RecordFieldId &, Bool value)
Define a value for the given field.
virtual String getRefString() const
Get the reference type (for records, including codes like R_)
ScalarMeasColumn< MDirection > & directionMeas()
casacore::MSSourceColumns AssociatingColumns
Definition: SourceRecord.h:22
ScalarColumn< String > & name()
unsigned int uInt
Definition: aipstype.h:51