1 //==============================================================================
2 //
3 // This file is part of GPSTk, the GPS Toolkit.
4 //
5 // The GPSTk 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 GPSTk 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 GPSTk; 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-2020, 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
39 /**
40 * @file DataStructures.cpp
41 * Implement various data containers for program DDBase.
42 */
43
44 //------------------------------------------------------------------------------------
45 // system includes
46
47 // GPSTk
48
49 // DDBase
50 #include "DDBase.hpp"
51 #include "DataStructures.hpp"
52
53 //------------------------------------------------------------------------------------
54 using namespace std;
55 using namespace gpstk;
56
57 //------------------------------------------------------------------------------------
findStationInList(map<string,Station> & SL,string & label)58 Station& findStationInList(map<string,Station>& SL, string& label)
59 {
60 try {
61 map<string,Station>::const_iterator it;
62 it = SL.find(label);
63 if(it == SL.end()) { // create a new Station
64 Station st;
65 SL[label] = st;
66 }
67 return SL[label];
68 }
69 catch(Exception& e) { GPSTK_RETHROW(e); }
70 catch(std::exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); }
71 catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); }
72 }
73
74 //------------------------------------------------------------------------------------
Station(void)75 Station::Station(void) throw()
76 {
77 fixed = usePRS = false;
78 temp = press = rhumid = 0.0;
79 time = CommonTime::BEGINNING_OF_TIME;
80 pTropModel = NULL;
81 TropType = "Saas";
82 ant_azimuth = 0.0;
83 }
84
85 //------------------------------------------------------------------------------------
~Station(void)86 Station::~Station(void) throw()
87 {
88 delete pTropModel;
89 }
90
91 //------------------------------------------------------------------------------------
ObsFile(void)92 ObsFile::ObsFile(void) throw()
93 {
94 name = string("");
95 label = string("");
96 nread = -1;
97 valid = false;
98 inC1 = -1;
99 inP1 = -1; inP2 = -1;
100 inL1 = -1; inL2 = -1;
101 inD1 = -1; inD2 = -1;
102 inS1 = -1; inS2 = -1;
103 }
104
105 //------------------------------------------------------------------------------------
operator =(const ObsFile & of)106 ObsFile& ObsFile::operator=(const ObsFile& of) throw()
107 {
108 name = of.name;
109 label = of.label;
110 nread = of.nread; // number of records read (-1=unopened, 0=header read)
111 valid = of.valid;
112 inC1 = of.inC1;
113 inP1 = of.inP1; inP2 = of.inP2;
114 inL1 = of.inL1; inL2 = of.inL2;
115 inD1 = of.inD1; inD2 = of.inD2;
116 inS1 = of.inS1; inS2 = of.inS2;
117 return *this;
118 }
119
120 //------------------------------------------------------------------------------------
ObsFile(const ObsFile & of)121 ObsFile::ObsFile(const ObsFile& of) throw()
122 {
123 *this = of;
124 }
125
126 //------------------------------------------------------------------------------------
~ObsFile(void)127 ObsFile::~ObsFile(void)
128 {
129 ins.clear();
130 ins.close();
131 }
132
133 //------------------------------------------------------------------------------------
134 //------------------------------------------------------------------------------------
135