LCOV - code coverage report
Current view: top level - asdmstman - AsdmIndex.cc (source / functions) Hit Total Coverage
Test: casacpp_coverage.info Lines: 24 46 52.2 %
Date: 2024-12-11 20:54:31 Functions: 3 4 75.0 %

          Line data    Source code
       1             : //# AsdmIndex.cc: Index for the ASDM Storage Manager
       2             : //# Copyright (C) 2012
       3             : //# Associated Universities, Inc. Washington DC, USA.
       4             : //# (c) European Southern Observatory, 2012
       5             : //# Copyright by ESO (in the framework of the ALMA collaboration)
       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 receied 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: casa-feedback@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: AsdmColumn.h 19324 2011-11-21 07:29:55Z diepen $
      29             : 
      30             : //# Includes
      31             : #include <asdmstman/AsdmIndex.h>
      32             : #include <casacore/tables/DataMan/DataManError.h>
      33             : #include <casacore/casa/IO/AipsIO.h>
      34             : 
      35             : using namespace casacore;
      36             : namespace casa {
      37             : 
      38      344195 :   uInt AsdmIndex::dataSize() const
      39             :   {
      40             :     int polSize;
      41      344195 :     switch (dataType) {
      42      108949 :     case 0:
      43             :       //polSize = 2*2*nPol;    
      44      108949 :       polSize = 2*2;  // cross complex short
      45      108949 :       break;
      46       55008 :     case 1:
      47             :       //polSize = 2*4*nPol;
      48       55008 :       polSize = 2*4;    // cross complex int
      49       55008 :       break;
      50           0 :     case 3:
      51             :       //polSize = 2*4*nPol;
      52           0 :       polSize = 2*4;    // cross complex float
      53           0 :       break;
      54      180238 :     case 10:
      55             :       // For autocorr, the nr of pol values is special (see getAuto).
      56             :       /*
      57             :       if (nPol == 3) {
      58             :         polSize = 4*4;
      59             :       } else if (nPol == 4) {
      60             :         polSize = 4*6;
      61             :       } else {
      62             :         polSize = 4*nPol;
      63             :       }
      64             :       */
      65      180238 :       polSize = 4;
      66      180238 :       break;
      67           0 :     default:
      68           0 :       throw DataManError ("AsdmStMan: unknown datatype " +
      69           0 :                           String::toString(dataType));
      70             :     }
      71      344195 :     return nBl * stepBl * polSize;
      72             :   }
      73             : 
      74       96025 :   AipsIO& operator<< (AipsIO& os, const AsdmIndex& ix)
      75             :   {
      76             :     // This is version 1 of the index.
      77       96025 :     os << Short(1) << ix.dataType << ix.fileNr
      78       96025 :        << ix.nBl << ix.nSpw << ix.nChan << ix.nPol
      79       96025 :        << ix.stepBl << ix.iSpw << ix.row << ix.fileOffset << ix.blockOffset;
      80       96025 :     os.put (ix.scaleFactors);
      81       96025 :     return os;
      82             :   }
      83             : 
      84      724688 :   AipsIO& operator>> (AipsIO& os, AsdmIndex& ix)
      85             :   {
      86             :     Short version;
      87      724688 :     os >> version >> ix.dataType >> ix.fileNr;
      88      724688 :     os >> ix.nBl >> ix.nSpw >> ix.nChan >> ix.nPol
      89      724688 :        >> ix.stepBl >> ix.iSpw >> ix.row >> ix.fileOffset >> ix.blockOffset;
      90      724688 :     os.get (ix.scaleFactors);
      91      724688 :     return os;
      92             :   }
      93             : 
      94           0 :   std::ostream& operator<<(std::ostream& os, const AsdmIndex& ix) {
      95             :     cout << Short(1)
      96           0 :          <<":"  << ix.dataType
      97           0 :          << ":" << ix.fileNr
      98           0 :          << ":" << ix.nBl
      99           0 :          << ":" << ix.nSpw
     100           0 :          << ":" << ix.nChan
     101           0 :          << ":" << ix.nPol
     102           0 :          << ":" << ix.stepBl
     103           0 :          << ":" << ix.iSpw
     104           0 :          << ":" << ix.row
     105           0 :          << ":" << ix.fileOffset
     106           0 :          << ":" << ix.blockOffset;
     107           0 :     cout << ":";
     108           0 :     for (unsigned int i = 0; i < ix.scaleFactors.size(); i++)
     109           0 :       cout << ix.scaleFactors[i] << " ";
     110             :     
     111           0 :     return os;
     112             :   }
     113             : 
     114             : 
     115             : } //# end namespace

Generated by: LCOV version 1.16