source: trunk/src/MSFillerWrapper.h @ 2482

Last change on this file since 2482 was 2482, checked in by Takeshi Nakazato, 12 years ago

New Development: No

JIRA Issue: No

Ready for Test: Yes

Interface Changes: No

What Interface Changed: Please list interface changes

Test Programs: irc_cs_task_regression, fls3a_hi_regression

Put in Release Notes: No

Module(s): Module Names change impacts.

Description: Describe your changes here...

Added dummy method setReferenceRegex and its python interface
to MSFillerWrapper for consistency with FillerWrapper?.


File size: 1.6 KB
Line 
1//
2// C++ Interface: MSFillerWrapper
3//
4// Description:
5//
6// This class is wrapper class for MSFiller
7//
8// Author: Takeshi Nakazato <takeshi.nakazato@nao.ac.jp>, (C) 2010
9//
10// Copyright: See COPYING file that comes with this distribution
11//
12//
13#ifndef ASAPMSFILLER_WRAPPER_H
14#define ASAPMSFILLER_WRAPPER_H
15
16#include <casa/aips.h>
17#include <casa/Exceptions.h>
18#include <casa/Utilities/CountedPtr.h>
19#include <casa/Containers/Record.h>
20#include <casa/OS/File.h>
21
22#include <string>
23
24#include "ScantableWrapper.h"
25#include "MSFiller.h"
26
27namespace asap
28{
29
30class MSFillerWrapper
31{
32public:
33  explicit MSFillerWrapper( ScantableWrapper tbl )
34    : filler_( 0 ),
35      attached_( false )
36  { stable_ = tbl.getCP() ; }
37
38  virtual ~MSFillerWrapper() { close() ; }
39
40  void open(const std::string& filename, const casa::Record& rec)
41  {
42    casa::File file( filename ) ;
43    if ( !file.exists() ) {
44      throw casa::AipsError( "File does not exist" ) ;
45    }
46    filler_ = new MSFiller( stable_ ) ;
47    if ( filler_->open( filename, rec ) ) {
48      attached_ = true ;
49      return ;
50    }
51    else {
52      throw casa::AipsError( "Failed to open file" ) ;
53    }
54  }
55
56  void close()
57  {
58    if ( attached_ ) {
59      filler_->close() ;
60    }
61  }
62
63  void fill()
64  {
65    if ( attached_ ) {
66      filler_->fill() ;
67    }
68  }
69
70  // add dummy method for consistency
71  void setReferenceRegex(const std::string& rx) {
72    // do nothing
73  } 
74
75private:
76
77  MSFillerWrapper() ;
78  MSFillerWrapper(const MSFillerWrapper&) ;
79  MSFillerWrapper& operator=(const MSFillerWrapper&) ;
80
81  casa::CountedPtr<MSFiller> filler_ ;
82  bool attached_ ;
83  casa::CountedPtr<Scantable> stable_ ;
84};
85
86
87};
88#endif
Note: See TracBrowser for help on using the repository browser.