Last change
on this file since 1804 was 1801, checked in by Malte Marquarding, 14 years ago |
use both filler implementations
|
File size:
1.6 KB
|
Line | |
---|
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>
|
---|
16 | #include <casa/Exceptions.h>
|
---|
17 | #include <casa/Utilities/CountedPtr.h>
|
---|
18 | #include <string>
|
---|
19 |
|
---|
20 | #include "ScantableWrapper.h"
|
---|
21 | #include "FillerBase.h"
|
---|
22 | #include "PKSFiller.h"
|
---|
23 | #include "NROFiller.h"
|
---|
24 |
|
---|
25 |
|
---|
26 | namespace asap
|
---|
27 | {
|
---|
28 | class FillerWrapper
|
---|
29 | {
|
---|
30 | public:
|
---|
31 |
|
---|
32 | explicit FillerWrapper(ScantableWrapper tbl) : filler_(0), attached_(false)
|
---|
33 | { stable_ = tbl.getCP(); }
|
---|
34 |
|
---|
35 | virtual ~FillerWrapper() { close(); }
|
---|
36 |
|
---|
37 |
|
---|
38 | // void open(const std::string& filename, casa::Record rec) {
|
---|
39 | void open(const std::string& filename) {
|
---|
40 | // filler_ = new ATFiller(stable_);
|
---|
41 | // if (filler_->open(filename, rec)) {
|
---|
42 | if (filler_->open(filename)) {
|
---|
43 | attached_ = true;
|
---|
44 | return;
|
---|
45 | }
|
---|
46 | filler_ = new NROFiller(stable_);
|
---|
47 | // if (filler_->open(filename, rec)) {
|
---|
48 | if (filler_->open(filename)) {
|
---|
49 | attached_ = true;
|
---|
50 | return;
|
---|
51 | }
|
---|
52 | filler_ = 0;
|
---|
53 | attached_ = false;
|
---|
54 | throw casa::AipsError("Unknown Data Format");
|
---|
55 | }
|
---|
56 | void close() {
|
---|
57 | if (attached_) {
|
---|
58 | filler_->close();
|
---|
59 | }
|
---|
60 | }
|
---|
61 |
|
---|
62 | void fill() {
|
---|
63 | if (attached_) {
|
---|
64 | filler_->fill();
|
---|
65 | }
|
---|
66 | }
|
---|
67 |
|
---|
68 | void setReferenceRegex(const std::string& rx) {
|
---|
69 | if (attached_) {
|
---|
70 | filler_->setReferenceRegex(rx);
|
---|
71 | }
|
---|
72 | }
|
---|
73 |
|
---|
74 | private:
|
---|
75 |
|
---|
76 | FillerWrapper() {;}
|
---|
77 | FillerWrapper(const FillerWrapper& other) {;}
|
---|
78 |
|
---|
79 | casa::CountedPtr<FillerBase> filler_;
|
---|
80 | bool attached_;
|
---|
81 | casa::CountedPtr<Scantable> stable_;
|
---|
82 | };
|
---|
83 |
|
---|
84 | };
|
---|
85 | #endif
|
---|
Note:
See
TracBrowser
for help on using the repository browser.