// // C++ Interface: FillerBase // // Description: // // // Author: Malte Marquarding , (C) 2010 // // Copyright: See COPYING file that comes with this distribution // // #include #include "FillerBase.h" using namespace casa; namespace asap { FillerBase::FillerBase(casa::CountedPtr stable) : table_(stable) { row_ = TableRow(table_->table()); } void FillerBase::setHeader(const STHeader& header) { table_->setHeader(header); } void FillerBase::setSpectrum(const Vector& spectrum, const Vector& flags, const Vector& tsys) { RecordFieldPtr< Array > specCol(row_.record(), "SPECTRA"); RecordFieldPtr< Array > flagCol(row_.record(), "FLAGTRA"); RecordFieldPtr< Array > tsysCol(row_.record(), "TSYS"); *specCol = spectrum; *flagCol = flags; *tsysCol = tsys; } void FillerBase::setFlagrow(uInt flag) { RecordFieldPtr flagrowCol(row_.record(), "FLAGROW"); *flagrowCol = flag; } void FillerBase::setOpacity(Float opacity) { RecordFieldPtr tauCol(row_.record(), "OPACITY") ; *tauCol = opacity ; } void FillerBase::setIndex(uInt scanno, uInt cycleno, uInt ifno, uInt polno, uInt beamno) { RecordFieldPtr beamCol(row_.record(), "BEAMNO"); RecordFieldPtr ifCol(row_.record(), "IFNO"); RecordFieldPtr polCol(row_.record(), "POLNO"); RecordFieldPtr cycleCol(row_.record(), "CYCLENO"); RecordFieldPtr scanCol(row_.record(), "SCANNO"); *beamCol = beamno; *cycleCol = cycleno; *ifCol = ifno; *polCol = polno; *scanCol = scanno; } void FillerBase::setFrequency(Double refpix, Double refval, Double incr) { /// @todo this has to change when nchan isn't global anymore uInt id= table_->frequencies().addEntry(refpix, refval, incr); RecordFieldPtr mfreqidCol(row_.record(), "FREQ_ID"); *mfreqidCol = id; } void FillerBase::setMolecule(const Vector& restfreq) { Vector tmp; uInt id = table_->molecules().addEntry(restfreq, tmp, tmp); RecordFieldPtr molidCol(row_.record(), "MOLECULE_ID"); *molidCol = id; } void FillerBase::setDirection(const Vector& dir, Float az, Float el) { RecordFieldPtr > dirCol(row_.record(), "DIRECTION"); *dirCol = dir; RecordFieldPtr azCol(row_.record(), "AZIMUTH"); *azCol = az; RecordFieldPtr elCol(row_.record(), "ELEVATION"); *elCol = el; } void FillerBase::setFocus(Float pa, Float faxis, Float ftan, Float frot) { RecordFieldPtr mfocusidCol(row_.record(), "FOCUS_ID"); uInt id = table_->focus().addEntry(pa, faxis, ftan, frot); *mfocusidCol = id; } void FillerBase::setTime(Double interval, Double mjd) { RecordFieldPtr mjdCol(row_.record(), "TIME"); *mjdCol = mjd; RecordFieldPtr intCol(row_.record(), "INTERVAL"); *intCol = interval; } void FillerBase::setWeather(Float temperature, Float pressure, Float humidity, Float windspeed, Float windaz) { uInt id = table_->weather().addEntry(temperature, pressure, humidity, windspeed, windaz); RecordFieldPtr mweatheridCol(row_.record(), "WEATHER_ID"); *mweatheridCol = id; } void FillerBase::setTcal(const String& tcaltime, const Vector& tcal) { uInt id = table_->tcal().addEntry(tcaltime, tcal); RecordFieldPtr mcalidCol(row_.record(), "TCAL_ID"); *mcalidCol = id; } void FillerBase::setScanRate(const Vector& srate) { RecordFieldPtr > srateCol(row_.record(), "SCANRATE"); *srateCol = srate; } void FillerBase::setReferenceBeam(Int beamno) { RecordFieldPtr rbCol(row_.record(), "REFBEAMNO"); *rbCol = beamno; } void FillerBase::setSource(const std::string& name, Int type, const std::string& fieldname, const Vector& dir, const Vector& propermot, Double velocity) { RecordFieldPtr srcnCol(row_.record(), "SRCNAME"); *srcnCol = name; RecordFieldPtr srctCol(row_.record(), "SRCTYPE"); *srctCol = type; RecordFieldPtr fieldnCol(row_.record(), "FIELDNAME"); *fieldnCol = fieldname; RecordFieldPtr > spmCol(row_.record(), "SRCPROPERMOTION"); *spmCol = propermot; RecordFieldPtr > sdirCol(row_.record(), "SRCDIRECTION"); *sdirCol = dir; RecordFieldPtr svelCol(row_.record(), "SRCVELOCITY"); *svelCol = velocity; } void FillerBase::commitRow() { table_->table().addRow(); row_.put(table_->table().nrow()-1); } };