Changeset 6867 in ntrip for trunk/BNC/src/rinex/reqcanalyze.cpp


Ignore:
Timestamp:
Jun 1, 2015, 12:38:27 PM (9 years ago)
Author:
stuerze
Message:

minor changes to prevent crash, if no logfile is specified for qc

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNC/src/rinex/reqcanalyze.cpp

    r6817 r6867  
    111111  // Open Log File
    112112  // -------------
    113   _logFile = new QFile(_logFileName);
    114   if (_logFile->open(QIODevice::WriteOnly | QIODevice::Text)) {
    115     _log = new QTextStream();
    116     _log->setDevice(_logFile);
    117   }
    118   *_log << "QC Format Version : " << QString("%1").arg(QC_FORMAT_VERSION,3,'f',1)  << endl << endl;
     113  if (!_logFileName.isEmpty()) {
     114    _logFile = new QFile(_logFileName);
     115    if (_logFile->open(QIODevice::WriteOnly | QIODevice::Text)) {
     116      _log = new QTextStream();
     117      _log->setDevice(_logFile);
     118    }
     119  }
     120
     121  if (_log) {
     122    *_log << "QC Format Version : " << QString("%1").arg(QC_FORMAT_VERSION,3,'f',1)  << endl << endl;
     123  }
    119124
    120125  // Check Ephemerides
     
    816821    systemMap[prn.system()].push_back(&qcSatSum);
    817822  }
    818 
    819823  *_log << "Navigation Systems: " << systemMap.size() << "   ";
     824
    820825  QMapIterator<QChar, QVector<const t_qcSatSum*> > itSys(systemMap);
    821826  while (itSys.hasNext()) {
     
    845850          << prefixSys << "Satellites: " << qcSatVec.size() << endl
    846851          << prefixSys << "Signals   : " << frqMap.size() << "   ";
    847     QMapIterator<QString, QVector<const t_qcFrqSum*> > itFrq(frqMap); 
     852    QMapIterator<QString, QVector<const t_qcFrqSum*> > itFrq(frqMap);
    848853    while (itFrq.hasNext()) {
    849854      itFrq.next();
     
    9961001    }
    9971002  }
    998 
    999   *_log << "Navigation File(s): " << navFileName                                   << endl;
    1000 
     1003  if (_log) {
     1004    *_log << "Navigation File(s): " << navFileName                                   << endl;
     1005  }
    10011006  QStringListIterator it(_navFileNames);
    10021007  while (it.hasNext()) {
     
    10161021      }
    10171022    }
    1018     *_log << "Ephemeris         : " << numOK << " OK   " << numBad << " BAD" << endl;
     1023    if (_log) {
     1024      *_log << "Ephemeris         : " << numOK << " OK   " << numBad << " BAD" << endl;
     1025    }
    10191026    if (numBad > 0) {
    10201027      for (unsigned ii = 0; ii < rnxNavFile.ephs().size(); ii++) {
     
    10221029        if (eph->checkState() == t_eph::bad) {
    10231030          QFileInfo navFi(fileName);
    1024           *_log << "  Bad Ephemeris   : " << navFi.fileName() << ' '
    1025                 << eph->toString(3.0).left(24) << endl;
    1026         }
    1027       }
    1028     }
    1029   }
    1030 
    1031   *_log << endl;
    1032 }
     1031          if (_log) {
     1032            *_log << "  Bad Ephemeris   : " << navFi.fileName() << ' '
     1033                  << eph->toString(3.0).left(24) << endl;
     1034          }
     1035        }
     1036      }
     1037    }
     1038  }
     1039  if (_log) {
     1040    *_log << endl;
     1041  }
     1042}
Note: See TracChangeset for help on using the changeset viewer.