Rev | Line | |
---|
[1778] | 1 | // |
---|
| 2 | // C++ Interface: Filler |
---|
| 3 | // |
---|
| 4 | // Description: |
---|
| 5 | // |
---|
| 6 | // |
---|
| 7 | // Author: Malte Marquarding <asap@atnf.csiro.au>, (C) 2010 |
---|
| 8 | // |
---|
| 9 | // Copyright: See COPYING file that comes with this distribution |
---|
| 10 | // |
---|
| 11 | // |
---|
| 12 | #ifndef ASAPFILLER_H |
---|
| 13 | #define ASAPFILLER_H |
---|
| 14 | |
---|
| 15 | #include <casa/aips.h> |
---|
[1786] | 16 | #include <casa/Exceptions.h> |
---|
[1778] | 17 | #include <casa/Utilities/CountedPtr.h> |
---|
| 18 | #include <string> |
---|
| 19 | |
---|
[1786] | 20 | #include "ScantableWrapper.h" |
---|
| 21 | #include "FillerBase.h" |
---|
| 22 | #include "PKSFiller.h" |
---|
| 23 | #include "NROFiller.h" |
---|
| 24 | |
---|
[1794] | 25 | |
---|
[1778] | 26 | namespace asap |
---|
| 27 | { |
---|
[1786] | 28 | class FillerWrapper |
---|
[1778] | 29 | { |
---|
| 30 | public: |
---|
| 31 | |
---|
[1787] | 32 | explicit FillerWrapper(ScantableWrapper tbl) : filler_(0), attached_(false) |
---|
[1786] | 33 | { stable_ = tbl.getCP(); } |
---|
| 34 | |
---|
| 35 | virtual ~FillerWrapper() { close(); } |
---|
| 36 | |
---|
| 37 | |
---|
| 38 | // void open(const std::string& filename, casa::Record rec) { |
---|
[1778] | 39 | void open(const std::string& filename) { |
---|
[1806] | 40 | filler_ = new PKSFiller(stable_); |
---|
[1786] | 41 | // if (filler_->open(filename, rec)) { |
---|
| 42 | if (filler_->open(filename)) { |
---|
| 43 | attached_ = true; |
---|
[1778] | 44 | return; |
---|
| 45 | } |
---|
[1792] | 46 | filler_ = new NROFiller(stable_); |
---|
[1786] | 47 | // if (filler_->open(filename, rec)) { |
---|
| 48 | if (filler_->open(filename)) { |
---|
| 49 | attached_ = true; |
---|
[1778] | 50 | return; |
---|
| 51 | } |
---|
[1786] | 52 | filler_ = 0; |
---|
| 53 | attached_ = false; |
---|
| 54 | throw casa::AipsError("Unknown Data Format"); |
---|
[1778] | 55 | } |
---|
| 56 | void close() { |
---|
[1786] | 57 | if (attached_) { |
---|
| 58 | filler_->close(); |
---|
[1778] | 59 | } |
---|
| 60 | } |
---|
| 61 | |
---|
| 62 | void fill() { |
---|
[1786] | 63 | if (attached_) { |
---|
| 64 | filler_->fill(); |
---|
[1778] | 65 | } |
---|
| 66 | } |
---|
[1786] | 67 | |
---|
| 68 | void setReferenceRegex(const std::string& rx) { |
---|
| 69 | if (attached_) { |
---|
| 70 | filler_->setReferenceRegex(rx); |
---|
[1778] | 71 | } |
---|
| 72 | } |
---|
| 73 | |
---|
| 74 | private: |
---|
[1786] | 75 | |
---|
[1787] | 76 | FillerWrapper() {;} |
---|
| 77 | FillerWrapper(const FillerWrapper& other) {;} |
---|
| 78 | |
---|
[1786] | 79 | casa::CountedPtr<FillerBase> filler_; |
---|
| 80 | bool attached_; |
---|
| 81 | casa::CountedPtr<Scantable> stable_; |
---|
[1778] | 82 | }; |
---|
| 83 | |
---|
| 84 | }; |
---|
[1786] | 85 | #endif |
---|
Note: See
TracBrowser
for help on using the repository browser.