Changeset 2576 in ntrip for trunk/BNC/bncpppclient.cpp


Ignore:
Timestamp:
Aug 23, 2010, 7:18:28 PM (14 years ago)
Author:
mervart
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNC/bncpppclient.cpp

    r2575 r2576  
    251251  if (_eph.contains(prn)) {
    252252    t_ephGPS* eLast = static_cast<t_ephGPS*>(_eph.value(prn)->last);
    253     t_ephGPS* ePrev = static_cast<t_ephGPS*>(_eph.value(prn)->prev);
    254253    if ( (eLast->GPSweek() <  gpseph.GPSweek) ||
    255254         (eLast->GPSweek() == gpseph.GPSweek && 
    256255          eLast->TOC()     <  gpseph.TOC) ) {
    257       delete ePrev;
    258       ePrev = new t_ephGPS(*eLast); 
    259       eLast->set(&gpseph);
     256      delete static_cast<t_ephGPS*>(_eph.value(prn)->prev);
     257      _eph.value(prn)->prev = _eph.value(prn)->last;
     258      _eph.value(prn)->last = new t_ephGPS();
     259      static_cast<t_ephGPS*>(_eph.value(prn)->last)->set(&gpseph);
    260260    }
    261261  }
     
    280280    updatetime(&ww, &tow, gloeph.tb*1000, 0);  // Moscow -> GPS
    281281    t_ephGlo* eLast = static_cast<t_ephGlo*>(_eph.value(prn)->last);
    282     t_ephGlo* ePrev = static_cast<t_ephGlo*>(_eph.value(prn)->prev);
    283282    if (eLast->GPSweek() < ww ||
    284283        (eLast->GPSweek()  == ww &&  eLast->GPSweeks() <  tow)) { 
    285       delete ePrev;
    286       ePrev = new t_ephGlo(*eLast); 
    287       eLast->set(&gloeph);
     284      delete static_cast<t_ephGlo*>(_eph.value(prn)->prev);
     285      _eph.value(prn)->prev = _eph.value(prn)->last;
     286      _eph.value(prn)->last = new t_ephGlo();
     287      static_cast<t_ephGlo*>(_eph.value(prn)->last)->set(&gloeph);
    288288    }
    289289  }
     
    431431                              ColumnVector& xc, ColumnVector& vv) {
    432432
    433   const double MAXAGE        = 120.0;
     433  const double MAXAGE = 120.0;
    434434
    435435  if (_eph.contains(prn)) {
    436     t_eph* ee = _eph.value(prn)->last;
    437     ee->position(tt.gpsw(), tt.gpssec(), xc.data(), vv.data());
    438436
    439437    if (_pppMode) {
    440438      if (_corr.contains(prn)) {
    441439        t_corr* cc = _corr.value(prn);
    442         if (ee->IOD() == cc->iod && (tt - cc->tt) < MAXAGE) {
    443           applyCorr(tt, cc, xc, vv);
    444           return success;
    445         }
    446       }
    447       return failure;
    448     }
    449    
    450     return success;
     440        if (tt - cc->tt < MAXAGE) {
     441          t_eph*  eLast = _eph.value(prn)->last;
     442          t_eph*  ePrev = _eph.value(prn)->prev;
     443          if      (eLast && eLast->IOD() == cc->iod) {
     444            eLast->position(tt.gpsw(), tt.gpssec(), xc.data(), vv.data());
     445            applyCorr(tt, cc, xc, vv);
     446            return success;
     447          }
     448          else if (ePrev && ePrev->IOD() == cc->iod) {
     449            ePrev->position(tt.gpsw(), tt.gpssec(), xc.data(), vv.data());
     450            applyCorr(tt, cc, xc, vv);
     451            return success;
     452          }
     453        }
     454      }
     455    }
     456
     457    else {
     458      t_eph* ee = _eph.value(prn)->last;
     459      ee->position(tt.gpsw(), tt.gpssec(), xc.data(), vv.data());
     460      return success;
     461    }
    451462  }
    452463
Note: See TracChangeset for help on using the changeset viewer.