source: trunk/src/MSFillerWrapper.h@ 3137

Last change on this file since 3137 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
RevLine 
[1974]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"
[3046]26#include "GILHandler.h"
[1974]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
[3106]41 void open(const std::string& filename, const casacore::Record& rec)
[1974]42 {
[3106]43 casacore::File file( filename ) ;
[1974]44 if ( !file.exists() ) {
[3106]45 throw casacore::AipsError( "File does not exist" ) ;
[1974]46 }
47 filler_ = new MSFiller( stable_ ) ;
48 if ( filler_->open( filename, rec ) ) {
49 attached_ = true ;
50 return ;
51 }
52 else {
[3106]53 throw casacore::AipsError( "Failed to open file" ) ;
[1974]54 }
55 }
56
57 void close()
58 {
59 if ( attached_ ) {
60 filler_->close() ;
61 }
62 }
63
64 void fill()
65 {
[3046]66 GILHandler scopedRelease;
67
[1974]68 if ( attached_ ) {
69 filler_->fill() ;
70 }
71 }
72
[2482]73 // add dummy method for consistency
[3071]74 void setReferenceRegex(const std::string& /*rx*/) {
[2482]75 // do nothing
76 }
77
[1974]78private:
79
80 MSFillerWrapper() ;
81 MSFillerWrapper(const MSFillerWrapper&) ;
82 MSFillerWrapper& operator=(const MSFillerWrapper&) ;
83
[3106]84 casacore::CountedPtr<MSFiller> filler_ ;
[1974]85 bool attached_ ;
[3106]86 casacore::CountedPtr<Scantable> stable_ ;
[1974]87};
88
89
90};
91#endif
Note: See TracBrowser for help on using the repository browser.