LCOV - code coverage report
Current view: top level - singledishfiller/Filler - ObservationRecord.h (source / functions) Hit Total Coverage
Test: casacpp_coverage.info Lines: 24 29 82.8 %
Date: 2024-11-06 17:42:47 Functions: 3 3 100.0 %

          Line data    Source code
       1             : /*
       2             :  * ObservationRecord.h
       3             :  *
       4             :  *  Created on: Jan 27, 2016
       5             :  *      Author: nakazato
       6             :  */
       7             : 
       8             : #ifndef SINGLEDISH_FILLER_OBSERVATIONRECORD_H_
       9             : #define SINGLEDISH_FILLER_OBSERVATIONRECORD_H_
      10             : 
      11             : #include <casacore/casa/BasicSL/String.h>
      12             : #include <casacore/ms/MeasurementSets/MSObservation.h>
      13             : #include <casacore/ms/MeasurementSets/MSObsColumns.h>
      14             : 
      15             : namespace casa { //# NAMESPACE CASA - BEGIN
      16             : namespace sdfiller { //# NAMESPACE SDFILLER - BEGIN
      17             : 
      18             : struct ObservationRecord {
      19             :   typedef casacore::MSObservation AssociatingTable;
      20             :   typedef casacore::MSObservationColumns AssociatingColumns;
      21             : 
      22             :   // mandatory
      23             :   casacore::String telescope_name;
      24             :   casacore::Vector<casacore::Double> time_range;
      25             :   casacore::String observer;
      26             :   casacore::String project;
      27             : 
      28             :   // optional
      29             :   casacore::String schedule_type;
      30             :   casacore::Double release_date;
      31             :   casacore::Vector<casacore::String> schedule;
      32             :   casacore::Vector<casacore::String> log;
      33             : 
      34             :   // method
      35          14 :   void clear() {
      36          14 :     telescope_name = "";
      37          14 :     time_range.resize();
      38          14 :     observer = "";
      39          14 :     project = "";
      40          14 :     schedule_type = "";
      41          14 :     release_date = -1.0;
      42          14 :     schedule = "";
      43          14 :     log.resize();
      44          14 :   }
      45             : 
      46             :   ObservationRecord &operator=(ObservationRecord const &other) {
      47             :     telescope_name = other.telescope_name;
      48             :     time_range = other.time_range;
      49             :     observer = other.observer;
      50             :     project = other.project;
      51             :     schedule_type = other.schedule_type;
      52             :     release_date = other.release_date;
      53             :     schedule = other.schedule;
      54             :     log = other.log;
      55             :     return *this;
      56             :   }
      57             : 
      58           7 :   void add(AssociatingTable &table, AssociatingColumns &/*columns*/) {
      59           7 :     table.addRow(1, true);
      60           7 :   }
      61             : 
      62           7 :   casacore::Bool fill(casacore::uInt irow, AssociatingColumns &columns) {
      63           7 :     if (columns.nrow() <= irow) {
      64           0 :       return false;
      65             :     }
      66             : 
      67           7 :     columns.telescopeName().put(irow, telescope_name);
      68           7 :     columns.timeRange().put(irow, time_range);
      69           7 :     columns.observer().put(irow, observer);
      70           7 :     columns.project().put(irow, project);
      71           7 :     if (schedule_type.size() > 0) {
      72           0 :       columns.scheduleType().put(irow, schedule_type);
      73             :     }
      74           7 :     if (0.0 <= release_date) {
      75           0 :       columns.releaseDate().put(irow, release_date);
      76             :     }
      77           7 :     if (schedule.size() > 0) {
      78           0 :       columns.schedule().put(irow, schedule);
      79             :     }
      80           7 :     if (log.size() > 0) {
      81           0 :       columns.log().put(irow, log);
      82             :     }
      83           7 :     return true;
      84             :   }
      85             : };
      86             : 
      87             : } //# NAMESPACE SDFILLER - END
      88             : } //# NAMESPACE CASA - END
      89             : 
      90             : #endif /* SINGLEDISH_FILLER_OBSERVATIONRECORD_H_ */

Generated by: LCOV version 1.16