// Dump the overhead information to the given output stream. // @throw Invalid Request if the required data has not been stored. void GPSEphemeris::dumpHeader(std::ostream& os) const { try { // copy from OrbitEph::dumpHeader() ... if(!dataLoadedFlag) GPSTK_THROW(InvalidRequest("Data not loaded")); os << "****************************************************************" << "************" << endl << "Broadcast Orbit Ephemeris of class " << getName() << endl; os << "Satellite: " << SatID::convertSatelliteSystemToString(satID.system) << " " << setfill('0') << setw(2) << satID.id << setfill(' '); // ... and add this for GPS os << " SVN "; SVNumXRef svNumXRef; try { os << svNumXRef.getNAVSTAR(satID.id, ctToe ); } catch(NoNAVSTARNumberFound) { os << "Unknown"; } os << endl; } catch(Exception& e) { GPSTK_RETHROW(e); } }
void CNavDataElement::dumpHeader(ostream& s) const throw( InvalidRequest ) { s << "****************************************************************" << "************" << endl << "Broadcast Data (Engineering Units) - " << getNameLong(); s << endl; SVNumXRef svNumXRef; int NAVSTARNum = 0; s << endl; s << "PRN : " << setw(2) << satID.id << " / " << "SVN : " << setw(2); try { NAVSTARNum = svNumXRef.getNAVSTAR(satID.id, ctXmit ); s << NAVSTARNum << " "; } catch(NoNAVSTARNumberFound) { s << "XX"; } s << endl << endl; const ios::fmtflags oldFlags = s.flags(); s.setf(ios::fixed, ios::floatfield); s.setf(ios::right, ios::adjustfield); s.setf(ios::uppercase); s.precision(0); s.fill(' '); s << endl; s << " TIMES OF INTEREST" << endl << endl; s << " Week(10bt) SOW DOW UTD SOD" << " MM/DD/YYYY HH:MM:SS\n"; s << "Transmit Time:"; timeDisplay(s, ctXmit); s << endl; // Special case for those data elements that do not possess an // epoch time. if (ctEpoch>CommonTime::BEGINNING_OF_TIME) { s << "Epoch Time: "; timeDisplay(s, ctEpoch); s << endl; } s.flags(oldFlags); }
void OrbElemRinex :: dumpTerse(ostream& s) const throw(InvalidRequest ) { // Check if the subframes have been loaded before attempting // to dump them. if (!dataLoaded()) { InvalidRequest exc("No data in the object"); GPSTK_THROW(exc); } ios::fmtflags oldFlags = s.flags(); s.setf(ios::fixed, ios::floatfield); s.setf(ios::right, ios::adjustfield); s.setf(ios::uppercase); s.precision(0); s.fill(' '); SVNumXRef svNumXRef; int NAVSTARNum = 0; try { NAVSTARNum = svNumXRef.getNAVSTAR(satID.id, ctToe ); s << setw(2) << " " << NAVSTARNum << " "; } catch(NoNAVSTARNumberFound) { s << " XX "; } s << setw(2) << satID.id << " ! "; string tform = "%3j %02H:%02M:%02S"; s << printTime(beginValid, tform) << " ! "; s << printTime(ctToe, tform) << " ! "; s << printTime(endValid, tform) << " ! "; s << setw(4) << setprecision(1) << getAccuracy() << " ! "; s << "0x" << setfill('0') << hex << setw(3) << IODC << " ! "; s << "0x" << setfill('0') << setw(2) << health; s << setfill(' ') << dec; s << " " << setw(2) << health << " ! "; s << endl; s.flags(oldFlags); } // end of dumpTerse()
int main() { TUDEF("SVNumXRef", ""); SVNumXRef svNumXRef; //Test for overlap in SVN/PRN active time range(s) //output 0 for pass; output 1 for any fail testFramework.changeSourceMethod(" isConsistent"); TUASSERTE(bool, true, svNumXRef.isConsistent()); //Test that correct SVN availablility is given at specific time, given PRN //first statement intended to be true; second intended to be false testFramework.changeSourceMethod(" NAVSTARIDAvailable"); TUASSERTE(bool, true, svNumXRef.NAVSTARIDAvailable(8, CivilTime(2015, 10, 1, 0, 0, 0.0, TimeSystem::GPS))); TUASSERTE(bool, false, svNumXRef.NAVSTARIDAvailable(8, CivilTime(2015, 7, 14, 0, 0, 0.0, TimeSystem::GPS))); //Test that correct SVN is returned, given PRN and active time range //try-catch ensures that an exception is thrown for a nonexistent PRN testFramework.changeSourceMethod(" getNAVSTAR"); TUASSERTE(int, 72, svNumXRef.getNAVSTAR(8, CivilTime(2015, 10, 1, 0, 0, 0.0, TimeSystem::GPS))); try { svNumXRef.getNAVSTAR(0, CivilTime(2015, 10, 1, 0, 0, 0.0, TimeSystem::GPS)); TUFAIL("getNAVSTAR(0) should have failed"); } catch( NoNAVSTARNumberFound ) { TUPASS(""); } //Test that SV is correctly displayed as active, given SVN and active time range //first statement intended to be true; second intended to be false testFramework.changeSourceMethod(" NAVSTARIDActive"); TUASSERTE(bool, true, svNumXRef.NAVSTARIDActive(72, CivilTime(2015, 10, 1, 0, 0, 0.0, TimeSystem::GPS))); TUASSERTE(bool, false, svNumXRef.NAVSTARIDActive(72, CivilTime(2015, 7, 14, 0, 0, 0.0, TimeSystem::GPS))); //Test that exception is thrown if BlockType cannot be located for SVN input //try-catch ensures that an exception is thrown for a nonexistent SVN testFramework.changeSourceMethod(" getBlockType"); TUASSERTE(SVNumXRef::BlockType, SVNumXRef::IIF, svNumXRef.getBlockType(72)); try { svNumXRef.getBlockType(0); TUFAIL("getBlockType(0) should have failed"); } catch( NoNAVSTARNumberFound ) { TUPASS(""); } //Test string output for corresponding block type or unknown if not found testFramework.changeSourceMethod(" getBlockTypeString"); TUASSERTE(std::string, "Block IIF", svNumXRef.getBlockTypeString(72)); TUASSERTE(std::string, "unknown", svNumXRef.getBlockTypeString(0)); //Test that correct PRN is returned, given SVN and active time range testFramework.changeSourceMethod(" getPRNID"); TUASSERTE(int, 8, svNumXRef.getPRNID(72, CivilTime(2015, 10, 1, 0, 0, 0.0, TimeSystem::GPS))); try { svNumXRef.getPRNID(0, CivilTime(2015, 10, 1, 0, 0, 0.0, TimeSystem::GPS)); TUFAIL("getPRNID(0) did not fail"); } catch( NoNAVSTARNumberFound ) { TUPASS(""); } //Test that SV is correctly displayed as active, given PRN and active time range //first statement intended to be true; second intended to be falst testFramework.changeSourceMethod(" PRNIDAvailable"); TUASSERTE(bool, true, svNumXRef.PRNIDAvailable(72, CivilTime(2015, 10, 1, 0, 0, 0.0, TimeSystem::GPS))); TUASSERTE(bool, false, svNumXRef.PRNIDAvailable(72, CivilTime(2015, 7, 14, 0, 0, 0.0, TimeSystem::GPS))); //Test that SVN corresponds to an available block type //first statement intended to be true; second intended to be false testFramework.changeSourceMethod(" BlockTypeAvailable"); TUASSERTE(bool, true, svNumXRef.BlockTypeAvailable(72)); TUASSERTE(bool, false, svNumXRef.BlockTypeAvailable(0)); std::cout << "Total Failures for " << __FILE__ << ": " << testFramework.countFails() << std::endl; return testFramework.countFails(); }