Changeset 1218 in ntrip for trunk/BNC/RTCM/RTCM2Decoder.h


Ignore:
Timestamp:
Nov 19, 2008, 2:56:05 PM (18 years ago)
Author:
mervart
Message:

Zdenek Lukes:
a) changed logic how the ephemerides are stored for decoding of message 20/21 RTCM 2.3
b) added some debugging output (enabled is macro DEBUG_RTCM2_2021 is defined)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNC/RTCM/RTCM2Decoder.h

    r1167 r1218  
    2727
    2828#include <map>
     29#include <vector>
     30#include <list>
    2931
    3032#include "GPSDecoder.h"
     
    3941    RTCM2Decoder(const std::string& ID);
    4042    virtual ~RTCM2Decoder();
    41     virtual t_irc Decode(char* buffer, int bufLen);
     43    virtual t_irc Decode(char* buffer, int bufLen, std::vector<std::string>& errmsg);
    4244
    43     void  storeEph(const gpsephemeris& gpseph);
    44     void  storeEph(const t_ephGPS&     gpseph);
     45    bool  storeEph(const gpsephemeris& gpseph, std::string& storedPRN, std::vector<int>& IODs);
     46    bool  storeEph(const t_ephGPS&     gpseph, std::string& storedPRN, std::vector<int>& IODs);
    4547
    4648    t_irc getStaCrd(double& xx, double& yy, double& zz);
    4749
    48     t_irc getStaCrd(double& xx, double& yy, double& zz,
     50    t_irc getStaCrd(double& xx,  double& yy,  double& zz,
    4951                    double& dx1, double& dy1, double& dz1,
    5052                    double& dx2, double& dy2, double& dz2);
     
    5658  private:
    5759
    58     class t_ephPair {
     60    class t_ephList {
    5961    public:
    60       t_ephPair() {
    61         eph    = 0;
    62         oldEph = 0;
     62      t_ephList() {}
     63     
     64      ~t_ephList() {
     65        for (std::list<t_eph*>::iterator ii = _eph.begin(); ii != _eph.end(); ii++) {
     66          delete  (*ii);
     67        }
     68      }
     69
     70      bool store(t_eph* eph) {
     71        if ( _eph.size() == 0 ) {
     72          _eph.push_back(eph);
     73          return true;
     74        }
     75         
     76        std::list<t_eph*>::iterator ii = _eph.begin();
     77        while (ii != _eph.end()) {
     78          if ( eph->IOD() == (*ii)->IOD() ) {
     79            return false;
     80          }
     81          if ( ! eph->isNewerThan(*ii) ) {
     82            break;
     83          }
     84          ++ii;
     85        }
     86
     87        if ( ii == _eph.begin() && _eph.size() == MAXSIZE) {
     88          return false;
     89        }
     90
     91        _eph.insert(ii, eph);
     92
     93        while ( _eph.size() > MAXSIZE ) {
     94          delete _eph.front();
     95          _eph.pop_front();
     96        }
     97
     98        return true;
    6399      }
    64100     
    65       ~t_ephPair() {
    66         delete eph;
    67         delete oldEph;
     101      const t_eph* getEph(int IOD) const {
     102        for (std::list<t_eph*>::const_iterator ii = _eph.begin(); ii != _eph.end(); ii++) {
     103          if ( (*ii)->IOD() == IOD ) {
     104            return (*ii);
     105          }
     106        }
     107        return 0;
    68108      }
    69      
    70       t_eph* eph;
    71       t_eph* oldEph;
     109
     110      void getIODs(std::vector<int>& IODs) const {
     111        IODs.clear();
     112        for (std::list<t_eph*>::const_iterator ii = _eph.begin(); ii != _eph.end(); ii++) {
     113          IODs.push_back((*ii)->IOD());
     114        }
     115      }
     116
     117      static const unsigned MAXSIZE = 3;
     118
     119      std::list<t_eph*> _eph;
    72120    };
    73121
    74     void translateCorr2Obs();
     122    void translateCorr2Obs(std::vector<std::string>& errmsg);
    75123
    76124    std::string            _ID;
     
    86134    rtcm2::RTCM2_22           _msg22;
    87135    rtcm2::RTCM2_2021         _msg2021;
    88     std::map<std::string, t_ephPair*> _ephPair;
     136    std::map<std::string, t_ephList*> _ephList;
    89137
    90     typedef std::map<std::string, t_ephPair*> t_pairMap;
     138    typedef std::map<std::string, t_ephList*> t_listMap;
    91139};
    92140
Note: See TracChangeset for help on using the changeset viewer.