Last change
on this file since 2188 was 1974, checked in by Takeshi Nakazato, 14 years ago |
New Development: Yes
JIRA Issue: Yes CAS-2718
Ready for Test: Yes
Interface Changes: Yes
What Interface Changed: New class msfiller and mswriter added
Test Programs: List test programs
Put in Release Notes: No
Module(s): Module Names change impacts.
Description: Describe your changes here...
New filler/writer specific for Scantable-MS conversion defined.
This is not called from scantable constructor right now.
However, you can call it by explicitly importing msfiller/mswriter.
|
File size:
1.5 KB
|
Rev | Line | |
---|
[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"
|
---|
| 26 |
|
---|
| 27 | namespace asap
|
---|
| 28 | {
|
---|
| 29 |
|
---|
| 30 | class MSFillerWrapper
|
---|
| 31 | {
|
---|
| 32 | public:
|
---|
| 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 | private:
|
---|
| 71 |
|
---|
| 72 | MSFillerWrapper() ;
|
---|
| 73 | MSFillerWrapper(const MSFillerWrapper&) ;
|
---|
| 74 | MSFillerWrapper& operator=(const MSFillerWrapper&) ;
|
---|
| 75 |
|
---|
| 76 | casa::CountedPtr<MSFiller> filler_ ;
|
---|
| 77 | bool attached_ ;
|
---|
| 78 | casa::CountedPtr<Scantable> stable_ ;
|
---|
| 79 | };
|
---|
| 80 |
|
---|
| 81 |
|
---|
| 82 | };
|
---|
| 83 | #endif
|
---|
Note:
See
TracBrowser
for help on using the repository browser.