source: trunk/external-alma/atnf/PKSIO/NROOTFDataset.cc@ 2965

Last change on this file since 2965 was 2785, checked in by Takeshi Nakazato, 11 years ago

New Development: No

JIRA Issue: No

Ready for Test: Yes

Interface Changes: 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...

Candidate bug fix for seg. fault on Mac.

File size: 3.4 KB
Line 
1//#---------------------------------------------------------------------------
2//# NROOTFDataset.cc: Class for NRO 45m OTF dataset.
3//#---------------------------------------------------------------------------
4//# Copyright (C) 2000-2006
5//# Associated Universities, Inc. Washington DC, USA.
6//#
7//# This library is free software; you can redistribute it and/or modify it
8//# under the terms of the GNU Library General Public License as published by
9//# the Free Software Foundation; either version 2 of the License, or (at your
10//# option) any later version.
11//#
12//# This library is distributed in the hope that it will be useful, but WITHOUT
13//# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14//# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
15//# License for more details.
16//#
17//# You should have received a copy of the GNU Library General Public License
18//# along with this library; if not, write to the Free Software Foundation,
19//# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
20//#
21//# Correspondence concerning AIPS++ should be addressed as follows:
22//# Internet email: aips2-request@nrao.edu.
23//# Postal address: AIPS++ Project Office
24//# National Radio Astronomy Observatory
25//# 520 Edgemont Road
26//# Charlottesville, VA 22903-2475 USA
27//#
28//# $Id$
29//#---------------------------------------------------------------------------
30//# Original: 2009/02/27, Takeshi Nakazato, NAOJ
31//#---------------------------------------------------------------------------
32
33#include <atnf/PKSIO/NROOTFDataset.h>
34
35#include <iostream>
36#include <cstring>
37
38#define STRING2CHAR(s) const_cast<char *>((s).c_str())
39
40using namespace std ;
41
42// constructor
43NROOTFDataset::NROOTFDataset( string name )
44 : NRODataset( name )
45{}
46
47// destructor
48NROOTFDataset::~NROOTFDataset()
49{}
50
51// data initialization
52void NROOTFDataset::initialize()
53{
54 int arymax = arrayMax() ;
55
56 // it must be called
57 initializeCommon() ;
58
59 // additional initialization
60 datasize_ += sizeof( char ) * arymax * 16 // RX
61 + sizeof( double ) * arymax * 6 // HPBW, EFFA, EFFB, EFFL, EFSS GAIN
62 + sizeof( char ) * arymax * 4 // HORN
63 + sizeof( char ) * arymax * 4 // POLTP
64 + sizeof( double ) * arymax * 3 // POLDR, POLAN, DFRQ
65 + sizeof( char ) * arymax * 4 // SIDBID
66 + sizeof( int ) * arymax * 3 // REFN, IPINT, MULTN
67 + sizeof( double ) * arymax // MLTSCF
68 + sizeof( char ) * arymax * 8 // LAGWIND
69 + sizeof( double ) * arymax * 3 // BEBW, BERES, CHWID
70 + sizeof( int ) * arymax * 2 // ARRY, NFCAL
71 + sizeof( double ) * arymax // F0CAL
72 + sizeof( double ) * arymax * 10 * 3 // FQCAL, CHCAL, CWCAL
73 + sizeof( char ) * 180 ; // CDMY1
74
75 for ( int i = 0 ; i < NRO_ARYMAX ; i++ ) {
76 DSBFC[i] = 1.0 ;
77 }
78}
79
80int NROOTFDataset::fillHeader( int sameEndian )
81{
82 LogIO os( LogOrigin( "NROOTFDataset", "fillHeader()", WHERE ) ) ;
83
84 // make sure file pointer points a beginning of the file
85 fseek( fp_, 0, SEEK_SET ) ;
86
87 fillHeaderCommon( sameEndian ) ;
88
89 // specific part
90 CDMY1.resize(180);
91 if ( readHeader( STRING2CHAR(CDMY1), 180 ) == -1 ) {
92 os << LogIO::WARN << "Error while reading data CDMY1." << LogIO::POST ;
93 return -1 ;
94 }
95 // DEBUG
96 //cout << "CDMY1 = " << CDMY1 << endl ;
97 //
98
99 return 0 ;
100}
101
Note: See TracBrowser for help on using the repository browser.