LCOV - code coverage report
Current view: top level - nrao/VLA - VLARCA.cc (source / functions) Hit Total Coverage
Test: casacpp_coverage.info Lines: 0 76 0.0 %
Date: 2024-10-12 00:35:29 Functions: 0 15 0.0 %

          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: casa-feedback@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           0 : VLARCA::VLARCA()
      33           0 :   :itsRecord()
      34             : {
      35           0 : }
      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           0 : VLARCA::VLARCA(const VLARCA& other)
      45           0 :   :itsRecord(other.itsRecord)
      46             : {
      47           0 : }
      48             : 
      49           0 : VLARCA::~VLARCA() {
      50           0 : }
      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           0 : uInt VLARCA::revision() const {
      69           0 :   const Int64 where = 2*3;
      70           0 :   itsRecord.seek(where);
      71             :   Short rev;
      72           0 :   itsRecord >> rev;
      73           0 :   DebugAssert(rev > 0, AipsError);
      74           0 :   return rev; 
      75             : }
      76             : 
      77           0 : void VLARCA::attach(ByteSource& record) {
      78           0 :   itsRecord = record;
      79           0 :   DebugAssert(record.isReadable(), AipsError);
      80           0 :   DebugAssert(record.isSeekable(), AipsError);
      81           0 : }
      82             : 
      83           0 : uInt VLARCA::SDAOffset() const {
      84           0 :   const Int64 where = 2*(12);
      85           0 :   itsRecord.seek(where);
      86             :   uInt offset;
      87           0 :   itsRecord >> offset;
      88           0 :   return offset*2; // The offset is in bytes NOT words
      89             : }
      90             : 
      91           0 : uInt VLARCA::ADAOffset(uInt which) const {
      92           0 :   DebugAssert(which < nAntennas(), AipsError);
      93           0 :   Int64 where = 2*(14);
      94           0 :   itsRecord.seek(where);
      95             :   uInt offset;
      96           0 :   itsRecord >> offset;
      97           0 :   if (which != 0) {
      98             :     uShort ADASize;
      99           0 :     itsRecord >> ADASize;
     100           0 :     offset += which*ADASize;
     101             :   }
     102           0 :   return offset*2; // The offset is in bytes NOT words
     103             : }
     104             : 
     105           0 : uInt VLARCA::nAntennas() const {
     106           0 :   const Int64 where = 2*17;
     107           0 :   itsRecord.seek(where);
     108             :   uShort nant;
     109           0 :   itsRecord >> nant;
     110           0 :   return nant;
     111             : }
     112             : 
     113           0 : uInt VLARCA::CDAOffset(uInt which) const {
     114           0 :   AlwaysAssert(which < 4, AipsError);
     115           0 :   const Int64 where = 2*(which*4+18);
     116           0 :   itsRecord.seek(where);
     117             :   uInt offset;
     118           0 :   itsRecord >> offset;
     119           0 :   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           0 : uInt VLARCA::CDABaselineBytes(uInt which) const {
     132           0 :   AlwaysAssert(which < 4, AipsError);
     133           0 :   const Int64 where = 2*(which*4+21);
     134           0 :   itsRecord.seek(where);
     135             :   Short baselineBytes;
     136           0 :   itsRecord >> baselineBytes;
     137           0 :   return baselineBytes*2; // The length is returned in bytes NOT words
     138             : }
     139             : 
     140           0 : uInt VLARCA::obsDay() const {
     141           0 :   const Int64 where = 2*(4);
     142           0 :   itsRecord.seek(where);
     143             :   uInt date;
     144           0 :   itsRecord >> date;
     145           0 :   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