| [812] | 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 |
|
|---|
| [902] | 19 | #include <casa/Containers/Block.h>
|
|---|
| 20 | #include <casa/BasicSL/String.h>
|
|---|
| [812] | 21 | #include <tables/Tables/Table.h>
|
|---|
| 22 |
|
|---|
| 23 | namespace asap {
|
|---|
| 24 |
|
|---|
| 25 | /**
|
|---|
| 26 | A class to set a subselection of a Scantable
|
|---|
| 27 |
|
|---|
| 28 | @author Malte Marquarding
|
|---|
| 29 | */
|
|---|
| 30 | class STSelector {
|
|---|
| 31 |
|
|---|
| 32 | public:
|
|---|
| 33 | STSelector();
|
|---|
| 34 | STSelector(const STSelector& other);
|
|---|
| 35 |
|
|---|
| 36 | STSelector& operator=(const STSelector& other);
|
|---|
| 37 |
|
|---|
| [842] | 38 | virtual ~STSelector();
|
|---|
| [812] | 39 |
|
|---|
| 40 | void setScans(const std::vector<int>& scans);
|
|---|
| 41 | void setBeams(const std::vector<int>& beams);
|
|---|
| 42 | void setIFs(const std::vector<int>& ifs);
|
|---|
| 43 | void setPolarizations(const std::vector<int>& pols);
|
|---|
| [902] | 44 | void setPolFromStrings(const std::vector<std::string>& pols);
|
|---|
| [842] | 45 | void setCycles(const std::vector<int>& cycs);
|
|---|
| [850] | 46 | void setName(const std::string&);
|
|---|
| 47 | virtual void setTaQL(const std::string& taql);
|
|---|
| [812] | 48 |
|
|---|
| [902] | 49 | void setSortOrder(const std::vector<std::string>& order);
|
|---|
| 50 |
|
|---|
| [812] | 51 | std::vector<int> getScans();
|
|---|
| 52 | std::vector<int> getBeams();
|
|---|
| 53 | std::vector<int> getIFs();
|
|---|
| 54 | std::vector<int> getPols();
|
|---|
| [842] | 55 | std::vector<int> getCycles();
|
|---|
| [902] | 56 | std::vector<std::string> getPolTypes();
|
|---|
| [812] | 57 |
|
|---|
| 58 | casa::Table apply(const casa::Table& tab);
|
|---|
| 59 | casa::Table operator()(const casa::Table& tab) { return apply(tab); };
|
|---|
| 60 |
|
|---|
| [850] | 61 | void reset() { intselections_.clear();stringselections_.clear(); taql_ = "";};
|
|---|
| [812] | 62 |
|
|---|
| 63 | bool empty() const;
|
|---|
| 64 |
|
|---|
| 65 | std::string print();
|
|---|
| 66 |
|
|---|
| [850] | 67 | protected:
|
|---|
| 68 | std::vector< int > getint( const std::string& key);
|
|---|
| 69 | std::vector< std::string > getstring( const std::string& key);
|
|---|
| 70 |
|
|---|
| 71 | void setint(const std::string& key, const std::vector< int >& val);
|
|---|
| 72 | void setstring(const std::string& key, const std::vector< std::string >& val);
|
|---|
| 73 |
|
|---|
| [812] | 74 | private:
|
|---|
| [902] | 75 |
|
|---|
| 76 | casa::Table sort(const casa::Table& tab);
|
|---|
| 77 |
|
|---|
| [850] | 78 | typedef std::map<std::string, std::vector<int> > intidmap;
|
|---|
| 79 | typedef std::map<std::string, std::vector<std::string> > stringidmap;
|
|---|
| [812] | 80 | // has to be mutable, as to stl limitations
|
|---|
| [850] | 81 | mutable intidmap intselections_;
|
|---|
| 82 | mutable stringidmap stringselections_;
|
|---|
| [902] | 83 | std::vector<std::string> poltypes_;
|
|---|
| 84 | casa::Block<casa::String> order_;
|
|---|
| [812] | 85 | std::string taql_;
|
|---|
| 86 | };
|
|---|
| 87 |
|
|---|
| 88 | }
|
|---|
| 89 |
|
|---|
| 90 | #endif
|
|---|