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

          Line data    Source code
       1             : /*
       2             :  * WeatherRecord.h
       3             :  *
       4             :  *  Created on: Jan 27, 2016
       5             :  *      Author: nakazato
       6             :  */
       7             : 
       8             : #ifndef SINGLEDISH_FILLER_WeatherRECORD_H_
       9             : #define SINGLEDISH_FILLER_WeatherRECORD_H_
      10             : 
      11             : #include <casacore/casa/BasicSL/String.h>
      12             : #include <casacore/measures/Measures/MPosition.h>
      13             : #include <casacore/ms/MeasurementSets/MSWeather.h>
      14             : #include <casacore/ms/MeasurementSets/MSWeatherColumns.h>
      15             : 
      16             : namespace casa { //# NAMESPACE CASA - BEGIN
      17             : namespace sdfiller { //# NAMESPACE SDFILLER - BEGIN
      18             : 
      19             : struct WeatherRecord {
      20             :   typedef casacore::MSWeather AssociatingTable;
      21             :   typedef casacore::MSWeatherColumns AssociatingColumns;
      22             : 
      23             :   // mandatory
      24             :   casacore::Int antenna_id;
      25             :   casacore::Double time;
      26             :   casacore::Double interval;
      27             : 
      28             :   // optional
      29             :   casacore::Float temperature;
      30             :   casacore::Float pressure;
      31             :   casacore::Float rel_humidity;
      32             :   casacore::Float wind_speed;
      33             :   casacore::Float wind_direction;
      34             : 
      35             :   // method
      36       14174 :   void clear() {
      37       14174 :     antenna_id = -1;
      38       14174 :     time = 0.0;
      39       14174 :     interval = 0.0;
      40       14174 :     temperature = -1.0;
      41       14174 :     pressure = -1.0;
      42       14174 :     rel_humidity = -1.0;
      43       14174 :     wind_speed = -1.0;
      44       14174 :     wind_direction = -1.0;
      45       14174 :   }
      46             : 
      47             :   WeatherRecord &operator=(WeatherRecord const &other) {
      48             :     antenna_id = other.antenna_id;
      49             :     time = other.time;
      50             :     interval = other.interval;
      51             :     temperature = other.temperature;
      52             :     pressure = other.pressure;
      53             :     rel_humidity = other.rel_humidity;
      54             :     wind_speed = other.wind_speed;
      55             :     wind_direction = other.wind_direction;
      56             :     return *this;
      57             :   }
      58             : 
      59       89931 :   bool operator==(WeatherRecord const &other) {
      60       89931 :     return (antenna_id == other.antenna_id)
      61       28851 :         && (temperature == other.temperature) && (pressure == other.pressure)
      62       14133 :         && (rel_humidity == other.rel_humidity)
      63       14133 :         && (wind_speed == other.wind_speed)
      64      118782 :         && (wind_direction == other.wind_direction);
      65             :   }
      66             : 
      67             :   void add(AssociatingTable &table, AssociatingColumns &/*columns*/) {
      68             :     table.addRow(1, true);
      69             :   }
      70             : 
      71          41 :   casacore::Bool fill(casacore::uInt irow, AssociatingColumns &columns) {
      72          41 :     if (columns.nrow() <= irow) {
      73           0 :       return false;
      74             :     }
      75             : 
      76          41 :     columns.antennaId().put(irow, antenna_id);
      77          41 :     columns.time().put(irow, time);
      78          41 :     columns.interval().put(irow, interval);
      79          41 :     columns.temperature().put(irow, temperature);
      80          41 :     columns.pressure().put(irow, pressure);
      81          41 :     columns.relHumidity().put(irow, rel_humidity);
      82          41 :     columns.windSpeed().put(irow, wind_speed);
      83          41 :     columns.windDirection().put(irow, wind_direction);
      84             : 
      85          41 :     return true;
      86             :   }
      87             : };
      88             : 
      89             : } //# NAMESPACE SDFILLER - END
      90             : } //# NAMESPACE CASA - END
      91             : 
      92             : #endif /* SINGLEDISH_FILLER_WeatherRECORD_H_ */

Generated by: LCOV version 1.16