Commits

synthesisimager: ensure tmp Records from toRecord() are released , CAS-12478
No tags

gcwrap/tools/synthesis/synthesisimager_cmpt.cc

Modified
112 112 bool
113 113 synthesisimager::selectdata(const casac::record& selpars)
114 114 {
115 115 Bool rstat(false);
116 116
117 117 try
118 118 {
119 119
120 120 //if( ! itsImager ) itsImager = new SynthesisImagerVi2();
121 121 itsImager = makeSI();
122 - casacore::Record recpars = *toRecord( selpars );
122 + std::unique_ptr<casacore::Record> recpars(toRecord( selpars ));
123 123 SynthesisParamsSelect pars;
124 - pars.fromRecord( recpars );
124 + pars.fromRecord( *recpars );
125 125
126 126 itsImager->selectData( pars );
127 127
128 128 // itsImager->selectData( pars.msname, pars.spw,
129 129 // pars.freqbeg, pars.freqend, pars.freqframe,
130 130 // pars.field, pars.antenna, pars.timestr, pars.scan,
131 131 // pars.obs, pars.state, pars.uvdist, pars.taql,
132 132 // pars.usescratch, pars.readonly, pars.incrmodel );
133 133
134 134 }
176 176 return rstat;
177 177 }
178 178
179 179 bool synthesisimager::defineimage(const casac::record& impars, const casac::record& gridpars)
180 180 {
181 181 Bool rstat(false);
182 182 *itsLog << casacore::LogOrigin("synthesisimager", __func__);
183 183 try
184 184 {
185 185
186 - //if( ! itsImager ) itsImager = new SynthesisImager();
187 - itsImager = makeSI();
188 - casacore::Record irecpars = *toRecord( impars );
186 + //if( ! itsImager ) itsImager = new SynthesisImager();
187 + itsImager = makeSI();
188 + std::unique_ptr<casacore::Record> irecpars(toRecord( impars ));
189 189 ////Temporary fix till we get the checking for phasecenter in fromRecord
190 190 ////to deal with this
191 191 //////////////
192 192 String movingSource="";
193 - if( irecpars.dataType("phasecenter") == TpString ){
194 - String pcen=irecpars.asString("phasecenter");
193 + if( irecpars->dataType("phasecenter") == TpString ){
194 + String pcen=irecpars->asString("phasecenter");
195 195 //seems to be a table so assuming ephemerides table
196 196 //Or A known planet
197 197 //Or special case
198 198 casacore::MDirection::Types refType;
199 199 Bool trackingNearSource= (Table::isReadable(pcen, False))
200 200 || ( (casacore::MDirection::getType(refType, pcen)) && (refType > casacore::MDirection::N_Types && refType < casacore::MDirection:: N_Planets ))
201 201 || (upcase(pcen)==String("TRACKFIELD"));
202 202 if(trackingNearSource){
203 203 *itsLog << "Detected tracking of moving source " << casacore::LogIO::POST;
204 204 if(refType > casacore::MDirection::N_Types && refType < casacore::MDirection::COMET){
205 205
206 206 *itsLog << "Will be Using measures internal ephemeris for " << casacore::MDirection::showType(refType) << " to track " << casacore::LogIO::POST;
207 207 }
208 208 movingSource=pcen;
209 - irecpars.define("phasecenter", "");
209 + irecpars->define("phasecenter", "");
210 210 }
211 211
212 212
213 213
214 214 //cerr << "PCEN " << pcen << " " << irecpars.asString("phasecenter")<< endl;
215 215 }
216 216
217 217 SynthesisParamsImage ipars;
218 - ipars.fromRecord( irecpars );
218 + ipars.fromRecord( *irecpars );
219 219
220 220
221 - casacore::Record grecpars = *toRecord( gridpars );
221 + std::unique_ptr<casacore::Record> grecpars (toRecord( gridpars ));
222 222 SynthesisParamsGrid gpars;
223 - gpars.fromRecord( grecpars );
223 + gpars.fromRecord( *grecpars );
224 224 ipars.trackSource=False;
225 225 if(movingSource != casacore::String("")){
226 226 itsImager->setMovingSource(movingSource);
227 227 ipars.trackSource=True;
228 228 ipars.movingSource=movingSource;
229 229 casacore::MDirection::Types refType;
230 230 if((casacore::MDirection::getType(refType, movingSource)) && (refType > casacore::MDirection::N_Types && refType < casacore::MDirection:: N_Planets ))
231 231 ipars.trackDir=casacore::MDirection(refType);
232 232
233 233 }
556 556 }
557 557
558 558 bool synthesisimager::executemajorcycle(const casac::record& controls)
559 559 {
560 560 Bool rstat(false);
561 561
562 562 try {
563 563
564 564 //if( ! itsImager ) itsImager = new SynthesisImager();
565 565 itsImager = makeSI();
566 - casacore::Record recpars = *toRecord( controls );
567 - itsImager->executeMajorCycle( recpars );
566 + std::unique_ptr<casacore::Record> recpars(toRecord( controls ));
567 + itsImager->executeMajorCycle( *recpars );
568 568
569 569 } catch (AipsError x) {
570 570 RETHROW(x);
571 571 }
572 572 return rstat;
573 573 }
574 574
575 575 bool synthesisimager::makepb()
576 576 {
577 577 Bool rstat(false);

Everything looks good. We'll let you know here if there's anything you should know about.

Add shortcut