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 <casa/Containers/Block.h>
|
---|
20 | #include <casa/BasicSL/String.h>
|
---|
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 |
|
---|
38 | virtual ~STSelector();
|
---|
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);
|
---|
44 | void setPolFromStrings(const std::vector<std::string>& pols);
|
---|
45 | void setCycles(const std::vector<int>& cycs);
|
---|
46 | void setName(const std::string&);
|
---|
47 | void setTypes(const std::vector<int>& types);
|
---|
48 | virtual void setTaQL(const std::string& taql);
|
---|
49 |
|
---|
50 | void setSortOrder(const std::vector<std::string>& order);
|
---|
51 | void setRows(const std::vector<int>& rows);
|
---|
52 |
|
---|
53 | std::vector<int> getScans() const;
|
---|
54 | std::vector<int> getBeams() const;
|
---|
55 | std::vector<int> getIFs() const;
|
---|
56 | std::vector<int> getPols() const;
|
---|
57 | std::vector<int> getCycles() const;
|
---|
58 | std::vector<int> getTypes() const;
|
---|
59 | std::vector<int> getRows() const;
|
---|
60 | std::vector<std::string> getPolTypes() const;
|
---|
61 | std::string getTaQL() const { return taql_; }
|
---|
62 | std::vector<std::string> getSortOrder() const;
|
---|
63 |
|
---|
64 | casacore::Table apply(const casacore::Table& tab);
|
---|
65 | casacore::Table operator()(const casacore::Table& tab) { return apply(tab); };
|
---|
66 |
|
---|
67 | void reset() { intselections_.clear();stringselections_.clear(); taql_ = "";};
|
---|
68 |
|
---|
69 | bool empty() const;
|
---|
70 |
|
---|
71 | std::string print();
|
---|
72 |
|
---|
73 | protected:
|
---|
74 | std::vector< int > getint( const std::string& key) const;
|
---|
75 | //std::vector< std::string > getstring( const std::string& key) const;
|
---|
76 |
|
---|
77 | void setint(const std::string& key, const std::vector< int >& val);
|
---|
78 | void setstring(const std::string& key, const std::vector< std::string >& val);
|
---|
79 |
|
---|
80 | private:
|
---|
81 |
|
---|
82 | casacore::Table sort(const casacore::Table& tab);
|
---|
83 |
|
---|
84 | typedef std::map<std::string, std::vector<int> > intidmap;
|
---|
85 | typedef std::map<std::string, std::vector<std::string> > stringidmap;
|
---|
86 | // has to be mutable, as to stl limitations
|
---|
87 | mutable intidmap intselections_;
|
---|
88 | mutable stringidmap stringselections_;
|
---|
89 | std::vector<std::string> poltypes_;
|
---|
90 | casacore::Block<casacore::String> order_;
|
---|
91 | std::string taql_;
|
---|
92 | std::vector<int> rowselection_;
|
---|
93 | };
|
---|
94 |
|
---|
95 | }
|
---|
96 |
|
---|
97 | #endif
|
---|