ObservationRecord.h

Go to the documentation of this file.
00001 /*
00002  * ObservationRecord.h
00003  *
00004  *  Created on: Jan 27, 2016
00005  *      Author: nakazato
00006  */
00007 
00008 #ifndef SINGLEDISH_FILLER_OBSERVATIONRECORD_H_
00009 #define SINGLEDISH_FILLER_OBSERVATIONRECORD_H_
00010 
00011 #include <casacore/casa/BasicSL/String.h>
00012 #include <casacore/ms/MeasurementSets/MSObservation.h>
00013 #include <casacore/ms/MeasurementSets/MSObsColumns.h>
00014 
00015 namespace casa { //# NAMESPACE CASA - BEGIN
00016 namespace sdfiller { //# NAMESPACE SDFILLER - BEGIN
00017 
00018 struct ObservationRecord {
00019   typedef MSObservation AssociatingTable;
00020   typedef MSObservationColumns AssociatingColumns;
00021 
00022   // mandatory
00023   String telescope_name;
00024   Vector<Double> time_range;
00025   String observer;
00026   String project;
00027 
00028   // optional
00029   String schedule_type;
00030   Double release_date;
00031   Vector<String> schedule;
00032   Vector<String> log;
00033 
00034   // method
00035   void clear() {
00036     telescope_name = "";
00037     time_range.resize();
00038     observer = "";
00039     project = "";
00040     schedule_type = "";
00041     release_date = -1.0;
00042     schedule = "";
00043     log.resize();
00044   }
00045 
00046   ObservationRecord &operator=(ObservationRecord const &other) {
00047     telescope_name = other.telescope_name;
00048     time_range = other.time_range;
00049     observer = other.observer;
00050     project = other.project;
00051     schedule_type = other.schedule_type;
00052     release_date = other.release_date;
00053     schedule = other.schedule;
00054     log = other.log;
00055     return *this;
00056   }
00057 
00058   void add(AssociatingTable &table, AssociatingColumns &/*columns*/) {
00059     table.addRow(1, True);
00060   }
00061 
00062   Bool fill(uInt irow, AssociatingColumns &columns) {
00063     if (columns.nrow() <= irow) {
00064       return False;
00065     }
00066 
00067     columns.telescopeName().put(irow, telescope_name);
00068     columns.timeRange().put(irow, time_range);
00069     columns.observer().put(irow, observer);
00070     columns.project().put(irow, project);
00071     if (schedule_type.size() > 0) {
00072       columns.scheduleType().put(irow, schedule_type);
00073     }
00074     if (0.0 <= release_date) {
00075       columns.releaseDate().put(irow, release_date);
00076     }
00077     if (schedule.size() > 0) {
00078       columns.schedule().put(irow, schedule);
00079     }
00080     if (log.size() > 0) {
00081       columns.log().put(irow, log);
00082     }
00083     return True;
00084   }
00085 };
00086 
00087 } //# NAMESPACE SDFILLER - END
00088 } //# NAMESPACE CASA - END
00089 
00090 #endif /* SINGLEDISH_FILLER_OBSERVATIONRECORD_H_ */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 31 Aug 2016 for casa by  doxygen 1.6.1