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

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
RevLine 
[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#include "PKSFiller.h"
23#include "NROFiller.h"
24
[1794]25
[1778]26namespace asap
27{
[1786]28class FillerWrapper
[1778]29{
30public:
31
[1787]32 explicit FillerWrapper(ScantableWrapper tbl) : filler_(0), attached_(false)
[1786]33 { stable_ = tbl.getCP(); }
34
35 virtual ~FillerWrapper() { close(); }
36
37
38// void open(const std::string& filename, casa::Record rec) {
[1778]39 void open(const std::string& filename) {
[1786]40// filler_ = new ATFiller(stable_);
41// if (filler_->open(filename, rec)) {
42 if (filler_->open(filename)) {
43 attached_ = true;
[1778]44 return;
45 }
[1792]46 filler_ = new NROFiller(stable_);
[1786]47// if (filler_->open(filename, rec)) {
48 if (filler_->open(filename)) {
49 attached_ = true;
[1778]50 return;
51 }
[1786]52 filler_ = 0;
53 attached_ = false;
54 throw casa::AipsError("Unknown Data Format");
[1778]55 }
56 void close() {
[1786]57 if (attached_) {
58 filler_->close();
[1778]59 }
60 }
61
62 void fill() {
[1786]63 if (attached_) {
64 filler_->fill();
[1778]65 }
66 }
[1786]67
68 void setReferenceRegex(const std::string& rx) {
69 if (attached_) {
70 filler_->setReferenceRegex(rx);
[1778]71 }
72 }
73
74private:
[1786]75
[1787]76 FillerWrapper() {;}
77 FillerWrapper(const FillerWrapper& other) {;}
78
[1786]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.