Changeset 10216 in ntrip for trunk/BNC/src/combination


Ignore:
Timestamp:
Sep 22, 2023, 8:18:12 AM (8 months ago)
Author:
stuerze
Message:

memory leak fixed in combination

Location:
trunk/BNC/src/combination
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNC/src/combination/bncbiassnx.cpp

    r10038 r10216  
    297297////////////////////////////////////////////////////////////////////////////
    298298void bncBiasSnx::determineSsrSatCodeBiases(QString prn, double aIF1, double aIF2,
    299                                            t_satCodeBias* satCodeBias) {
     299                                           t_satCodeBias& satCodeBias) {
    300300  std::string rnxType2ch;
    301301  double value;
     
    520520
    521521void bncBiasSnx::setSsrSatCodeBias(std::string rnxType2ch, double value,
    522                                     t_satCodeBias* satCodeBias) {
     522                                    t_satCodeBias& satCodeBias) {
    523523  t_frqCodeBias frqCodeBias;
    524524
     
    526526  frqCodeBias._value = value;
    527527
    528   satCodeBias->_bias.push_back(frqCodeBias);
     528  satCodeBias._bias.push_back(frqCodeBias);
    529529  return;
    530530}
  • trunk/BNC/src/combination/bncbiassnx.h

    r10038 r10216  
    4949    _startTime = startTime;
    5050  }
    51   ~snxSatCodeBias() {_biasMap.clear();}
     51  ~snxSatCodeBias() {
     52    _biasMap.clear();
     53  }
    5254  bncTime               _startTime;
    5355  QMap<QString, double> _biasMap;
     
    5961  ~bncBiasSnx();
    6062  t_irc readFile(const QString& fileName);
    61   void determineSsrSatCodeBiases(QString prn, double aIF1, double aIF2, t_satCodeBias* satCodeBias);
    62   void setSsrSatCodeBias(std::string rnxType2ch, double value, t_satCodeBias* satCodeBias);
     63  void determineSsrSatCodeBiases(QString prn, double aIF1, double aIF2, t_satCodeBias& satCodeBias);
     64  void setSsrSatCodeBias(std::string rnxType2ch, double value, t_satCodeBias& satCodeBias);
    6365
    6466 private:
  • trunk/BNC/src/combination/bnccomb.cpp

    r10200 r10216  
    295295  }
    296296
    297 
    298297  // Maximal Residuum
    299298  // ----------------
     
    311310    delete icAC.next();
    312311  }
     312
    313313  delete _rtnetDecoder;
     314
    314315  if (_ssrCorr) {
    315316    delete _ssrCorr;
     317
    316318  }
    317319  delete _antex;
     
    327329    _buffer.remove(sys);
    328330  }
     331
    329332  while (!_epoClkData.empty()) {
    330333    delete _epoClkData.front();
    331334    _epoClkData.pop_front();
    332335  }
     336
    333337}
    334338
     
    388392    // Store the correction
    389393    // --------------------
    390     QMap<t_prn, t_orbCorr*>& storage = _orbCorrections[acName];
    391     if (storage[orbCorr._prn]) {
    392       delete  storage[orbCorr._prn];
    393     }
    394     storage[orbCorr._prn] = new t_orbCorr(orbCorr);
     394    QMap<t_prn, t_orbCorr>& storage = _orbCorrections[acName];
     395    storage[orbCorr._prn] = orbCorr;
    395396  }
    396397}
     
    427428    // Store the correction
    428429    // --------------------
    429     QMap<t_prn, t_satCodeBias*>& storage = _satCodeBiases[acName];
    430     if (storage[satCodeBias._prn]) {
    431       delete storage[satCodeBias._prn];
    432     }
    433     storage[satCodeBias._prn] = new t_satCodeBias(satCodeBias);
     430    QMap<t_prn, t_satCodeBias>& storage = _satCodeBiases[acName];
     431    storage[satCodeBias._prn] = satCodeBias;
    434432  }
    435433}
     
    623621  corr->_eph = lastEph;
    624622
    625   corr->_orbCorr->_xr    += dRAO;
    626   corr->_orbCorr->_dotXr += dDotRAO;
    627   corr->_clkCorr->_dClk  -= dC;
     623  corr->_orbCorr._xr    += dRAO;
     624  corr->_orbCorr._dotXr += dDotRAO;
     625  corr->_clkCorr._dClk  -= dC;
    628626}
    629627
     
    660658    newCorr->_acName       = acName;
    661659    newCorr->_weightFactor = weigthFactor;
    662     newCorr->_clkCorr = new t_clkCorr(*clkCorrVec[ii]);
     660    newCorr->_clkCorr      = t_clkCorr(static_cast<t_clkCorr>(*clkCorr));
    663661
    664662    // Check orbit correction
     
    669667    }
    670668    else {
    671       QMap<t_prn, t_orbCorr*>& storage = _orbCorrections[acName];
     669      QMap<t_prn, t_orbCorr>& storage = _orbCorrections[acName];
    672670      if (!storage.contains(clkCorr->_prn)  ||
    673            storage[clkCorr->_prn]->_iod != newCorr->_iod) {
     671           storage[clkCorr->_prn]._iod != newCorr->_iod) {
    674672        delete newCorr;
    675673        continue;
     
    686684    if (ephLast == 0) {
    687685#ifdef BNC_DEBUG_CMB
    688       emit newMessage("bncComb: eph not found for "  + prn.mid(0,3).toLatin1(), true);
     686      //emit newMessage("bncComb: eph not found for "  + prn.mid(0,3).toLatin1(), true);
    689687#endif
    690688      delete newCorr;
     
    695693             ephLast->checkState() == t_eph::unhealthy) {
    696694#ifdef BNC_DEBUG_CMB
    697       emit newMessage("bncComb: ephLast not ok (checkState: " +  ephLast->checkStateToString().toLatin1() + ") for "  + prn.mid(0,3).toLatin1(), true);
     695//      emit newMessage("bncComb: ephLast not ok (checkState: " +  ephLast->checkStateToString().toLatin1() + ") for "  + prn.mid(0,3).toLatin1(), true);
    698696#endif
    699697      delete newCorr;
     
    711709      else {
    712710#ifdef BNC_DEBUG_CMB
    713         emit newMessage("bncComb: eph not found for "  + prn.mid(0,3).toLatin1() +
    714                         QString(" with IOD %1").arg(newCorr->_iod).toLatin1(), true);
     711//        emit newMessage("bncComb: eph not found for "  + prn.mid(0,3).toLatin1() +
     712//                        QString(" with IOD %1").arg(newCorr->_iod).toLatin1(), true);
    715713#endif
    716714        delete newCorr;
     
    722720    // ----------------------------
    723721    if (_satCodeBiases.contains(acName)) {
    724       QMap<t_prn, t_satCodeBias*>& storage = _satCodeBiases[acName];
     722      QMap<t_prn, t_satCodeBias>& storage = _satCodeBiases[acName];
    725723      if (storage.contains(clkCorr->_prn)) {
    726724        newCorr->_satCodeBias = storage[clkCorr->_prn];
     
    731729          char attrib = cmbRefSig::toAttrib(sys, static_cast<cmbRefSig::type>(ii));
    732730          QString rnxType2ch = QString("%1%2").arg(frqNum).arg(attrib);
    733           for (unsigned ii = 0; ii < newCorr->_satCodeBias->_bias.size(); ii++) {
    734             const t_frqCodeBias& bias = newCorr->_satCodeBias->_bias[ii];
     731          for (unsigned ii = 0; ii < newCorr->_satCodeBias._bias.size(); ii++) {
     732            const t_frqCodeBias& bias = newCorr->_satCodeBias._bias[ii];
    735733            if (rnxType2ch.toStdString() == bias._rnxType2ch) {
    736734              codeBiasesRefSig[frqType] = bias._value;
     
    748746          }
    749747        }
    750         newCorr->_satCodeBias->_bias.clear();
     748        newCorr->_satCodeBias._bias.clear();
    751749      }
    752750    }
     
    876874            t_frequency::type fType1 = cmbRefSig::toFreq(sys, cmbRefSig::c1);
    877875            t_frequency::type fType2 = cmbRefSig::toFreq(sys, cmbRefSig::c2);
    878             if (resCorr[pp->prn]->_satCodeBias == 0) {
    879               resCorr[pp->prn]->_satCodeBias = new t_satCodeBias();
    880             }
    881876            _bsx->determineSsrSatCodeBiases(pp->prn.mid(0,3), codeCoeff[fType1], codeCoeff[fType2], resCorr[pp->prn]->_satCodeBias);
    882877          }
     
    895890    dumpResults(epoTime, resCorr);
    896891  }
    897   // Delete Data
    898   // -----------
     892
    899893  _buffer.remove(sys);
    900894}
     
    10441038
    10451039    // ORBIT
    1046     t_orbCorr orbCorr(static_cast<t_orbCorr>(*corr->_orbCorr));
     1040    t_orbCorr orbCorr(corr->_orbCorr);
    10471041    orbCorr._staID = "INTERNAL";
    10481042    orbCorrections.push_back(orbCorr);
    10491043
    10501044    // CLOCK
    1051     t_clkCorr clkCorr(static_cast<t_clkCorr>(*corr->_clkCorr));
     1045    t_clkCorr clkCorr(corr->_clkCorr);
    10521046    clkCorr._staID      = "INTERNAL";
    10531047    clkCorr._dClk       = corr->_dClkResult;
     
    11131107
    11141108    // CODE BIASES
    1115     if (corr->_satCodeBias) {
    1116       t_satCodeBias satCodeBias(static_cast<t_satCodeBias>(*corr->_satCodeBias));
     1109    if (corr->_satCodeBias._bias.size()) {
     1110      t_satCodeBias satCodeBias(corr->_satCodeBias);
    11171111      satCodeBias._staID = "INTERNAL";
    11181112      satCodeBiasList.push_back(satCodeBias);
     
    11911185    }
    11921186
    1193     ll(iObs) = (corr->_clkCorr->_dClk * t_CST::c - corr->_satCodeBiasIF) - DotProduct(AA.Row(iObs), x0);
     1187    ll(iObs) = (corr->_clkCorr._dClk * t_CST::c - corr->_satCodeBiasIF) - DotProduct(AA.Row(iObs), x0);
    11941188
    11951189    PP(iObs, iObs) *= 1.0 / (corr->_weightFactor * corr->_weightFactor);
     
    14481442      if (meanRao.find(prn) == meanRao.end()) {
    14491443        meanRao[prn].ReSize(4);
    1450         meanRao[prn].Rows(1,3) = corr->_orbCorr->_xr;
     1444        meanRao[prn].Rows(1,3) = corr->_orbCorr._xr;
    14511445        meanRao[prn](4)        = 1;
    14521446      }
    14531447      else {
    1454         meanRao[prn].Rows(1,3) += corr->_orbCorr->_xr;
     1448        meanRao[prn].Rows(1,3) += corr->_orbCorr._xr;
    14551449        meanRao[prn](4)        += 1;
    14561450      }
     
    14741468        meanRao[prn](4) = 0;
    14751469      }
    1476       corr->_diffRao = corr->_orbCorr->_xr - meanRao[prn].Rows(1,3);
     1470      corr->_diffRao = corr->_orbCorr._xr - meanRao[prn].Rows(1,3);
    14771471      if (maxDiff.find(prn) == maxDiff.end()) {
    14781472        maxDiff[prn] = corr;
  • trunk/BNC/src/combination/bnccomb.h

    r10116 r10216  
    9999    cmbCorr() {
    100100      _eph                        = 0;
    101       _orbCorr                    = 0;
    102       _clkCorr                    = 0;
    103       _satCodeBias                = 0;
    104101      _iod                        = 0;
    105102      _dClkResult                 = 0.0;
     
    112109    unsigned long  _iod;
    113110    t_eph*         _eph;
    114     t_orbCorr*      _orbCorr;
    115     t_clkCorr*      _clkCorr;
    116     t_satCodeBias* _satCodeBias;
     111    t_orbCorr      _orbCorr;
     112    t_clkCorr      _clkCorr;
     113    t_satCodeBias  _satCodeBias;
    117114    QString        _acName;
    118115    double         _satCodeBiasIF;
     
    248245  bncTime                                    _lastClkCorrTime;
    249246  bncTime                                    _resTime;
    250   QMap<char, QVector<cmbParam*>>             _params;
    251247  QMap<char, cmbEpoch>                       _buffer;
    252248  bncRtnetDecoder*                           _rtnetDecoder;
     
    256252  bncBiasSnx*                                _bsx;
    257253  double                                     _MAXRES;
     254  e_method                                   _method;
     255  int                                        _cmbSampl;
     256  int                                        _ms;
    258257  QMap<char, QString>                        _masterOrbitAC;
    259258  QMap<char, unsigned>                       _masterMissingEpochs;
    260259  QMap<char, bool>                           _masterIsAPC;
    261   e_method                                   _method;
    262   int                                        _cmbSampl;
    263   int                                        _ms;
    264260  QString                                    _cmbRefAttributes;
    265   QMap<QString, QMap<t_prn, t_orbCorr*> >     _orbCorrections;
    266   QMap<QString, QMap<t_prn, t_satCodeBias*> > _satCodeBiases;
     261  QMap<char, QVector<cmbParam*>>              _params;
     262  QMap<QString, QMap<t_prn, t_orbCorr> >     _orbCorrections;
     263  QMap<QString, QMap<t_prn, t_satCodeBias> > _satCodeBiases;
     264  QMap<char, unsigned>                       _cmbSysPrn;
    267265  bncEphUser                                 _ephUser;
    268266  SsrCorr*                                   _ssrCorr;
    269   QMap<char, unsigned>                       _cmbSysPrn;
    270267  bool                                       _useGps;
    271268  bool                                       _useGlo;
Note: See TracChangeset for help on using the changeset viewer.