[2696] | 1 | // |
---|
| 2 | // C++ Interface: STApplyTable |
---|
| 3 | // |
---|
| 4 | // Description: |
---|
| 5 | // |
---|
| 6 | // Base class for application tables. |
---|
| 7 | // |
---|
[2703] | 8 | // Author: Takeshi Nakazato <takeshi.nakazato@nao.ac.jp> (C) 2012 |
---|
[2696] | 9 | // |
---|
| 10 | // Copyright: See COPYING file that comes with this distribution |
---|
| 11 | // |
---|
| 12 | // |
---|
[2703] | 13 | #ifndef ASAP_APPLY_TABLE_H |
---|
| 14 | #define ASAP_APPLY_TABLE_H |
---|
[2696] | 15 | |
---|
| 16 | #include <casa/Arrays/Vector.h> |
---|
| 17 | #include <casa/Logging/LogIO.h> |
---|
| 18 | #include <tables/Tables/Table.h> |
---|
| 19 | #include <tables/Tables/ScalarColumn.h> |
---|
| 20 | #include <measures/TableMeasures/ScalarMeasColumn.h> |
---|
| 21 | |
---|
| 22 | #include "Scantable.h" |
---|
| 23 | #include "STSelector.h" |
---|
[2720] | 24 | #include "STCalEnum.h" |
---|
[2696] | 25 | |
---|
| 26 | namespace asap { |
---|
| 27 | |
---|
| 28 | /** |
---|
| 29 | Abstract base class for all application tables. |
---|
| 30 | |
---|
| 31 | @author Takeshi Nakazato |
---|
| 32 | @date $Date:$ |
---|
| 33 | @version $Revision:$ |
---|
| 34 | */ |
---|
| 35 | class STApplyTable { |
---|
| 36 | public: |
---|
| 37 | STApplyTable() {;} |
---|
[3106] | 38 | STApplyTable(const Scantable& parent, const casacore::String& name); |
---|
| 39 | STApplyTable(const casacore::String &name); |
---|
[2696] | 40 | |
---|
| 41 | virtual ~STApplyTable(); |
---|
| 42 | |
---|
| 43 | /** |
---|
| 44 | * Add extra columns. To be implemented in derived class |
---|
| 45 | */ |
---|
| 46 | virtual void setup() = 0; |
---|
| 47 | |
---|
| 48 | /*** |
---|
| 49 | * Name of the table |
---|
| 50 | ***/ |
---|
[3106] | 51 | virtual const casacore::String& name() const = 0; |
---|
[2696] | 52 | |
---|
[3106] | 53 | const casacore::Table& table() const { return table_; } |
---|
| 54 | casacore::Table table() { return table_; } |
---|
[2696] | 55 | void attach(); |
---|
| 56 | void attachBaseColumns(); |
---|
| 57 | virtual void attachOptionalColumns() = 0; |
---|
| 58 | |
---|
[3106] | 59 | casacore::uInt nrow() {return table_.nrow();} |
---|
[2696] | 60 | |
---|
[3106] | 61 | casacore::Vector<casacore::uInt> getScan() const {return scanCol_.getColumn();} |
---|
| 62 | casacore::Vector<casacore::uInt> getCycle() const {return cycleCol_.getColumn();} |
---|
| 63 | casacore::Vector<casacore::uInt> getBeam() const {return beamCol_.getColumn();} |
---|
| 64 | casacore::Vector<casacore::uInt> getIF() const {return ifCol_.getColumn();} |
---|
| 65 | casacore::Vector<casacore::uInt> getPol() const {return polCol_.getColumn();} |
---|
| 66 | casacore::Vector<casacore::Double> getTime() const {return timeCol_.getColumn();} |
---|
[2696] | 67 | |
---|
[2720] | 68 | void setSelection(STSelector &sel, bool sortByTime=false); |
---|
[2696] | 69 | void unsetSelection(); |
---|
[3106] | 70 | casacore::String caltype(); |
---|
[2696] | 71 | |
---|
[3106] | 72 | void save(const casacore::String &name); |
---|
[2703] | 73 | |
---|
[3106] | 74 | virtual casacore::uInt nchan(casacore::uInt ifno) = 0; |
---|
[2720] | 75 | |
---|
| 76 | // static methods |
---|
[3106] | 77 | static STCalEnum::CalType getCalType(const casacore::String &name); |
---|
| 78 | static STCalEnum::CalType getCalType(casacore::CountedPtr<STApplyTable> tab); |
---|
[2720] | 79 | static STCalEnum::CalType getCalType(STApplyTable *tab); |
---|
| 80 | |
---|
[2696] | 81 | protected: |
---|
[3106] | 82 | void setbasedata(casacore::uInt irow, casacore::uInt scanno, casacore::uInt cycleno, |
---|
| 83 | casacore::uInt beamno, casacore::uInt ifno, casacore::uInt polno, |
---|
| 84 | casacore::uInt freqid, casacore::Double time); |
---|
| 85 | casacore::Block<casacore::Double> getFrequenciesRow(casacore::uInt id); |
---|
[2696] | 86 | |
---|
[3106] | 87 | casacore::Table table_, originaltable_; |
---|
| 88 | casacore::ScalarColumn<casacore::uInt> scanCol_, cycleCol_, beamCol_, ifCol_, polCol_, freqidCol_; |
---|
| 89 | casacore::ScalarColumn<casacore::Double> timeCol_; |
---|
| 90 | casacore::MEpoch::ScalarColumn timeMeasCol_; |
---|
[2696] | 91 | STSelector sel_; |
---|
[3106] | 92 | casacore::LogIO os_; |
---|
[2696] | 93 | |
---|
| 94 | private: |
---|
[3106] | 95 | static STCalEnum::CalType stringToType(const casacore::String &caltype); |
---|
[2696] | 96 | }; |
---|
| 97 | |
---|
| 98 | } |
---|
| 99 | |
---|
| 100 | #endif |
---|