| 1 | //
|
|---|
| 2 | // C++ Interface: STApplyTable
|
|---|
| 3 | //
|
|---|
| 4 | // Description:
|
|---|
| 5 | //
|
|---|
| 6 | // Base class for application tables.
|
|---|
| 7 | //
|
|---|
| 8 | // Author: Takeshi Nakazato <takeshi.nakazato@nao.ac.jp> (C) 2012
|
|---|
| 9 | //
|
|---|
| 10 | // Copyright: See COPYING file that comes with this distribution
|
|---|
| 11 | //
|
|---|
| 12 | //
|
|---|
| 13 | #ifndef ASAP_APPLY_TABLE_H
|
|---|
| 14 | #define ASAP_APPLY_TABLE_H
|
|---|
| 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"
|
|---|
| 24 | #include "STCalEnum.h"
|
|---|
| 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() {;}
|
|---|
| 38 | STApplyTable(const Scantable& parent, const casa::String& name);
|
|---|
| 39 | STApplyTable(const casa::String &name);
|
|---|
| 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 | ***/
|
|---|
| 51 | virtual const casa::String& name() const = 0;
|
|---|
| 52 |
|
|---|
| 53 | const casa::Table& table() const { return table_; }
|
|---|
| 54 | casa::Table table() { return table_; }
|
|---|
| 55 | void attach();
|
|---|
| 56 | void attachBaseColumns();
|
|---|
| 57 | virtual void attachOptionalColumns() = 0;
|
|---|
| 58 |
|
|---|
| 59 | casa::uInt nrow() {return table_.nrow();}
|
|---|
| 60 |
|
|---|
| 61 | casa::Vector<casa::uInt> getScan() const {return scanCol_.getColumn();}
|
|---|
| 62 | casa::Vector<casa::uInt> getCycle() const {return cycleCol_.getColumn();}
|
|---|
| 63 | casa::Vector<casa::uInt> getBeam() const {return beamCol_.getColumn();}
|
|---|
| 64 | casa::Vector<casa::uInt> getIF() const {return ifCol_.getColumn();}
|
|---|
| 65 | casa::Vector<casa::uInt> getPol() const {return polCol_.getColumn();}
|
|---|
| 66 | casa::Vector<casa::Double> getTime() const {return timeCol_.getColumn();}
|
|---|
| 67 |
|
|---|
| 68 | void setSelection(STSelector &sel, bool sortByTime=false);
|
|---|
| 69 | void unsetSelection();
|
|---|
| 70 | casa::String caltype();
|
|---|
| 71 |
|
|---|
| 72 | void save(const casa::String &name);
|
|---|
| 73 |
|
|---|
| 74 | virtual casa::uInt nchan(casa::uInt ifno) = 0;
|
|---|
| 75 |
|
|---|
| 76 | // static methods
|
|---|
| 77 | static STCalEnum::CalType getCalType(const casa::String &name);
|
|---|
| 78 | static STCalEnum::CalType getCalType(casa::CountedPtr<STApplyTable> tab);
|
|---|
| 79 | static STCalEnum::CalType getCalType(STApplyTable *tab);
|
|---|
| 80 |
|
|---|
| 81 | protected:
|
|---|
| 82 | void setbasedata(casa::uInt irow, casa::uInt scanno, casa::uInt cycleno,
|
|---|
| 83 | casa::uInt beamno, casa::uInt ifno, casa::uInt polno,
|
|---|
| 84 | casa::uInt freqid, casa::Double time);
|
|---|
| 85 | casa::Block<casa::Double> getFrequenciesRow(casa::uInt id);
|
|---|
| 86 |
|
|---|
| 87 | casa::Table table_, originaltable_;
|
|---|
| 88 | casa::ScalarColumn<casa::uInt> scanCol_, cycleCol_, beamCol_, ifCol_, polCol_, freqidCol_;
|
|---|
| 89 | casa::ScalarColumn<casa::Double> timeCol_;
|
|---|
| 90 | casa::MEpoch::ScalarColumn timeMeasCol_;
|
|---|
| 91 | STSelector sel_;
|
|---|
| 92 | casa::LogIO os_;
|
|---|
| 93 |
|
|---|
| 94 | private:
|
|---|
| 95 | static STCalEnum::CalType stringToType(const casa::String &caltype);
|
|---|
| 96 | };
|
|---|
| 97 |
|
|---|
| 98 | }
|
|---|
| 99 |
|
|---|
| 100 | #endif
|
|---|