Line data Source code
1 : //# CalHistoryBuffer.cc: Implementation of CalHistoryBuffer.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/CalHistoryBuffer.h> 30 : 31 : using namespace casacore; 32 : namespace casa { //# NAMESPACE CASA - BEGIN 33 : 34 : //---------------------------------------------------------------------------- 35 : 36 1 : CalHistoryBuffer::CalHistoryBuffer() : 37 1 : connectedToIter_p(false), calHistCol_p(NULL) 38 : { 39 : // Null constructor 40 : // Output to private data: 41 : // connectedToIter_p Bool true if connected to iterator 42 : // calHistCol_p CalHistoryColumns* Ptr to cal_history col accessor 43 : // calParms_p Vector<String> Solver parameters 44 : // calTables_p Vector<String> Associated cal. tables 45 : // calSelect_p Vector<String> Cal. selection 46 : // calNotes_p Vector<String> Cal. notes 47 : // calParmsOK_p Bool Solver parms cache ok 48 : // calTablesOK_p Bool Assoc. cal. tables cache ok 49 : // calSelectOK_p Bool Cal. selection cache ok 50 : // calNotesOK_p Bool Cal. notes cache ok 51 : // 52 : // Invalidate cache 53 1 : invalidate(); 54 1 : }; 55 : 56 : //---------------------------------------------------------------------------- 57 : 58 0 : CalHistoryBuffer::CalHistoryBuffer (CalIterBase& calIter) : 59 0 : connectedToIter_p(true), calHistCol_p(NULL) 60 : { 61 : // Construct from a calibration table iterator 62 : // Input: 63 : // calIter CalIterBase& Calibration table iterator 64 : // Output to private data: 65 : // connectedToIter_p Bool true if connected to iterator 66 : // calHistCol_p CalHistoryColumns* Ptr to cal_history col accessor 67 : // calParms_p Vector<String> Solver parameters 68 : // calTables_p Vector<String> Associated cal. tables 69 : // calSelect_p Vector<String> Cal. selection 70 : // calNotes_p Vector<String> Cal. notes 71 : // calParmsOK_p Bool Solver parms cache ok 72 : // calTablesOK_p Bool Assoc. cal. tables cache ok 73 : // calSelectOK_p Bool Cal. selection cache ok 74 : // calNotesOK_p Bool Cal. notes cache ok 75 : // 76 : // Invalidate cache 77 0 : invalidate(); 78 : 79 : // Construct the cal_history column accessor 80 0 : calHistCol_p = newCalHistoryCol (calIter.subTable()); 81 0 : }; 82 : 83 : //---------------------------------------------------------------------------- 84 : 85 2 : CalHistoryBuffer::~CalHistoryBuffer() 86 : { 87 : // Destructor 88 : // Output to private data: 89 : // calHistCol_p CalHistoryColumns* Ptr to cal main col accessor 90 : // 91 1 : if (calHistCol_p) delete calHistCol_p; 92 2 : }; 93 : 94 : //---------------------------------------------------------------------------- 95 : 96 1 : void CalHistoryBuffer::invalidate() 97 : { 98 : // Invalidate the current cache 99 : // Output to private data: 100 : // calParmsOK_p Bool Solver parms cache ok 101 : // calTablesOK_p Bool Assoc. cal. tables cache ok 102 : // calSelectOK_p Bool Cal. selection cache ok 103 : // calNotesOK_p Bool Cal. notes cache ok 104 : // 105 : // Set all cache flags to false 106 1 : calParmsOK_p = false; 107 1 : calTablesOK_p = false; 108 1 : calSelectOK_p = false; 109 1 : calNotesOK_p = false; 110 1 : }; 111 : 112 : //---------------------------------------------------------------------------- 113 : 114 0 : Vector<String>& CalHistoryBuffer::calParms() 115 : { 116 : // CAL_PARMS data field accessor 117 : // Input from private data: 118 : // connectedToIter_p Bool true if connected to iterator 119 : // calParms_p Vector<String>& Solver parms 120 : // 121 : // Fill local cache for this column if cache not valid 122 0 : if (connectedToIter()) { 123 0 : if (!calParmsOK_p) { 124 0 : calHistCol()->calParms().getColumn (calParms_p); 125 0 : calParmsOK_p = true; 126 : }; 127 : }; 128 0 : return calParms_p; 129 : }; 130 : 131 : //---------------------------------------------------------------------------- 132 : 133 0 : Vector<String>& CalHistoryBuffer::calTables() 134 : { 135 : // CAL_TABLES data field accessor 136 : // Input from private data: 137 : // connectedToIter_p Bool true if connected to iterator 138 : // calTables_p Vector<String>& Associated cal. tables 139 : // 140 : // Fill local cache for this column if cache not valid 141 0 : if (connectedToIter()) { 142 0 : if (!calTablesOK_p) { 143 0 : calHistCol()->calTables().getColumn (calTables_p); 144 0 : calTablesOK_p = true; 145 : }; 146 : }; 147 0 : return calTables_p; 148 : }; 149 : 150 : //---------------------------------------------------------------------------- 151 : 152 0 : Vector<String>& CalHistoryBuffer::calSelect() 153 : { 154 : // CAL_SELECT data field accessor 155 : // Input from private data: 156 : // connectedToIter_p Bool true if connected to iterator 157 : // calSelect_p Vector<String>& Cal. selection 158 : // 159 : // Fill local cache for this column if cache not valid 160 0 : if (connectedToIter()) { 161 0 : if (!calSelectOK_p) { 162 0 : calHistCol()->calSelect().getColumn (calSelect_p); 163 0 : calSelectOK_p = true; 164 : }; 165 : }; 166 0 : return calSelect_p; 167 : }; 168 : 169 : //---------------------------------------------------------------------------- 170 : 171 0 : Vector<String>& CalHistoryBuffer::calNotes() 172 : { 173 : // CAL_PARMS data field accessor 174 : // Input from private data: 175 : // connectedToIter_p Bool true if connected to iterator 176 : // calNotes_p Vector<String>& Cal. notes 177 : // 178 : // Fill local cache for this column if cache not valid 179 0 : if (connectedToIter()) { 180 0 : if (!calNotesOK_p) { 181 0 : calHistCol()->calNotes().getColumn (calNotes_p); 182 0 : calNotesOK_p = true; 183 : }; 184 : }; 185 0 : return calNotes_p; 186 : }; 187 : 188 : //---------------------------------------------------------------------------- 189 : 190 : } //# NAMESPACE CASA - END 191 :