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

Last change on this file since 1794 was 1794, checked in by Takeshi Nakazato, 14 years ago

Uncommented include NROFiller

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/*
23#include "PKSFiller.h"
24*/
25#include "NROFiller.h"
26
27
28namespace asap
29{
30class FillerWrapper
31{
32public:
33
34  explicit FillerWrapper(ScantableWrapper tbl) : filler_(0), attached_(false)
35  { stable_ = tbl.getCP(); }
36
37  virtual ~FillerWrapper() { close(); }
38
39
40//  void open(const std::string& filename, casa::Record rec) {
41  void open(const std::string& filename) {
42//    filler_ = new ATFiller(stable_);
43//    if (filler_->open(filename, rec)) {
44    if (filler_->open(filename)) {
45      attached_ = true;
46      return;
47    }
48    filler_ = new NROFiller(stable_);
49//    if (filler_->open(filename, rec)) {
50    if (filler_->open(filename)) {
51      attached_ = true;
52      return;
53    }
54    filler_ = 0;
55    attached_ = false;
56    throw casa::AipsError("Unknown Data Format");
57  }
58  void close() {
59    if (attached_) {
60      filler_->close();
61    }
62  }
63
64  void fill() {
65    if (attached_) {
66      filler_->fill();
67    }
68  }
69
70  void setReferenceRegex(const std::string& rx) {
71    if (attached_) {
72      filler_->setReferenceRegex(rx);
73    }
74  }
75
76private:
77
78  FillerWrapper() {;}
79  FillerWrapper(const FillerWrapper& other) {;}
80
81  casa::CountedPtr<FillerBase> filler_;
82  bool attached_;
83  casa::CountedPtr<Scantable> stable_;
84};
85
86};
87#endif
Note: See TracBrowser for help on using the repository browser.