Rinex3ObsLoader_T.cpp
Go to the documentation of this file.
1 //==============================================================================
2 //
3 // This file is part of GNSSTk, the ARL:UT GNSS Toolkit.
4 //
5 // The GNSSTk is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU Lesser General Public License as published
7 // by the Free Software Foundation; either version 3.0 of the License, or
8 // any later version.
9 //
10 // The GNSSTk is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU Lesser General Public License for more details.
14 //
15 // You should have received a copy of the GNU Lesser General Public
16 // License along with GNSSTk; if not, write to the Free Software Foundation,
17 // Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
18 //
19 // This software was developed by Applied Research Laboratories at the
20 // University of Texas at Austin.
21 // Copyright 2004-2022, The Board of Regents of The University of Texas System
22 //
23 //==============================================================================
24 
25 //==============================================================================
26 //
27 // This software was developed by Applied Research Laboratories at the
28 // University of Texas at Austin, under contract to an agency or agencies
29 // within the U.S. Department of Defense. The U.S. Government retains all
30 // rights to use, duplicate, distribute, disclose, or release this software.
31 //
32 // Pursuant to DoD Directive 523024
33 //
34 // DISTRIBUTION STATEMENT A: This software has been approved for public
35 // release, distribution is unlimited.
36 //
37 //==============================================================================
38 
42 
43 // system
44 #include <string>
45 #include <vector>
46 #include <map>
47 #include <iostream>
48 #include <fstream>
49 #include "StringUtils.hpp"
50 #include "Exception.hpp"
51 #include "logstream.hpp"
52 #include "Rinex3ObsHeader.hpp"
53 #include "Rinex3ObsFileLoader.hpp"
54 
55 
56 
57 using namespace std;
58 using namespace gnsstk;
59 
60 
61 
62 int main(int argc, char **argv)
63 {
64  try
65  {
66  int iret;
67 
68  if (argc <= 1)
69  {
70  cout << "Usage: Rinex3ObsLoader_T <rinexfile>" << endl;
71  return 1;
72  }
73 
74  string filename(argv[1]), msg, str;
75  cout << "Load file " << filename << endl;
76 
77  Rinex3ObsFileLoader rofl(filename);
78 
79  if (! rofl.loadObsID("GC1C"))
80  {
81  cout << "Can't load GC1C" << endl;
82  }
83  if (! rofl.loadObsID("GL1C"))
84  {
85  cout << "Can't load GL1C" << endl;
86  }
87  if (! rofl.loadObsID("GC2W"))
88  {
89  cout << "Can't load GC2W" << endl;
90  }
91  if (! rofl.loadObsID("GL2W"))
92  {
93  cout << "Can't load GL2W" << endl;
94  }
95  rofl.saveTheData(true);
96 
97  iret = rofl.loadFiles(str,msg);
98  if (iret < 0 || !str.empty())
99  {
100  LOG(ERROR) << " Error - Loader failed: returned " << iret
101  << " with message " << str;
102  }
103 
104  iret = rofl.getStoreSize();
105  cout << "Store size is " << iret << endl;
106 
107  Rinex3ObsHeader rhead = rofl.getFullHeader(0);
108  rhead.dump(cout);
109 
110  // have to remove file name - paths conflict
111  ostringstream oss;
112  oss << rofl.asString();
113  str = oss.str();
114  str = StringUtils::replaceAll(str,filename,"filename removed, see above");
115  cout << str << endl;
116 
117  return 0;
118  }
119  catch (FFStreamError& e)
120  {
121  cerr << "FFStreamError: " << e.what();
122  }
123  catch (Exception& e)
124  {
125  cerr << "Exception: " << e.what();
126  }
127  catch (...)
128  {
129  cerr << "Unknown exception. Abort." << endl;
130  }
131  return 9;
132 
133 } // end main()
gnsstk::StringUtils::replaceAll
std::string & replaceAll(std::string &s, const std::string &oldString, const std::string &newString)
Definition: StringUtils.hpp:1849
StringUtils.hpp
gnsstk::Rinex3ObsHeader
Definition: Rinex3ObsHeader.hpp:155
gnsstk::Rinex3ObsFileLoader
Definition: Rinex3ObsFileLoader.hpp:85
gnsstk::Exception::what
std::string what() const
Dump to a string.
Definition: Exception.cpp:193
logstream.hpp
gnsstk::Rinex3ObsHeader::dump
virtual void dump(std::ostream &s) const
Definition: Rinex3ObsHeader.hpp:568
gnsstk
For Sinex::InputHistory.
Definition: BasicFramework.cpp:50
gnsstk::Exception
Definition: Exception.hpp:151
gnsstk::Rinex3ObsFileLoader::saveTheData
void saveTheData(bool b)
Definition: Rinex3ObsFileLoader.hpp:266
gnsstk::ERROR
@ ERROR
Definition: logstream.hpp:57
Rinex3ObsHeader.hpp
LOG
#define LOG(level)
define the macro that is used to write to the log stream
Definition: logstream.hpp:315
Exception.hpp
gnsstk::Rinex3ObsFileLoader::getFullHeader
Rinex3ObsHeader getFullHeader(unsigned int i) const
Definition: Rinex3ObsFileLoader.hpp:372
std
Definition: Angle.hpp:142
gnsstk::Rinex3ObsFileLoader::loadObsID
bool loadObsID(std::string srot)
Definition: Rinex3ObsFileLoader.hpp:234
gnsstk::Rinex3ObsFileLoader::loadFiles
int loadFiles(std::string &errmsg, std::string &msg)
Definition: Rinex3ObsFileLoader.cpp:75
gnsstk::Rinex3ObsFileLoader::getStoreSize
const int getStoreSize() const
Definition: Rinex3ObsFileLoader.hpp:381
Rinex3ObsFileLoader.hpp
gnsstk::Rinex3ObsFileLoader::asString
std::string asString()
Definition: Rinex3ObsFileLoader.cpp:495
main
int main(int argc, char **argv)
Definition: Rinex3ObsLoader_T.cpp:62


gnsstk
Author(s):
autogenerated on Wed Oct 25 2023 02:40:41