source: branches/newfiller/src/FillerBase.cpp@ 1784

Last change on this file since 1784 was 1780, checked in by Malte Marquarding, 14 years ago

make filler code compile

File size: 4.3 KB
Line 
1//
2// C++ Interface: FillerBase
3//
4// Description:
5//
6//
7// Author: Malte Marquarding <asap@atnf.csiro.au>, (C) 2010
8//
9// Copyright: See COPYING file that comes with this distribution
10//
11//
12
13#include <casa/Containers/RecordField.h>
14
15#include "FillerBase.h"
16
17using namespace casa;
18
19namespace asap
20{
21FillerBase::FillerBase() :
22 table_(0)
23{
24}
25
26void FillerBase::setSpectrum(const Vector<Float>& spectrum,
27 const Vector<uChar>& flags)
28{
29 RecordFieldPtr< Array<Float> > specCol(row_.record(), "SPECTRA");
30 RecordFieldPtr< Array<uChar> > flagCol(row_.record(), "FLAGTRA");
31 *specCol = spectrum;
32 *flagCol = flags;
33}
34
35void FillerBase::setIndex(uInt scanno, uInt cycleno, uInt ifno, uInt polno,
36 uInt beamno)
37{
38 RecordFieldPtr<uInt> beamCol(row_.record(), "BEAMNO");
39 RecordFieldPtr<uInt> ifCol(row_.record(), "IFNO");
40 RecordFieldPtr<uInt> polCol(row_.record(), "POLNO");
41 RecordFieldPtr<uInt> cycleCol(row_.record(), "CYCLENO");
42 RecordFieldPtr<uInt> scanCol(row_.record(), "SCANNO");
43 *beamCol = beamno;
44 *cycleCol = cycleno;
45 *ifCol = ifno;
46 *polCol = polno;
47 *scanCol = scanno;
48}
49
50void FillerBase::setFrequency(Double refpix, Double refval,
51 Double incr)
52{
53 /// @todo this has to change when nchan isn't global anymore
54 uInt id= table_->frequencies().addEntry(refpix, refval, incr);
55 RecordFieldPtr<uInt> mfreqidCol(row_.record(), "FREQ_ID");
56 *mfreqidCol = id;
57
58}
59
60
61void FillerBase::setMolecule(const Vector<Double>& restfreq)
62{
63 Vector<String> tmp;
64 uInt id = table_->molecules().addEntry(restfreq, tmp, tmp);
65 RecordFieldPtr<uInt> molidCol(row_.record(), "MOLECULE_ID");
66 *molidCol = id;
67}
68
69void FillerBase::setDirection(const Vector<Double>& dir,
70 Float az, Float el)
71{
72 RecordFieldPtr<Array<Double> > dirCol(row_.record(), "DIRECTION");
73 *dirCol = dir;
74 RecordFieldPtr<Float> azCol(row_.record(), "AZIMUTH");
75 *azCol = az;
76 RecordFieldPtr<Float> elCol(row_.record(), "ELEVATION");
77 *elCol = el;
78}
79
80void FillerBase::setFocus(Float pa, Float faxis,
81 Float ftan, Float frot)
82{
83 RecordFieldPtr<uInt> mfocusidCol(row_.record(), "FOCUS_ID");
84 uInt id = table_->focus().addEntry(pa, faxis, ftan, frot);
85 *mfocusidCol = id;
86}
87
88void FillerBase::setTime(Double interval, Double mjd)
89{
90 RecordFieldPtr<Double> mjdCol(row_.record(), "TIME");
91 *mjdCol = mjd;
92 RecordFieldPtr<Double> intCol(row_.record(), "INTERVAL");
93 *intCol = interval;
94
95}
96
97void FillerBase::setWeather(Float temperature, Float pressure,
98 Float humidity,
99 Float windspeed, Float windaz)
100{
101 uInt id = table_->weather().addEntry(temperature, pressure,
102 humidity, windspeed, windaz);
103 RecordFieldPtr<uInt> mweatheridCol(row_.record(), "WEATHER_ID");
104 *mweatheridCol = id;
105}
106
107void FillerBase::setTcal(const String& tcaltime,
108 const Vector<Float>& tcal)
109{
110 uInt id = table_->tcal().addEntry(tcaltime, tcal);
111 RecordFieldPtr<uInt> mcalidCol(row_.record(), "TCAL_ID");
112 *mcalidCol = id;
113}
114
115void FillerBase::setScanRate(const Vector<Double>& srate)
116{
117 RecordFieldPtr<Array<Double> > srateCol(row_.record(), "SCANRATE");
118 *srateCol = srate;
119}
120
121void FillerBase::setReferenceBeam(Int beamno)
122{
123 RecordFieldPtr<Int> rbCol(row_.record(), "REFBEAMNO");
124 *rbCol = beamno;
125}
126
127void FillerBase::setSource(const std::string& name, Int type,
128 const std::string& fieldname,
129 const Vector<Double>& dir,
130 const Vector<Double>& propermot,
131 Double velocity)
132{
133 RecordFieldPtr<String> srcnCol(row_.record(), "SRCNAME");
134 *srcnCol = name;
135 RecordFieldPtr<Int> srctCol(row_.record(), "SRCTYPE");
136 *srctCol = type;
137 RecordFieldPtr<String> fieldnCol(row_.record(), "FIELDNAME");
138 *fieldnCol = fieldname;
139 RecordFieldPtr<Array<Double> > spmCol(row_.record(), "SRCPROPERMOTION");
140 *spmCol = propermot;
141 RecordFieldPtr<Array<Double> > sdirCol(row_.record(), "SRCDIRECTION");
142 *sdirCol = dir;
143 RecordFieldPtr<Double> svelCol(row_.record(), "SRCVELOCITY");
144 *svelCol = velocity;
145}
146
147void FillerBase::commitRow()
148{
149 table_->table().addRow();
150 row_.put(table_->table().nrow()-1);
151}
152
153};
Note: See TracBrowser for help on using the repository browser.