File: timefrequencymetadata.h

package info (click to toggle)
aoflagger 2.13.0-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 4,232 kB
  • sloc: cpp: 61,805; python: 60; sh: 23; makefile: 8
file content (193 lines) | stat: -rw-r--r-- 4,940 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
#ifndef MSIO_TIME_FREQUENCY_META_DATA_H
#define MSIO_TIME_FREQUENCY_META_DATA_H

#include <string>
#include <vector>
#include <memory>

#include "antennainfo.h"

typedef std::shared_ptr<class TimeFrequencyMetaData> TimeFrequencyMetaDataPtr;
typedef std::shared_ptr<const class TimeFrequencyMetaData> TimeFrequencyMetaDataCPtr;

class TimeFrequencyMetaData
{
	public:
		TimeFrequencyMetaData()
			: _antenna1(0), _antenna2(0), _band(0), _sequenceId(0), _field(0), _observationTimes(0), _uvw(0), _valueDescription("Visibility"), _valueUnits("Jy")
		{
		}
		TimeFrequencyMetaData(const AntennaInfo &antenna1, const AntennaInfo &antenna2, const BandInfo &band, const FieldInfo &field, const std::vector<double> &observationTimes)
		:
			_antenna1(new AntennaInfo(antenna1)),
			_antenna2(new AntennaInfo(antenna2)),
			_band(new BandInfo(band)),
			_sequenceId(0),
			_field(new FieldInfo(field)),
			_observationTimes(new std::vector<double>(observationTimes)),
			_uvw(0),
			_valueDescription("Visibility"),
			_valueUnits("Jy")
		{
		}
		TimeFrequencyMetaData(const TimeFrequencyMetaData &source)
			: _antenna1(0), _antenna2(0), _band(0), _sequenceId(source._sequenceId), _field(0), _observationTimes(0), _uvw(0),
			_valueDescription(source._valueDescription),
			_valueUnits(source._valueUnits)
		{
			if(source._antenna1 != 0)
				_antenna1 = new AntennaInfo(*source._antenna1);
			if(source._antenna2 != 0)
				_antenna2 = new AntennaInfo(*source._antenna2);
			if(source._band != 0)
				_band = new BandInfo(*source._band);
			if(source._field != 0)
				_field = new FieldInfo(*source._field);
			if(source._observationTimes != 0)
				_observationTimes = new std::vector<double>(*source._observationTimes);
			if(source._uvw != 0)
				_uvw = new std::vector<class UVW>(*source._uvw);
		}
		~TimeFrequencyMetaData()
		{
			ClearAntenna1();
			ClearAntenna2();
			ClearBand();
			ClearField();
			ClearObservationTimes();
			ClearUVW();
		}

		const AntennaInfo &Antenna1() const { return *_antenna1; }
		void ClearAntenna1()
		{
			if(_antenna1 != 0)
			{
				delete _antenna1;
				_antenna1 = 0;
			}
		}
		void SetAntenna1(const AntennaInfo &antenna1)
		{
			ClearAntenna1();
			_antenna1 = new AntennaInfo(antenna1);
		}
		bool HasAntenna1() const { return _antenna1 != 0; }

		const AntennaInfo &Antenna2() const { return *_antenna2; }
		void ClearAntenna2()
		{
			if(_antenna2 != 0)
			{
				delete _antenna2;
				_antenna2 = 0;
			}
		}
		void SetAntenna2(const AntennaInfo &antenna2)
		{
			ClearAntenna2();
			_antenna2 = new AntennaInfo(antenna2);
		}
		bool HasAntenna2() const { return _antenna2 != 0; }

		const BandInfo &Band() const { return *_band; }
		void ClearBand()
		{
			if(_band != 0)
			{
				delete _band;
				_band = 0;
			}
		}
		void SetBand(const BandInfo &band)
		{
			ClearBand();
			_band = new BandInfo(band);
		}
		bool HasBand() const { return _band != 0; }

		const FieldInfo &Field() const { return *_field; }
		void ClearField()
		{
			if(_field != 0)
			{
				delete _field;
				_field = 0;
			}
		}
		void SetField(const FieldInfo &field)
		{
			ClearField();
			_field = new FieldInfo(field);
		}
		bool HasField() const { return _field != 0; }

		const std::vector<double> &ObservationTimes() const {
			return *_observationTimes;
		}
		void ClearObservationTimes()
		{
			if(_observationTimes != 0)
			{
				delete _observationTimes;
				_observationTimes = 0;
			}
		}
		void SetObservationTimes(const std::vector<double> &times)
		{
			ClearObservationTimes();
			_observationTimes = new std::vector<double>(times);
		}
		bool HasObservationTimes() const { return _observationTimes != 0; }
		
		unsigned SequenceId() const { return _sequenceId; }
		void SetSequenceId(unsigned sequenceId) { _sequenceId = sequenceId; }
		
		const std::vector<class UVW> &UVW() const { return *_uvw; }
		void ClearUVW()
		{
			if(_uvw != 0)
			{
				delete _uvw;
				_uvw = 0;
			}
		}
		void SetUVW(const std::vector<class UVW> &uvw)
		{
			ClearUVW();
			_uvw = new std::vector<class UVW>(uvw);
		}
		bool HasUVW() const { return _uvw != 0; }

		bool HasBaseline() const {
			return HasAntenna1() && HasAntenna2();
		}
		class Baseline Baseline() const {
			return ::Baseline(*_antenna1, *_antenna2);
		}
		
		const std::string &ValueDescription() const { return _valueDescription; }
		void SetValueDescription(const std::string &valueDescription)
		{
			_valueDescription = valueDescription;
		}
		
		const std::string &ValueUnits() const { return _valueUnits; }
		void SetValueUnits(const std::string &valueUnits)
		{
			_valueUnits = valueUnits;
		}
	private:
		void operator=(const TimeFrequencyMetaData &) = delete;
		
		AntennaInfo *_antenna1;
		AntennaInfo *_antenna2;
		BandInfo *_band;
		unsigned _sequenceId;
		FieldInfo *_field;
		std::vector<double> *_observationTimes;
		std::vector<class UVW> *_uvw;
		std::string _valueDescription, _valueUnits;
};

#endif // MSIO_TIME_FREQUENCY_META_DATA_H