Index: GPSS/hassDecoder.cpp
===================================================================
82c82,91
<     //// beg test
---
>     t_eph* eph = 0;
>     if (_eph.contains(prn)) {
>       if      (_eph.value(prn)->last && _eph.value(prn)->last->IOD() == IOD) {
>         eph = _eph.value(prn)->last;
>       }
>       else if (_eph.value(prn)->prev && _eph.value(prn)->prev->IOD() == IOD) {
>         eph = _eph.value(prn)->prev;
>       }
>     }
>     if (!eph) {
84,96c93
<     //// end test
<     ////  t_eph* eph = 0;
<     ////  if (_eph.contains(prn)) {
<     ////    if      (_eph.value(prn)->last && _eph.value(prn)->last->IOD() == IOD) {
<     ////      eph = _eph.value(prn)->last;
<     ////    }
<     ////    else if (_eph.value(prn)->prev && _eph.value(prn)->prev->IOD() == IOD) {
<     ////      eph = _eph.value(prn)->prev;
<     ////    }
<     ////  }
<     ////  if (!eph) {
<     ////    continue;
<     ////  }
---
>     }
100c97
<     ////  eph->position(tt.gpsw(), tt.gpssec(), xc.data(), vv.data());
---
>     eph->position(tt.gpsw(), tt.gpssec(), xc.data(), vv.data());
Index: RTCM3/RTCM3coDecoder.h
===================================================================
32a33
> #include "bncephuser.h"
39c40
< class RTCM3coDecoder : public QObject, public GPSDecoder {
---
> class RTCM3coDecoder : public bncEphUser, public GPSDecoder {
Index: RTCM/RTCM2Decoder.h
===================================================================
36a37
> #include "bncephuser.h"
38c39
< class RTCM2Decoder: public GPSDecoder {
---
> class RTCM2Decoder: public bncEphUser, public GPSDecoder {
45,47d45
<     bool  storeEph(const gpsephemeris& gpseph, std::string& storedPRN, std::vector<int>& IODs);
<     bool  storeEph(const t_ephGPS&     gpseph, std::string& storedPRN, std::vector<int>& IODs);
< 
60,121d57
<     class t_ephList {
<     public:
<       t_ephList() {}
<       
<       ~t_ephList() {
<         for (std::list<t_eph*>::iterator ii = _eph.begin(); ii != _eph.end(); ii++) {
<           delete  (*ii);
<         }
<       }
< 
<       bool store(t_eph* eph) {
<         if ( _eph.size() == 0 ) {
<           _eph.push_back(eph);
<           return true;
<         }
<           
<         std::list<t_eph*>::iterator ii = _eph.begin();
<         while (ii != _eph.end()) {
<           if ( eph->IOD() == (*ii)->IOD() ) {
<             return false;
<           }
<           if ( ! eph->isNewerThan(*ii) ) {
<             break;
<           }
<           ++ii;
<         }
< 
<         if ( ii == _eph.begin() && _eph.size() == MAXSIZE) {
<           return false;
<         }
< 
<         _eph.insert(ii, eph);
< 
<         while ( _eph.size() > MAXSIZE ) {
<           delete _eph.front();
<           _eph.pop_front();
<         }
< 
<         return true;
<       }
<       
<       const t_eph* getEph(int IOD) const {
<         for (std::list<t_eph*>::const_iterator ii = _eph.begin(); ii != _eph.end(); ii++) {
<           if ( (*ii)->IOD() == IOD ) {
<             return (*ii);
<           }
<         }
<         return 0;
<       }
< 
<       void getIODs(std::vector<int>& IODs) const {
<         IODs.clear();
<         for (std::list<t_eph*>::const_iterator ii = _eph.begin(); ii != _eph.end(); ii++) {
<           IODs.push_back((*ii)->IOD());
<         }
<       }
< 
<       static const unsigned MAXSIZE = 5;
< 
<       std::list<t_eph*> _eph;
<     };
< 
138,140d73
<     std::map<std::string, t_ephList*> _ephList;
< 
<     typedef std::map<std::string, t_ephList*> t_listMap;
Index: RTCM/RTCM2Decoder.cpp
===================================================================
67,69d66
<   for (t_listMap::iterator ii = _ephList.begin(); ii != _ephList.end(); ii++) {
<     delete ii->second;
<   }
224,257d220
< 
< 
< bool RTCM2Decoder::storeEph(const gpsephemeris& gpseph, string& storedPRN, vector<int>& IODs) {
<   t_ephGPS eph; eph.set(&gpseph);
< 
<   return storeEph(eph, storedPRN, IODs);
< }
< 
< 
< bool RTCM2Decoder::storeEph(const t_ephGPS& gpseph, string& storedPRN, vector<int>& IODs) {
<   t_ephGPS* eph = new t_ephGPS(gpseph);
< 
<   string prn = eph->prn().toAscii().data();
< 
<   t_listMap::iterator ip = _ephList.find(prn);
<   if (ip == _ephList.end() ) {
<     ip = _ephList.insert(pair<string, t_ephList*>(prn, new t_ephList)).first;
<   }
<   t_ephList* ephList = ip->second;
< 
<   bool stored = ephList->store(eph);
< 
<   if ( stored ) {
<     storedPRN = string(eph->prn().toAscii().data());
<     ephList->getIODs(IODs);
<     return true;
<   }
< 
<   delete eph;
< 
<   return false;
< }
<   
<   
299a263,269
>     QString prn;
>     if (corr->PRN < 200) {
>       prn = 'G' + QString("%1").arg(corr->PRN, 2, 10, QChar('0'));
>     }
>     else {
>       prn = 'R' + QString("%1").arg(corr->PRN - 200, 2, 10, QChar('0'));
>     }
301,308c271
<     ostringstream oPRN; oPRN.fill('0');
< 
<     oPRN <<            (corr->PRN < 200 ? 'G'       : 'R')
< 	 << setw(2) << (corr->PRN < 200 ? corr->PRN : corr->PRN - 200);
< 
<     string PRN(oPRN.str());
< 
<     t_listMap::const_iterator ieph = _ephList.find(PRN);
---
>     const t_ephPair* ePair = ephPair(prn); 
358,359c321,327
<       if ( ieph != _ephList.end() ) {
< 	eph = ieph->second->getEph(IODcorr);
---
>       if (ePair) {
>         if      (ePair->last && ePair->last->IOD() == IODcorr) {
>           eph = ePair->last;
>         }
>         else if (ePair->prev && ePair->prev->IOD() == IODcorr) {
>           eph = ePair->prev;
>         }
433c401
<       errmsg.push_back("missing eph for " + PRN + " , IODs " + missingIODstr.str());
---
>       errmsg.push_back("missing eph for " + string(prn.toAscii().data()) + " , IODs " + missingIODstr.str());