LCOV - code coverage report
Current view: top level - singledishfiller/Filler - AntennaRecord.h (source / functions) Hit Total Coverage
Test: ctest_coverage.info Lines: 23 25 92.0 %
Date: 2023-11-06 10:06:49 Functions: 3 3 100.0 %

          Line data    Source code
       1             : /*
       2             :  * AntennaRecord.h
       3             :  *
       4             :  *  Created on: Jan 27, 2016
       5             :  *      Author: nakazato
       6             :  */
       7             : 
       8             : #ifndef SINGLEDISH_FILLER_ANTENNARECORD_H_
       9             : #define SINGLEDISH_FILLER_ANTENNARECORD_H_
      10             : 
      11             : #include <casacore/casa/BasicSL/String.h>
      12             : #include <casacore/measures/Measures/MPosition.h>
      13             : #include <casacore/ms/MeasurementSets/MSAntenna.h>
      14             : #include <casacore/ms/MeasurementSets/MSAntennaColumns.h>
      15             : 
      16             : namespace casa { //# NAMESPACE CASA - BEGIN
      17             : namespace sdfiller { //# NAMESPACE SDFILLER - BEGIN
      18             : 
      19             : struct AntennaRecord {
      20             :   typedef casacore::MSAntenna AssociatingTable;
      21             :   typedef casacore::MSAntennaColumns AssociatingColumns;
      22             : 
      23             :   // mandatory
      24             :   casacore::String name;
      25             :   casacore::MPosition position;
      26             :   casacore::String type;
      27             :   casacore::String mount;
      28             :   casacore::Double dish_diameter;
      29             : 
      30             :   // optional
      31             :   casacore::String station;
      32             :   casacore::MPosition offset;
      33             : 
      34             :   // method
      35          20 :   void clear() {
      36          20 :     name = "";
      37          20 :     position = casacore::MPosition();
      38          20 :     type = "";
      39          20 :     mount = "";
      40          20 :     dish_diameter = -1.0;
      41          20 :     station = "";
      42          20 :     offset = casacore::MPosition();
      43          20 :   }
      44             : 
      45             :   AntennaRecord &operator=(AntennaRecord const &other) {
      46             :     name = other.name;
      47             :     position = other.position;
      48             :     type = other.type;
      49             :     mount = other.mount;
      50             :     dish_diameter = other.dish_diameter;
      51             :     station = other.station;
      52             :     offset = other.offset;
      53             :     return *this;
      54             :   }
      55             : 
      56          13 :   void add(AssociatingTable &table, AssociatingColumns &/*columns*/) {
      57          13 :     table.addRow(1, true);
      58          13 :   }
      59             : 
      60          13 :   casacore::Bool fill(casacore::uInt irow, AssociatingColumns &columns) {
      61          13 :     if (columns.nrow() <= irow) {
      62           0 :       return false;
      63             :     }
      64             : 
      65          13 :     columns.name().put(irow, name);
      66          13 :     columns.positionMeas().put(irow, position);
      67          13 :     columns.type().put(irow, type);
      68          13 :     columns.mount().put(irow, mount);
      69          13 :     columns.dishDiameter().put(irow, dish_diameter);
      70          13 :     if (station.size() > 0) {
      71           5 :       columns.station().put(irow, station);
      72             :     }
      73          13 :     if (anyNE(offset.getAngle().getValue(), 0.0)) {
      74           0 :       columns.offsetMeas().put(irow, offset);
      75             :     }
      76          13 :     return true;
      77             :   }
      78             : };
      79             : 
      80             : } //# NAMESPACE SDFILLER - END
      81             : } //# NAMESPACE CASA - END
      82             : 
      83             : #endif /* SINGLEDISH_FILLER_ANTENNARECORD_H_ */

Generated by: LCOV version 1.16