void YumaData::reallyGetRecord(FFStream& ffs) throw(std::exception, FFStreamError, gpstk::StringUtils::StringException) { YumaStream& strm = dynamic_cast<YumaStream&>(ffs); string line; // We don't need first line as we will get all the information from the others strm.formattedGetLine(line, true); //Second Line - PRN strm.formattedGetLine(line, true); stripLeading( line, sID ); PRN = asInt(line); //Third Line - Satellite Health strm.formattedGetLine(line, true); stripLeading( line, sHlth ); SV_health = asInt(line); //Fourth Line - Eccentricity strm.formattedGetLine(line, true); stripLeading( line, sEcc ); ecc = asDouble(line); //Fifth Line - Time of Applicability strm.formattedGetLine(line, true); stripLeading( line, sTOA ); double dToa = asDouble(line); Toa = (long) dToa; //Sixth Line - Orbital Inclination strm.formattedGetLine(line, true); stripLeading( line, sOrbI ); double i_total = asDouble(line); i_offset = i_total - 54.0 * (gpstk::PI / 180.0); //Seventh Line - Rate of Right Ascen strm.formattedGetLine(line, true); stripLeading( line, sRRA ); OMEGAdot = asDouble(line); //Eigth Line - SqrtA strm.formattedGetLine(line, true); stripLeading( line, sSqrA ); Ahalf = asDouble(line); //Ninth Line - Right Ascen at Week strm.formattedGetLine(line, true); stripLeading( line, sRtAs ); OMEGA0 = asDouble(line); //Tenth Line - Argument of Perigee strm.formattedGetLine(line, true); stripLeading( line, sArgP ); w = asDouble(line); //Eleventh Line - Mean Anomaly strm.formattedGetLine(line, true); stripLeading( line, sMnAn ); M0 = asDouble(line); //Twelfth Line - Af0 strm.formattedGetLine(line, true); stripLeading( line, sAf0 ); AF0 = asDouble(line); //Thirteenth Line - Af1 strm.formattedGetLine(line, true); stripLeading( line, sAf1 ); AF1 = asDouble(line); //Fourteenth Line - week strm.formattedGetLine(line, true); stripLeading( line, sweek ); int epoch_week = asInt(line); week = epoch_week + 1024; // Need a way to set epoch Do we?? xmit_time = 0; strm.formattedGetLine(line,true); } // end of reallyGetRecord()
void FileSpec::init(const string& fileSpec) throw(FileSpecException) { try { fileSpecList.clear(); fileSpecString.clear(); fileSpecString = fileSpec; // holds the offset for where we would be in the real file // name string::size_type offset = 0; // copy the string so we can mess with it string fs(fileSpec); // bit by bit, parse out the string into FileSpecElements, // stripping out the used parts as we go while (!fs.empty()) { string atom; // if fs[0] == '%', then stop to parse. also stop at // the end of the string string::size_type pos = fs.find('%'); atom = fs.substr(0,pos); fs.erase(0,pos); // if it's at the end of the string... // make a FileSpecElement of any remaining // characters and return (fall through the while loop) if (fs.empty()) { if (!atom.empty()) { FileSpecElement fse(atom.size(), offset, fixed, atom); fileSpecList.push_back(fse); } } // found a '%' so parse out this little bit of a file spec, // but make sure to add atom to the FileSpec (if there is any) else { if (!atom.empty()) { FileSpecElement fse(atom.size(), offset, fixed, atom); fileSpecList.push_back(fse); offset += atom.size(); atom.erase(atom.begin(), atom.end()); } // erase the '%' // also make sure that atom holds the string that // makes up this element. atom += fs[0]; fs.erase(0,1); // get any integers that come before the letter we're lookin // for, then erase them int numChs = asInt(fs); if (numChs == 0) numChs = 1; if (fs[0] == '0') atom += '0'; stripLeading(fs, "0"); stripLeading(fs, asString(numChs)); atom += asString(numChs); // get the file spec type and erase that part of the string FileSpecType fst = convertFileSpecType(fs.substr(0,1)); atom += fs[0]; // super special case - %Y -> %4y FIX shouldn't this be <4? if ((fs.substr(0,1) == string("Y")) && (numChs != 4)) numChs = 4; fs.erase(0,1); FileSpecElement fse(numChs, offset, fst, atom); fileSpecList.push_back(fse); offset += numChs; } } // while !fs.empty() } catch(FileSpecException& e) { e.addText("Check your file spec for errors: " + fileSpec); GPSTK_RETHROW(e); } catch(StringException& e) { FileSpecException fse(e); fse.addText("String exception: Check the file spec for errors: " + fileSpec); GPSTK_THROW(fse); } catch(std::exception& e) { FileSpecException fse("std::exception: " + string(e.what())); fse.addText("Check the file spec for errors: " + fileSpec); GPSTK_THROW(fse); } catch(...) { FileSpecException fse("Unknown exception: Check the file spec for errors: " + fileSpec); GPSTK_THROW(fse); } }