LCOV - code coverage report
Current view: top level - nrao/VLA - VLARCA.cc (source / functions) Hit Total Coverage
Test: casa_coverage.info Lines: 55 76 72.4 %
Date: 2023-10-25 08:47:59 Functions: 11 15 73.3 %

          Line data    Source code
       1             : //# VLARCA.cc:
       2             : //# Copyright (C) 1999,2001
       3             : //# Associated Universities, Inc. Washington DC, USA.
       4             : //#
       5             : //# This library is free software; you can redistribute it and/or modify it
       6             : //# under the terms of the GNU Library General Public License as published by
       7             : //# the Free Software Foundation; either version 2 of the License, or (at your
       8             : //# option) any later version.
       9             : //#
      10             : //# This library is distributed in the hope that it will be useful, but WITHOUT
      11             : //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
      12             : //# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
      13             : //# License for more details.
      14             : //#
      15             : //# You should have received a copy of the GNU Library General Public License
      16             : //# along with this library; if not, write to the Free Software Foundation,
      17             : //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
      18             : //#
      19             : //# Correspondence concerning AIPS++ should be addressed as follows:
      20             : //#        Internet email: aips2-request@nrao.edu.
      21             : //#        Postal address: AIPS++ Project Office
      22             : //#                        National Radio Astronomy Observatory
      23             : //#                        520 Edgemont Road
      24             : //#                        Charlottesville, VA 22903-2475 USA
      25             : //#
      26             : //# $Id$
      27             : 
      28             : #include <nrao/VLA/VLARCA.h>
      29             : #include <casacore/casa/Utilities/Assert.h>
      30             : #include <casacore/casa/Exceptions/Error.h>
      31             : 
      32          16 : VLARCA::VLARCA()
      33          16 :   :itsRecord()
      34             : {
      35          16 : }
      36             : 
      37           0 : VLARCA::VLARCA(ByteSource& record)
      38           0 :   :itsRecord(record)
      39             : {
      40           0 :   DebugAssert(record.isReadable(), AipsError);
      41           0 :   DebugAssert(record.isSeekable(), AipsError);
      42           0 : }
      43             : 
      44          16 : VLARCA::VLARCA(const VLARCA& other)
      45          16 :   :itsRecord(other.itsRecord)
      46             : {
      47          16 : }
      48             : 
      49          32 : VLARCA::~VLARCA() {
      50          32 : }
      51             : 
      52           0 : VLARCA& VLARCA::operator=(const VLARCA& other) {
      53           0 :   if (this != &other) {
      54           0 :     itsRecord = other.itsRecord;
      55             :   }
      56           0 :   return *this;
      57             : }
      58             : 
      59           0 : uInt VLARCA::length() const {
      60           0 :   const Int64 where = 0;
      61           0 :   itsRecord.seek(where);
      62             :   Int length;
      63           0 :   itsRecord >> length;
      64           0 :   DebugAssert(length > 0, AipsError);
      65           0 :   return 2*length; // The length is returned in bytes NOT words
      66             : }
      67             : 
      68      368990 : uInt VLARCA::revision() const {
      69      368990 :   const Int64 where = 2*3;
      70      368990 :   itsRecord.seek(where);
      71             :   Short rev;
      72      368990 :   itsRecord >> rev;
      73      368990 :   DebugAssert(rev > 0, AipsError);
      74      368990 :   return rev; 
      75             : }
      76             : 
      77       20569 : void VLARCA::attach(ByteSource& record) {
      78       20569 :   itsRecord = record;
      79       20569 :   DebugAssert(record.isReadable(), AipsError);
      80       20569 :   DebugAssert(record.isSeekable(), AipsError);
      81       20569 : }
      82             : 
      83       20569 : uInt VLARCA::SDAOffset() const {
      84       20569 :   const Int64 where = 2*(12);
      85       20569 :   itsRecord.seek(where);
      86             :   uInt offset;
      87       20569 :   itsRecord >> offset;
      88       20569 :   return offset*2; // The offset is in bytes NOT words
      89             : }
      90             : 
      91      553931 : uInt VLARCA::ADAOffset(uInt which) const {
      92      553931 :   DebugAssert(which < nAntennas(), AipsError);
      93      553931 :   Int64 where = 2*(14);
      94      553931 :   itsRecord.seek(where);
      95             :   uInt offset;
      96      553931 :   itsRecord >> offset;
      97      553931 :   if (which != 0) {
      98             :     uShort ADASize;
      99      533362 :     itsRecord >> ADASize;
     100      533362 :     offset += which*ADASize;
     101             :   }
     102      553931 :   return offset*2; // The offset is in bytes NOT words
     103             : }
     104             : 
     105     1153218 : uInt VLARCA::nAntennas() const {
     106     1153218 :   const Int64 where = 2*17;
     107     1153218 :   itsRecord.seek(where);
     108             :   uShort nant;
     109     1153218 :   itsRecord >> nant;
     110     1153218 :   return nant;
     111             : }
     112             : 
     113       82276 : uInt VLARCA::CDAOffset(uInt which) const {
     114       82276 :   AlwaysAssert(which < 4, AipsError);
     115       82276 :   const Int64 where = 2*(which*4+18);
     116       82276 :   itsRecord.seek(where);
     117             :   uInt offset;
     118       82276 :   itsRecord >> offset;
     119       82276 :   return offset*2; // The offset is in bytes NOT words
     120             : }
     121             : 
     122           0 : uInt VLARCA::CDAHeaderBytes(uInt which) const {
     123           0 :   AlwaysAssert(which < 4, AipsError);
     124           0 :   const Int64 where = 2*(which*4+20);
     125           0 :   itsRecord.seek(where);
     126             :   Short headerBytes;
     127           0 :   itsRecord >> headerBytes;
     128           0 :   return headerBytes*2; // The length is returned in bytes NOT words
     129             : }
     130             : 
     131       82276 : uInt VLARCA::CDABaselineBytes(uInt which) const {
     132       82276 :   AlwaysAssert(which < 4, AipsError);
     133       82276 :   const Int64 where = 2*(which*4+21);
     134       82276 :   itsRecord.seek(where);
     135             :   Short baselineBytes;
     136       82276 :   itsRecord >> baselineBytes;
     137       82276 :   return baselineBytes*2; // The length is returned in bytes NOT words
     138             : }
     139             : 
     140       20140 : uInt VLARCA::obsDay() const {
     141       20140 :   const Int64 where = 2*(4);
     142       20140 :   itsRecord.seek(where);
     143             :   uInt date;
     144       20140 :   itsRecord >> date;
     145       20140 :   return date;
     146             : }
     147             : 
     148             : // Local Variables: 
     149             : // compile-command: "gmake OPTLIB=1 VLARCA; cd test; gmake tVLARCA"
     150             : // End: 

Generated by: LCOV version 1.16