source: trunk/src/MSWriterWrapper.h @ 3046

Last change on this file since 3046 was 3046, checked in by Takeshi Nakazato, 9 years ago

New Development: No

JIRA Issue: Yes CAS-7764

Ready for Test: Yes

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:


Release GIL in some time-consuming functions. Currently the following functions releases GIL:


  • MSFiller::fill
  • MSWriter::write
  • Scantable::applyBaselineTable
  • Scantable::subBaseline
  • CalibrationManager::calibrate
  • CalibrationManager::apply
File size: 1.3 KB
Line 
1//
2// C++ Interface: MSWriterWrapper
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 ASAPMSWRITER_WRAPPER_H
14#define ASAPMSWRITER_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 "MSWriter.h"
26#include "GILHandler.h"
27
28namespace asap
29{
30
31class MSWriterWrapper
32{
33public:
34  explicit MSWriterWrapper( ScantableWrapper tbl )
35    : writer_( 0 )
36  { stable_ = tbl.getCP() ; }
37
38  virtual ~MSWriterWrapper() {}
39
40  void write(const std::string& filename, const casa::Record& rec)
41  {
42    GILHandler scopedRelease;
43
44    casa::File file( filename ) ;
45    writer_ = new MSWriter( stable_ ) ;
46    if ( writer_->write( filename, rec ) ) {
47      return ;
48    }
49    else {
50      throw casa::AipsError( "Failed to write data" ) ;
51    }
52  }
53
54private:
55
56  MSWriterWrapper() ;
57  MSWriterWrapper(const MSWriterWrapper&) ;
58  MSWriterWrapper& operator=(const MSWriterWrapper&) ;
59
60  casa::CountedPtr<MSWriter> writer_ ;
61  casa::CountedPtr<Scantable> stable_ ;
62};
63
64
65};
66#endif
Note: See TracBrowser for help on using the repository browser.