source: trunk/src/MSFillerWrapper.h@ 3143

Last change on this file since 3143 was 3106, checked in by Takeshi Nakazato, 8 years ago

New Development: No

JIRA Issue: No

Ready for Test: Yes/No

Interface Changes: Yes/No

What Interface Changed: Please list interface changes

Test Programs: List test programs

Put in Release Notes: Yes/No

Module(s): Module Names change impacts.

Description: Describe your changes here...


Check-in asap modifications from Jim regarding casacore namespace conversion.

File size: 1.7 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#include "GILHandler.h"
27
28namespace asap
29{
30
31class MSFillerWrapper
32{
33public:
34 explicit MSFillerWrapper( ScantableWrapper tbl )
35 : filler_( 0 ),
36 attached_( false )
37 { stable_ = tbl.getCP() ; }
38
39 virtual ~MSFillerWrapper() { close() ; }
40
41 void open(const std::string& filename, const casacore::Record& rec)
42 {
43 casacore::File file( filename ) ;
44 if ( !file.exists() ) {
45 throw casacore::AipsError( "File does not exist" ) ;
46 }
47 filler_ = new MSFiller( stable_ ) ;
48 if ( filler_->open( filename, rec ) ) {
49 attached_ = true ;
50 return ;
51 }
52 else {
53 throw casacore::AipsError( "Failed to open file" ) ;
54 }
55 }
56
57 void close()
58 {
59 if ( attached_ ) {
60 filler_->close() ;
61 }
62 }
63
64 void fill()
65 {
66 GILHandler scopedRelease;
67
68 if ( attached_ ) {
69 filler_->fill() ;
70 }
71 }
72
73 // add dummy method for consistency
74 void setReferenceRegex(const std::string& /*rx*/) {
75 // do nothing
76 }
77
78private:
79
80 MSFillerWrapper() ;
81 MSFillerWrapper(const MSFillerWrapper&) ;
82 MSFillerWrapper& operator=(const MSFillerWrapper&) ;
83
84 casacore::CountedPtr<MSFiller> filler_ ;
85 bool attached_ ;
86 casacore::CountedPtr<Scantable> stable_ ;
87};
88
89
90};
91#endif
Note: See TracBrowser for help on using the repository browser.