void processEphemeris( gpstk::EngEphemeris engEph, gpstk::EphemerisPages ephPages ) { // Construct a BELogEntry and see if it already exists in the // map for the PRN. If it does, we already stored this one, // move on. If not, convert the information to Block 109 and // Block 9 and write it out. BELogEntry curBELog( engEph ); unsigned long key = curBELog.getKey(); pair<long,BELogEntry> qnode(key,curBELog); bool needToOutput = false; PrnBELogMap::iterator pmap = prnBEmap.find( engEph.getPRNID() ); // May need to add this PRN to the map. if (pmap==prnBEmap.end()) { pair<long,BELogEntry> qnode(key,curBELog); BELogMap blm; blm.insert(qnode); pair<int,BELogMap> pnode( (int) engEph.getPRNID(), blm); prnBEmap.insert( pnode ); needToOutput = true; } else { BELogMap& blmr = pmap->second; BELogMap::iterator iBLM = blmr.find( key ); if (iBLM==blmr.end()) { pair<long,BELogEntry> qnode(key,curBELog); blmr.insert(qnode); needToOutput = true; } else { BELogEntry& ble = iBLM->second; ble.increment(); } } if (needToOutput) { EphemerisPages::const_iterator MDPsf[4]; MDPsf[1] = ephPages.find(1); MDPsf[2] = ephPages.find(2); MDPsf[3] = ephPages.find(3); FICData109 new109( engEph.getPRNID(), MDPsf[1]->second.subframe, MDPsf[2]->second.subframe, MDPsf[3]->second.subframe ); FICData9 new9( new109, engEph ); FICOutput << new109; FICOutput << new9; } }
BELogEntry::BELogEntry( const gpstk::EngEphemeris ee ) { HOWSF1 = ee.getTransmitTime(); Toe = ee.getEpochTime(); PRN_ID = ee.getPRNID(); IODC = ee.getIODC(); count = 1; long shortweek = (long) ee.getFullWeek(); shortweek &= 0x0000001F; long sixteenSecCount = long (Toe.GPSsow() / 16.0); // The purpose of the key is to enable placing these objects // into SV-specific maps ordered by // Primary :week // Secondary :SOW // Tertiary: IODC // The latter (IODC) is actually only a part of the key so as to // enforce uniqueness key = shortweek << 26 | sixteenSecCount << 10 | IODC; }