本文整理汇总了C++中SolarSystem::readBinaryFile方法的典型用法代码示例。如果您正苦于以下问题:C++ SolarSystem::readBinaryFile方法的具体用法?C++ SolarSystem::readBinaryFile怎么用?C++ SolarSystem::readBinaryFile使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SolarSystem
的用法示例。
在下文中一共展示了SolarSystem::readBinaryFile方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
//.........这里部分代码省略.........
}
if(dataFilenames.size() == 0) {
LOG(ERROR) << "Must specify data file name(s)";
ok = false;
}
if(outputFilename.empty()) {
LOG(ERROR) << "Must specify an output file name";
ok = false;
}
if(!ok) return -1;
// set up the log file
if(!logFilename.empty()) {
// choose the log file
logstrm.open(logFilename.c_str(),ios_base::out);
ConfigureLOG::Stream() = &logstrm;
// if not the above, output is to stderr
cout << Title << endl;
cout << "Output logged in file " << logFilename << endl;
}
// set the maximum level to be logged
if(debug)
ConfigureLOG::ReportingLevel() = ConfigureLOG::FromString("DEBUG");
else if(verbose)
ConfigureLOG::ReportingLevel() = ConfigureLOG::FromString("VERBOSE");
else
ConfigureLOG::ReportingLevel() = ConfigureLOG::FromString("INFO");
// = any of ERROR,WARNING,INFO,DEBUG,DEBUGn (n=1,2,3,4,5,6,7)
//cout << "Reporting in main is "
// << ConfigureLOG::ToString(ConfigureLOG::ReportingLevel()) << endl;
ConfigureLOG::ReportLevels() = ConfigureLOG::ReportTimeTags() = true;
// display title in log file
LOG(INFO) << Title;
// read header file
eph.readASCIIheader(headerFilename);
LOG(VERBOSE) << "Finished reading ASCII header " << headerFilename;
LOG(INFO) << "Ephemeris number from header is " << eph.JPLNumber();
// read the data files
eph.readASCIIdata(dataFilenames);
for(j=0; j<dataFilenames.size(); j++)
LOG(VERBOSE) << "Finished reading ASCII data " << dataFilenames[j];
LOG(INFO) << "Ephemeris number from data is " << eph.JPLNumber();
// dump to a file
LOG(INFO) << "Dump ASCII header to csse.header.asc";
ofstream ofs;
ofs.open("csse.header.asc",ios_base::out);
eph.writeASCIIheader(ofs);
ofs.close();
LOG(INFO) << "Dump ASCII data to csse.data.asc";
ofs.open("csse.data.asc",ios_base::out);
eph.writeASCIIdata(ofs);
ofs.close();
// write the whole thing out to a binary file
LOG(INFO) << "Write to binary file " << outputFilename;
eph.writeBinaryFile(outputFilename);
LOG(INFO) << "Finished writing binary file.";
// read it back in
LOG(INFO) << "Read from binary file " << outputFilename;
eph.readBinaryFile(outputFilename);
LOG(INFO) << "Finished reading binary file " << outputFilename;
// dump to a file
LOG(INFO) << "Dump ASCII header to csse.header.bin.asc";
ofs.open("csse.header.bin.asc",ios_base::out);
eph.writeASCIIheader(ofs);
ofs.close();
LOG(INFO) << "Dump ASCII data to csse.data.bin.asc";
ofs.open("csse.data.bin.asc",ios_base::out);
eph.writeASCIIdata(ofs);
ofs.close();
LOG(INFO) << "Now compare the outputs by differencing";
LOG(INFO) << " Try 'diff csse.data.asc csse.data.bin.asc'";
LOG(INFO) << " and 'diff csse.data.asc csse.data.bin.asc'";
// compute run time
totaltime = clock()-totaltime;
LOG(INFO) << PrgmName << " timing: " << fixed << setprecision(9)
<< double(totaltime)/double(CLOCKS_PER_SEC) << " seconds.";
//if(LOGstrm != cout) cout << PrgmName << " timing: " << fixed << setprecision(9)
// << double(totaltime)/double(CLOCKS_PER_SEC) << " seconds." << endl;
return iret;
}
catch(Exception& e) {
LOG(ERROR) << "GPSTk Exception : " << e.what();
}
catch (...) {
LOG(ERROR) << "Unknown error in " << PrgmName << ". Abort." << endl;
}
return -1;
} // end main()