Line data Source code
1 : //# CalHistoryColumns.cc: Implementation of CalHistoryColumns.h 2 : //# Copyright (C) 1996,1997,1998,2001,2003 3 : //# Associated Universities, Inc. Washington DC, USA. 4 : //# 5 : //# This library is free software; you can redistribute it and/or modify it 6 : //# under the terms of the GNU Library General Public License as published by 7 : //# the Free Software Foundation; either version 2 of the License, or (at your 8 : //# option) any later version. 9 : //# 10 : //# This library is distributed in the hope that it will be useful, but WITHOUT 11 : //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 12 : //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public 13 : //# License for more details. 14 : //# 15 : //# You should have received a copy of the GNU Library General Public License 16 : //# along with this library; if not, write to the Free Software Foundation, 17 : //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA. 18 : //# 19 : //# Correspondence concerning AIPS++ should be addressed as follows: 20 : //# Internet email: casa-feedback@nrao.edu. 21 : //# Postal address: AIPS++ Project Office 22 : //# National Radio Astronomy Observatory 23 : //# 520 Edgemont Road 24 : //# Charlottesville, VA 22903-2475 USA 25 : //# 26 : //# $Id$ 27 : //---------------------------------------------------------------------------- 28 : 29 : #include <synthesis/CalTables/CalHistoryColumns.h> 30 : 31 : using namespace casacore; 32 : namespace casa { //# NAMESPACE CASA - BEGIN 33 : 34 : //---------------------------------------------------------------------------- 35 : 36 0 : ROCalHistoryColumns::ROCalHistoryColumns (const CalTable& calTable) 37 : { 38 : // Construct from a calibration table 39 : // Input: 40 : // calTable const CalTable& Calibration table 41 : // Output to private data: 42 : // calParms_p ScalarColumn<String>& Solver parameters 43 : // calTables_p ScalarColumn<String>& Associated cal. tables 44 : // calSelect_p ScalarColumn<String>& Cal. selection 45 : // calNotes_p ScalarColumn<String>& Cal. notes 46 : // 47 : // Attach all the column accessors (including required and 48 : // optional columns) 49 0 : attach (calTable, calParms_p, MSC::CAL_PARMS); 50 0 : attach (calTable, calTables_p, MSC::CAL_TABLES); 51 0 : attach (calTable, calSelect_p, MSC::CAL_SELECT); 52 0 : attach (calTable, calNotes_p, MSC::CAL_NOTES); 53 0 : }; 54 : 55 : //---------------------------------------------------------------------------- 56 : 57 0 : void ROCalHistoryColumns::attach (const CalTable& calTable, 58 : TableColumn& tabCol, 59 : MSCalEnums::colDef colEnum, 60 : const Bool& optional) 61 : { 62 : // Attach a column accessor to the calibration table 63 : // Input: 64 : // calTable const CalTable& Calibration table 65 : // tabCol TableColumn& Table column accessor 66 : // colEnum MSCalEnums::colDef Column enum 67 : // optional const Bool& true if optional column 68 : // Output to private data: 69 : // 70 : // Convert to column name 71 0 : String colName = MSC::fieldName (colEnum); 72 : 73 : // Check if an optional column 74 0 : if (optional) { 75 0 : if (calHistoryAsTable(calTable).tableDesc().isColumn(colName)) { 76 0 : tabCol.attach (calHistoryAsTable(calTable), colName); 77 : }; 78 : } else { 79 0 : tabCol.attach (calHistoryAsTable(calTable), colName); 80 : }; 81 0 : }; 82 : 83 : //---------------------------------------------------------------------------- 84 : 85 0 : CalHistoryColumns::CalHistoryColumns (CalTable& calTable) 86 : { 87 : // Construct from a calibration table 88 : // Input: 89 : // calTable const CalTable& Calibration table 90 : // Output to private data: 91 : // calParms_p ScalarColumn<String>& Solver parameters 92 : // calTables_p ScalarColumn<String>& Associated cal. tables 93 : // calSelect_p ScalarColumn<String>& Cal. selection 94 : // calNotes_p ScalarColumn<String>& Cal. notes 95 : // 96 : // Attach all the column accessors (including required and 97 : // optional columns) 98 0 : attach (calTable, calParms_p, MSC::CAL_PARMS); 99 0 : attach (calTable, calTables_p, MSC::CAL_TABLES); 100 0 : attach (calTable, calSelect_p, MSC::CAL_SELECT); 101 0 : attach (calTable, calNotes_p, MSC::CAL_NOTES); 102 0 : }; 103 : 104 : //---------------------------------------------------------------------------- 105 : 106 0 : void CalHistoryColumns::attach (CalTable& calTable, 107 : TableColumn& tabCol, 108 : MSCalEnums::colDef colEnum, 109 : const Bool& optional) 110 : { 111 : // Attach a column accessor to the calibration table 112 : // Input: 113 : // calTable CalTable& Calibration table 114 : // tabCol TableColumn& Table column accessor 115 : // colEnum MSCalEnums::colDef Column enum 116 : // optional const Bool& true if optional column 117 : // Output to private data: 118 : // 119 : // Convert to column name 120 0 : String colName = MSC::fieldName (colEnum); 121 : 122 : // Check if an optional column 123 0 : if (optional) { 124 0 : if (calHistoryAsTable(calTable).tableDesc().isColumn(colName)) { 125 0 : tabCol.attach (calHistoryAsTable(calTable), colName); 126 : }; 127 : } else { 128 0 : tabCol.attach (calHistoryAsTable(calTable), colName); 129 : }; 130 0 : }; 131 : 132 : //---------------------------------------------------------------------------- 133 : 134 : } //# NAMESPACE CASA - END 135 :