source: branches/newfiller/src/FillerWrapper.h @ 1806

Last change on this file since 1806 was 1806, checked in by Malte Marquarding, 14 years ago

enable PKSFiller

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
26namespace asap
27{
28class FillerWrapper
29{
30public:
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 PKSFiller(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
74private:
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.