LCOV - code coverage report
Current view: top level - asdmstman - AsdmColumn.cc (source / functions) Hit Total Coverage
Test: casa_coverage.info Lines: 31 70 44.3 %
Date: 2023-10-25 08:47:59 Functions: 12 30 40.0 %

          Line data    Source code
       1             : //# AsdmColumn.cc: A column in 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: 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: AsdmColumn.cc 19324 2011-11-21 07:29:55Z diepen $
      29             : 
      30             : #include <asdmstman/AsdmColumn.h>
      31             : #include <casacore/casa/Arrays/Array.h>
      32             : 
      33             : using namespace casacore;
      34             : using namespace casa;
      35             : 
      36             : using namespace casacore;
      37             : namespace casa {
      38             : 
      39         263 :   AsdmColumn::~AsdmColumn()
      40         263 :   {}
      41       47794 :   Bool AsdmColumn::isWritable() const
      42             :   {
      43             :     // We return true even though the column is not writable. If an actual write is done,
      44             :     // an exception will be thrown. This ensures that the AsdmStMan will work with MSMainColumns.
      45             :     // The alternative solutions would cause too much code duplication.
      46       47794 :     return true;
      47             :   }
      48           0 :   void AsdmColumn::setShapeColumn (const IPosition&)
      49           0 :   {}
      50         263 :   void AsdmColumn::prepareCol()
      51         263 :   {}
      52             : 
      53             : 
      54         450 :   AsdmDataColumn::~AsdmDataColumn()
      55         450 :   {}
      56     6017420 :   IPosition AsdmDataColumn::shape (uInt rownr)
      57             :   {
      58     6017420 :     return itsParent->getShape (rownr);
      59             :   }
      60     2362488 :   void AsdmDataColumn::getArrayComplexV (uInt rownr, Array<Complex>* dataPtr)
      61             :   {
      62             :     Bool deleteIt;
      63     2362488 :     Complex* data = dataPtr->getStorage(deleteIt);
      64     2362488 :     itsParent->getData (rownr, data);
      65     2362488 :     dataPtr->putStorage (data, deleteIt);
      66     2362488 :   }
      67             : 
      68     3802875 :   void AsdmDataColumn::getSliceComplexV (uInt rowNumber, const Slicer & slicer,
      69             :                                          Array<casacore::Complex> * destination)
      70             :   {
      71             :      // Create an array to hold the entire table cell.
      72             : 
      73     3802875 :     Array<Complex> entireCell (shape (rowNumber));
      74             : 
      75             :     // Load the entire cell into an array
      76             : 
      77             :     Bool deleteIt;
      78     3802875 :     Complex * entireCellData = entireCell.getStorage(deleteIt); // get pointer to storage
      79             : 
      80     3802875 :     itsParent->getData (rowNumber, entireCellData); // fill storage with data
      81             : 
      82     3802875 :     entireCell.putStorage (entireCellData, deleteIt); // "return" storage
      83             : 
      84             :     // Transfer the data specified by the slicer into the destination array.
      85             : 
      86     3802875 :     destination->assign (entireCell (slicer));
      87     3802875 :   }
      88             : 
      89          76 :   AsdmFloatDataColumn::~AsdmFloatDataColumn()
      90          76 :   {}
      91       80212 :   IPosition AsdmFloatDataColumn::shape (uInt rownr)
      92             :   {
      93       80212 :     return itsParent->getShape (rownr);
      94             :   }
      95       80212 :   void AsdmFloatDataColumn::getArrayfloatV (uInt rownr, Array<Float>* dataPtr)
      96             :   {
      97             :     Bool deleteIt;
      98       80212 :     Float* data = dataPtr->getStorage(deleteIt);
      99       80212 :     itsParent->getData (rownr, data);
     100       80212 :     dataPtr->putStorage (data, deleteIt);
     101       80212 :   }
     102             : 
     103           0 :   void AsdmFloatDataColumn::getSlicefloatV (uInt rowNumber, const Slicer & slicer,
     104             :                                             Array<casacore::Float> * destination)
     105             :   {
     106             :      // Create an array to hold the entire table cell.
     107             : 
     108           0 :     Array<Float> entireCell (shape (rowNumber));
     109             : 
     110             :     // Load the entire cell into an array
     111             : 
     112             :     Bool deleteIt;
     113           0 :     Float * entireCellData = entireCell.getStorage(deleteIt); // get pointer to storage
     114             : 
     115           0 :     itsParent->getData (rowNumber, entireCellData); // fill storage with data
     116             : 
     117           0 :     entireCell.putStorage (entireCellData, deleteIt); // "return" storage
     118             : 
     119             :     // Transfer the data specified by the slicer into the destination array.
     120             : 
     121           0 :     destination->assign (entireCell (slicer));
     122           0 :   }
     123             : 
     124             : 
     125             : 
     126             : 
     127           0 :   AsdmFlagColumn::~AsdmFlagColumn()
     128           0 :   {}
     129           0 :   IPosition AsdmFlagColumn::shape (uInt rownr)
     130             :   {
     131           0 :     return itsParent->getShape (rownr);
     132             :   }
     133           0 :   void AsdmFlagColumn::getArrayBoolV (uInt, Array<Bool>* dataPtr)
     134             :   {
     135           0 :     *dataPtr = false;
     136           0 :   }
     137             : 
     138           0 :   void AsdmFlagColumn::getSliceBoolV (uInt /*rowNumber*/, const Slicer & /* slicer */,
     139             :                                        Array<casacore::Bool> * destination)
     140             :   {
     141           0 :     * destination = false;
     142           0 :   }
     143             : 
     144             : 
     145           0 :   AsdmWeightColumn::~AsdmWeightColumn()
     146           0 :   {}
     147           0 :   IPosition AsdmWeightColumn::shape (uInt rownr)
     148             :   {
     149           0 :     return IPosition(1, itsParent->getShape(rownr)[0]);
     150             :   }
     151           0 :   void AsdmWeightColumn::getArrayfloatV (uInt, Array<Float>* dataPtr)
     152             :   {
     153           0 :     *dataPtr = float(1);
     154           0 :   }
     155           0 :     void AsdmWeightColumn::getSlicefloatV (uInt /*rowNumber*/, const Slicer & /* slicer */,
     156             :                                          Array<casacore::Float> * destination)
     157             :   {
     158           0 :     * destination = 1.0f;
     159           0 :   }
     160             : 
     161             : 
     162           0 :   AsdmSigmaColumn::~AsdmSigmaColumn()
     163           0 :   {}
     164           0 :   IPosition AsdmSigmaColumn::shape (uInt rownr)
     165             :   {
     166           0 :     return IPosition(1, itsParent->getShape(rownr)[0]);
     167             :   }
     168           0 :   void AsdmSigmaColumn::getArrayfloatV (uInt, Array<Float>* dataPtr)
     169             :   {
     170           0 :     *dataPtr = float(1);
     171           0 :   }
     172             : 
     173           0 :   void AsdmSigmaColumn::getSlicefloatV (uInt /*rowNumber*/, const Slicer & /* slicer */,
     174             :                                         Array<casacore::Float> * destination)
     175             :   {
     176           0 :     * destination = 1.0f;
     177           0 :   }
     178             : 
     179             : 
     180             : } //# end namespace

Generated by: LCOV version 1.16