source: trunk/external-alma/atnf/PKSIO/ASTEDataset.cc @ 2783

Last change on this file since 2783 was 2783, 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...

more refactoring on NRO filler.


File size: 3.7 KB
Line 
1//#---------------------------------------------------------------------------
2//# ASTEDataset.cc: Class for ASTE 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: 2008/10/30, Takeshi Nakazato, NAOJ
31//#---------------------------------------------------------------------------
32
33#include <atnf/PKSIO/ASTEDataset.h>
34
35#include <iostream>
36#include <cstring>
37
38using namespace std ;
39
40// constructor
41ASTEDataset::ASTEDataset( string name )
42  : NRODataset( name )
43{}
44
45// destructor
46ASTEDataset::~ASTEDataset()
47{}
48
49// data initialization
50void ASTEDataset::initialize()
51{
52  int arymax = arrayMax() ;
53
54  // it must be called
55  initializeCommon() ;
56
57  // additional initialization
58  datasize_ += sizeof( char ) * arymax * 16 // RX
59    + sizeof( double ) * arymax * 6         // HPBW, EFFA, EFFB, EFFL, EFSS GAIN
60    + sizeof( char ) * arymax * 4           // HORN
61    + sizeof( char ) * arymax * 4           // POLTP
62    + sizeof( double ) * arymax * 3         // POLDR, POLAN, DFRQ
63    + sizeof( char ) * arymax * 4           // SIDBID
64    + sizeof( int ) * arymax * 3            // REFN, IPINT, MULTN
65    + sizeof( double ) * arymax             // MLTSCF
66    + sizeof( char ) * arymax * 8           // LAGWIND
67    + sizeof( double ) * arymax * 3         // BEBW, BERES, CHWID
68    + sizeof( int ) * arymax * 2            // ARRY, NFCAL
69    + sizeof( double ) * arymax             // F0CAL
70    + sizeof( double ) * arymax * 10 * 3    // FQCAL, CHCAL, CWCAL
71    + sizeof( char ) * 116                       // CDMY1
72    + sizeof( double ) * arymax ;           // DSBFC
73}
74
75int ASTEDataset::fillHeader( int sameEndian )
76{
77  LogIO os( LogOrigin( "ASTEDataset", "fillHeader()", WHERE ) ) ;
78
79  int arymax = arrayMax();
80
81  string str120( 120, ' ' ) ;
82  char c120[120] ;
83  // make sure file pointer points a beginning of the file
84  fseek( fp_, 0, SEEK_SET ) ;
85
86  fillHeaderCommon( sameEndian ) ;
87
88  // specific part
89  strcpy( c120, str120.c_str() ) ;
90  if ( readHeader( c120, 116 ) == -1 ) {
91    os << LogIO::WARN << "Error while reading data CDMY1." << LogIO::POST ;
92    return -1 ;
93  }
94  c120[116] = '\0' ;
95  CDMY1 = string( c120 ) ;
96  // DEBUG
97  //cout << "CDMY1 = " << CDMY1 << endl ;
98  //
99  for ( int i = 0 ; i < arymax ; i++ ) {
100    if ( readHeader( DSBFC[i], sameEndian ) == -1 ) {
101      os << LogIO::WARN << "Error while reading data DSBFC[" << i << "]." << LogIO::POST ;
102      return -1 ;
103    }
104  }
105  // DEBUG
106//   nro_debug_output( "DSBFC", arymax, DSBFC ) ;
107  //
108
109  return 0 ;
110}
Note: See TracBrowser for help on using the repository browser.