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

Last change on this file since 1793 was 1792, checked in by Takeshi Nakazato, 14 years ago
  1. Bug fixes on NROFiller.
  1. Makefile is updated to compile NROFiller
  1. Uncommented the line to create NROFiller in FillerWrapper.h


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