当前位置: 首页>>代码示例>>C++>>正文


C++ SolarSystem::readASCIIheader方法代码示例

本文整理汇总了C++中SolarSystem::readASCIIheader方法的典型用法代码示例。如果您正苦于以下问题:C++ SolarSystem::readASCIIheader方法的具体用法?C++ SolarSystem::readASCIIheader怎么用?C++ SolarSystem::readASCIIheader使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SolarSystem的用法示例。


在下文中一共展示了SolarSystem::readASCIIheader方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: main

//------------------------------------------------------------------------------------
int main(int argc, char **argv)
{
try {
   clock_t totaltime;            // for timing
   totaltime = clock();

   // locals
   int i,iret=0;
   size_t j;
   CommonTime CurrEpoch = SystemTime();
   SolarSystem eph;

   // program name, title and version
   PrgmName = string("convertSSEph");
   Title = PrgmName + ", file conversion tool for JPL ephemeris, version "
      + Version + ", " + printTime(CurrEpoch,"Run %04Y/%02m/%02d at %02H:%02M:%02S");

   // default command line input
   bool ok=true;
   bool verbose=false,debug=false;
   string headerFilename,logFilename,outputFilename;
   vector<string> dataFilenames;

   // parse the command line input
   for(i=0; i<argc; i++) {
      string word = string(argv[i]);
      if(argc == 1 || word == "-h" || word == "--help") {
         cout << PrgmName
         << " reads a JPL planetary ephemeris in the form of an ASCII header file\n"
         << "and one or more ASCII data files and writes the data to a single "
         << "binary file\nfor use by other programs.\n"
         << "Note that on Windows, arguments with embedded commas must be quoted.\n"
         << " Usage: " << PrgmName << " [options]\n Options are:\n"
         << "   --log <file>         name of optional log file\n"
         << "   --header <file>      name of ASCII JPL header file, e.g. header.403\n"
         << "   --data <file[,file]> names of ASCII JPL data files, e.g. ascp2000.403\n"
         << "   --output <file>      name of output binary file\n"
         << "   --verbose            print info to the log file.\n"
         << "   --debug              print debugging info to the log file.\n"
         << "   --help               print this and quit.\n"
         ;
         cout << endl;
         return 0;
      }
      else if(i == 0) continue;
      else if(word == "-d" || word == "--debug") debug = true;
      else if(word == "-v" || word == "--verbose") verbose = true;
      else if(word == "--log") logFilename = string(argv[++i]);
      else if(word == "--header") headerFilename = string(argv[++i]);
      else if(word == "--data") {
         string field = string(argv[++i]);
         while( !(word = stripFirstWord(field,',')).empty())
            dataFilenames.push_back(word);
      }
      else if(word == "--output") outputFilename = string(argv[++i]);
   }

   // test input
   if(headerFilename.empty()) {
      LOG(ERROR) << "Must specify a header file";
      ok = false;
   }
   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);
//.........这里部分代码省略.........
开发者ID:PPNav,项目名称:GPSTk,代码行数:101,代码来源:convertSSEph.cpp


注:本文中的SolarSystem::readASCIIheader方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。