| 1 | // | 
|---|
| 2 | // C++ Interface: STSelector | 
|---|
| 3 | // | 
|---|
| 4 | // Description: | 
|---|
| 5 | // | 
|---|
| 6 | // | 
|---|
| 7 | // Author: Malte Marquarding <asap@atnf.csiro.au>, (C) 2006 | 
|---|
| 8 | // | 
|---|
| 9 | // Copyright: See COPYING file that comes with this distribution | 
|---|
| 10 | // | 
|---|
| 11 | // | 
|---|
| 12 | #ifndef ASAPSTSELECTOR_H | 
|---|
| 13 | #define ASAPSTSELECTOR_H | 
|---|
| 14 |  | 
|---|
| 15 | #include <string> | 
|---|
| 16 | #include <vector> | 
|---|
| 17 | #include <map> | 
|---|
| 18 |  | 
|---|
| 19 | #include <tables/Tables/Table.h> | 
|---|
| 20 |  | 
|---|
| 21 | namespace asap { | 
|---|
| 22 |  | 
|---|
| 23 | /** | 
|---|
| 24 | A class to set a subselection of a Scantable | 
|---|
| 25 |  | 
|---|
| 26 | @author Malte Marquarding | 
|---|
| 27 | */ | 
|---|
| 28 | class STSelector { | 
|---|
| 29 |  | 
|---|
| 30 | public: | 
|---|
| 31 | STSelector(); | 
|---|
| 32 | STSelector(const STSelector& other); | 
|---|
| 33 |  | 
|---|
| 34 | STSelector& operator=(const STSelector& other); | 
|---|
| 35 |  | 
|---|
| 36 | virtual ~STSelector(); | 
|---|
| 37 |  | 
|---|
| 38 | void setScans(const std::vector<int>& scans); | 
|---|
| 39 | void setBeams(const std::vector<int>& beams); | 
|---|
| 40 | void setIFs(const std::vector<int>& ifs); | 
|---|
| 41 | void setPolarizations(const std::vector<int>& pols); | 
|---|
| 42 | void setCycles(const std::vector<int>& cycs); | 
|---|
| 43 | void setName(const std::string&); | 
|---|
| 44 | virtual void setTaQL(const std::string& taql); | 
|---|
| 45 |  | 
|---|
| 46 | std::vector<int> getScans(); | 
|---|
| 47 | std::vector<int> getBeams(); | 
|---|
| 48 | std::vector<int> getIFs(); | 
|---|
| 49 | std::vector<int> getPols(); | 
|---|
| 50 | std::vector<int> getCycles(); | 
|---|
| 51 |  | 
|---|
| 52 | casa::Table apply(const casa::Table& tab); | 
|---|
| 53 | casa::Table operator()(const casa::Table& tab) { return apply(tab); }; | 
|---|
| 54 |  | 
|---|
| 55 | void reset() { intselections_.clear();stringselections_.clear(); taql_ = "";}; | 
|---|
| 56 |  | 
|---|
| 57 | bool empty() const; | 
|---|
| 58 |  | 
|---|
| 59 | std::string print(); | 
|---|
| 60 |  | 
|---|
| 61 | protected: | 
|---|
| 62 | std::vector< int > getint( const std::string& key); | 
|---|
| 63 | std::vector< std::string > getstring( const std::string& key); | 
|---|
| 64 |  | 
|---|
| 65 | void setint(const std::string& key, const std::vector< int >& val); | 
|---|
| 66 | void setstring(const std::string& key, const std::vector< std::string >& val); | 
|---|
| 67 |  | 
|---|
| 68 | private: | 
|---|
| 69 | typedef std::map<std::string, std::vector<int> > intidmap; | 
|---|
| 70 | typedef std::map<std::string, std::vector<std::string> > stringidmap; | 
|---|
| 71 | // has to be mutable, as to stl limitations | 
|---|
| 72 | mutable intidmap intselections_; | 
|---|
| 73 | mutable stringidmap stringselections_; | 
|---|
| 74 | std::string taql_; | 
|---|
| 75 | }; | 
|---|
| 76 |  | 
|---|
| 77 | } | 
|---|
| 78 |  | 
|---|
| 79 | #endif | 
|---|