Changeset 2711 in ntrip for trunk/BNC/bnccaster.cpp


Ignore:
Timestamp:
Nov 18, 2010, 1:38:51 PM (13 years ago)
Author:
mervart
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNC/bnccaster.cpp

    r2710 r2711  
    5555 public:
    5656
    57   t_oldObsInternal(const t_obs* obs) {
    58     strcpy(StatID, obs->StatID);
     57  t_oldObsInternal(const t_obs& obs) {
     58    strcpy(StatID, obs.StatID);
    5959    flags         = 0;
    60     satSys        = obs->satSys;
    61     satNum        = obs->satNum;
    62     slot          = obs->slotNum;
    63     GPSWeek       = obs->GPSWeek;
    64     GPSWeeks      = obs->GPSWeeks;
    65     C1            = obs->C1;
    66     C2            = obs->C2;
    67     P1            = obs->P1;
    68     P2            = obs->P2;
    69     L1            = obs->L1();
    70     L2            = obs->L2();
    71     slip_cnt_L1   = obs->slip_cnt_L1;
    72     slip_cnt_L2   = obs->slip_cnt_L2;
     60    satSys        = obs.satSys;
     61    satNum        = obs.satNum;
     62    slot          = obs.slotNum;
     63    GPSWeek       = obs.GPSWeek;
     64    GPSWeeks      = obs.GPSWeeks;
     65    C1            = obs.C1;
     66    C2            = obs.C2;
     67    P1            = obs.P1;
     68    P2            = obs.P2;
     69    L1            = obs.L1();
     70    L2            = obs.L2();
     71    slip_cnt_L1   = obs.slip_cnt_L1;
     72    slip_cnt_L2   = obs.slip_cnt_L2;
    7373    lock_timei_L1 = -1;
    7474    lock_timei_L2 = -1;
    75     S1            = obs->S1();
    76     S2            = obs->S2();
     75    S1            = obs.S1();
     76    S2            = obs.S2();
    7777    SNR1          = 0;
    7878    SNR2          = 0;
     
    171171  }
    172172
    173   _epochs = new QMultiMap<long, t_obs*>;
     173  _epochs = new QMultiMap<long, t_obs>;
    174174
    175175  _lastDumpSec   = 0;
     
    197197  delete _nmeaServer;
    198198  delete _nmeaSockets;
    199   if (_epochs) {
    200     QListIterator<t_obs*> it(_epochs->values());
    201     while (it.hasNext()) {
    202       delete it.next();
    203     }
    204     delete _epochs;
    205   }
     199  delete _epochs;
    206200}
    207201
    208202// New Observations
    209203////////////////////////////////////////////////////////////////////////////
    210 void bncCaster::newObs(const QByteArray staID, bool firstObs, t_obs* obs) {
     204void bncCaster::newObs(const QByteArray staID, bool firstObs, t_obs obs) {
    211205
    212206  QMutexLocker locker(&_mutex);
    213207
    214   obs->_status = t_obs::received;
    215 
    216   long iSec    = long(floor(obs->GPSWeeks+0.5));
    217   long newTime = obs->GPSWeek * 7*24*3600 + iSec;
     208  long iSec    = long(floor(obs.GPSWeeks+0.5));
     209  long newTime = obs.GPSWeek * 7*24*3600 + iSec;
    218210
    219211  // Rename the Station
    220212  // ------------------
    221   strncpy(obs->StatID, staID.constData(),sizeof(obs->StatID));
    222   obs->StatID[sizeof(obs->StatID)-1] = '\0';
    223        
     213  strncpy(obs.StatID, staID.constData(),sizeof(obs.StatID));
     214  obs.StatID[sizeof(obs.StatID)-1] = '\0';
     215
    224216  const char begObs[] = "BEGOBS";
    225217  const int begObsNBytes = sizeof(begObs) - 1;
     
    283275      }
    284276    }
    285     delete obs;
    286277    return;
    287278  }
     
    323314void bncCaster::addGetThread(bncGetThread* getThread, bool noNewThread) {
    324315
    325   ////  qRegisterMetaType<t_obs*>("p_obs");
     316  qRegisterMetaType<t_obs>("t_obs");
    326317  qRegisterMetaType<gpsephemeris>("gpsephemeris");
    327318  qRegisterMetaType<glonassephemeris>("glonassephemeris");
    328319
    329   connect(getThread, SIGNAL(newObs(QByteArray, bool, t_obs*)),
    330           this,      SLOT(newObs(QByteArray, bool, t_obs*))); /// Qt::DirectConnection);
     320  connect(getThread, SIGNAL(newObs(QByteArray, bool, t_obs)),
     321          this,      SLOT(newObs(QByteArray, bool, t_obs)));
    331322
    332323  connect(getThread, SIGNAL(getThreadFinished(QByteArray)),
     
    385376
    386377    bool first = true;
    387     QList<t_obs*> allObs = _epochs->values(sec);
    388 
    389     QListIterator<t_obs*> it(allObs);
     378    QList<t_obs> allObs = _epochs->values(sec);
     379
     380    QListIterator<t_obs> it(allObs);
    390381    while (it.hasNext()) {
    391       t_obs* obs = it.next();
     382      const t_obs& obs = it.next();
    392383
    393384      if (_samplingRate == 0 || sec % _samplingRate == 0) {
    394385
    395386        if (first) {
    396           QTime enomtime = QTime(0,0,0).addSecs(static_cast<int>(floor(obs->GPSWeeks+0.5)));
     387          QTime enomtime = QTime(0,0,0).addSecs(static_cast<int>(floor(obs.GPSWeeks+0.5)));
    397388//        emit( newMessage( QString("Epoch %1 dumped").arg(enomtime.toString("HH:mm:ss")).toAscii(), true) ); // weber
    398389        }
     
    404395          }
    405396
    406           *_out << obs->StatID << " " << obs->GPSWeek << " "; 
     397          *_out << obs.StatID << " " << obs.GPSWeek << " "; 
    407398          _out->setRealNumberPrecision(7);
    408            *_out << obs->GPSWeeks << " ";
     399           *_out << obs.GPSWeeks << " ";
    409400
    410401           *_out << bncRinex::rinexSatLine(obs, ' ', ' ', ' ').c_str()
     
    461452      }
    462453
    463       delete obs;
    464454      _epochs->remove(sec);
    465455      first = false;
Note: See TracChangeset for help on using the changeset viewer.