Changeset 5133 in ntrip for trunk/BNC/src/bncephuser.cpp


Ignore:
Timestamp:
Apr 18, 2013, 5:15:00 PM (11 years ago)
Author:
mervart
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNC/src/bncephuser.cpp

    r5070 r5133  
    7777  QMutexLocker locker(&_mutex);
    7878
    79   QString prn = QString("G%1").arg(gpseph.satellite, 2, 10, QChar('0'));
     79  t_ephGPS* eNew = new t_ephGPS(); eNew->set(&gpseph);
     80
     81  const QString& prn = eNew->prn();
    8082
    8183  if (_eph.contains(prn)) {
    8284    t_ephGPS* eLast = static_cast<t_ephGPS*>(_eph.value(prn)->last);
    83     bncTime toc(gpseph.GPSweek, gpseph.TOC);
    84     if (eLast->TOC() < toc) {
    85       delete static_cast<t_ephGPS*>(_eph.value(prn)->prev);
     85    if (eNew->isNewerThan(eLast)) {
     86      delete _eph.value(prn)->prev;
    8687      _eph.value(prn)->prev = _eph.value(prn)->last;
    87       _eph.value(prn)->last = new t_ephGPS();
    88       static_cast<t_ephGPS*>(_eph.value(prn)->last)->set(&gpseph);
     88      _eph.value(prn)->last = eNew;
     89      ephBufferChanged();
     90    }
     91    else {
     92      delete eNew;
    8993    }
    9094  }
    9195  else {
    92     t_ephGPS* eLast = new t_ephGPS();
    93     eLast->set(&gpseph);
    94     _eph.insert(prn, new t_ephPair(eLast));
    95   }
    96   ephBufferChanged();
     96    _eph.insert(prn, new t_ephPair(eNew));
     97    ephBufferChanged();
     98  }
    9799}
    98100
     
    102104  QMutexLocker locker(&_mutex);
    103105
    104   QString prn = QString("R%1").arg(gloeph.almanac_number, 2, 10, QChar('0'));
     106  t_ephGlo* eNew = new t_ephGlo(); eNew->set(&gloeph);
     107
     108  const QString& prn = eNew->prn();
    105109
    106110  if (_eph.contains(prn)) {
    107     int ww  = gloeph.GPSWeek;
    108     int tow = gloeph.GPSTOW;
    109     updatetime(&ww, &tow, gloeph.tb*1000, 0);  // Moscow -> GPS
    110111    t_ephGlo* eLast = static_cast<t_ephGlo*>(_eph.value(prn)->last);
    111     bncTime toc(ww, tow);
    112     if (eLast->TOC() < toc) {
    113       t_ephGlo* ephGlo = new t_ephGlo();
    114       bool timeChanged;
    115       ephGlo->set(&gloeph, timeChanged);
    116       if (timeChanged) {
    117         delete ephGlo;
    118       }
    119       else {
    120         delete static_cast<t_ephGlo*>(_eph.value(prn)->prev);
    121         _eph.value(prn)->prev = _eph.value(prn)->last;
    122         _eph.value(prn)->last = ephGlo;
    123       }
     112    if (eNew->isNewerThan(eLast)) {
     113      delete _eph.value(prn)->prev;
     114      _eph.value(prn)->prev = _eph.value(prn)->last;
     115      _eph.value(prn)->last = eNew;
     116      ephBufferChanged();
     117    }
     118    else {
     119      delete eNew;
    124120    }
    125121  }
    126122  else {
    127     t_ephGlo* eLast = new t_ephGlo();
    128     bool timeChanged;
    129     eLast->set(&gloeph, timeChanged);
    130     if (timeChanged) {
    131       delete eLast;
    132     }
    133     else {
    134       _eph.insert(prn, new t_ephPair(eLast));
    135     }
    136   }
    137   ephBufferChanged();
     123    _eph.insert(prn, new t_ephPair(eNew));
     124    ephBufferChanged();
     125  }
    138126}
    139127
Note: See TracChangeset for help on using the changeset viewer.