|
Last change
on this file since 1786 was 1786, checked in by Malte Marquarding, 15 years ago |
|
Added Wrapper and python binding for Filler
|
|
File size:
1.6 KB
|
| 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 | /*
|
|---|
| 23 | #include "PKSFiller.h"
|
|---|
| 24 | #include "NROFiller.h"
|
|---|
| 25 | */
|
|---|
| 26 |
|
|---|
| [1778] | 27 | namespace asap
|
|---|
| 28 | {
|
|---|
| [1786] | 29 | class FillerWrapper
|
|---|
| [1778] | 30 | {
|
|---|
| 31 | public:
|
|---|
| 32 |
|
|---|
| [1786] | 33 | FillerWrapper() : filler_(0), attached_(false), stable_(0) {;}
|
|---|
| [1778] | 34 |
|
|---|
| [1786] | 35 | FillerWrapper(ScantableWrapper tbl) : filler_(0), attached_(false)
|
|---|
| 36 | { stable_ = tbl.getCP(); }
|
|---|
| 37 |
|
|---|
| 38 | virtual ~FillerWrapper() { close(); }
|
|---|
| 39 |
|
|---|
| 40 |
|
|---|
| 41 | // void open(const std::string& filename, casa::Record rec) {
|
|---|
| [1778] | 42 | void open(const std::string& filename) {
|
|---|
| [1786] | 43 | // filler_ = new ATFiller(stable_);
|
|---|
| 44 | // if (filler_->open(filename, rec)) {
|
|---|
| 45 | if (filler_->open(filename)) {
|
|---|
| 46 | attached_ = true;
|
|---|
| [1778] | 47 | return;
|
|---|
| 48 | }
|
|---|
| [1786] | 49 | // filler_ = new NROFiller(stable_);
|
|---|
| 50 | // if (filler_->open(filename, rec)) {
|
|---|
| 51 | if (filler_->open(filename)) {
|
|---|
| 52 | attached_ = true;
|
|---|
| [1778] | 53 | return;
|
|---|
| 54 | }
|
|---|
| [1786] | 55 | filler_ = 0;
|
|---|
| 56 | attached_ = false;
|
|---|
| 57 | throw casa::AipsError("Unknown Data Format");
|
|---|
| [1778] | 58 | }
|
|---|
| 59 | void close() {
|
|---|
| [1786] | 60 | if (attached_) {
|
|---|
| 61 | filler_->close();
|
|---|
| [1778] | 62 | }
|
|---|
| 63 | }
|
|---|
| 64 |
|
|---|
| 65 | void fill() {
|
|---|
| [1786] | 66 | if (attached_) {
|
|---|
| 67 | filler_->fill();
|
|---|
| [1778] | 68 | }
|
|---|
| 69 | }
|
|---|
| [1786] | 70 |
|
|---|
| 71 | void setReferenceRegex(const std::string& rx) {
|
|---|
| 72 | if (attached_) {
|
|---|
| 73 | filler_->setReferenceRegex(rx);
|
|---|
| [1778] | 74 | }
|
|---|
| 75 | }
|
|---|
| 76 |
|
|---|
| 77 | private:
|
|---|
| [1786] | 78 |
|
|---|
| 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.