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 Rinex3ClockData.hpp
41  * Encapsulate Rinex3Clock file data, including I/O
42  */
43 
44 #ifndef RINEX3CLOCKDATA_HPP
45 #define RINEX3CLOCKDATA_HPP
46 
47 #include "RinexSatID.hpp"
48 #include "Rinex3ClockBase.hpp"
49 #include "CommonTime.hpp"
50 #include <iomanip>
51 
52 namespace gpstk
53 {
54       /// @ingroup FileHandling
55       //@{
56 
57       /**
58        * This class encapsulates data for satellite clocks as found in
59        * RINEX Clock format files, and is used in conjuction with
60        * class Rinex3ClockStream, which handles the I/O, and
61        * Rinex3ClockHeader, which holds information from the
62        * Rinex3Clock file header.
63        *
64        * @code
65        * Rinex3ClockStream ss("igs14080.clk_30s");
66        * Rinex3ClockHeader sh;
67        * Rinex3ClockData sd;
68        *
69        * ss >> sh;
70        *
71        * while (ss >> sd) {
72        *    // Interesting stuff...
73        * }
74        *
75        * Rinex3ClockStream ssout("myfile.clk_30s", ios::out);
76        * ssout << sh;
77        * for(...) {
78        *    // perhaps modify sd
79        *    ssout << sd
80        * }
81        * @endcode
82        *
83        * @sa gpstk::Rinex3ClockHeader and gpstk::Rinex3ClockStream for
84        * more information.
85        */
86    class Rinex3ClockData : public Rinex3ClockBase
87    {
88    public:
89          /// Constructor.
90       Rinex3ClockData();
91 
92          /// Destructor
~Rinex3ClockData()93       virtual ~Rinex3ClockData() {}
94 
95          // The next four lines is our common interface
96          /// Rinex3ClockData is "data" so this function always returns true.
isData() const97       virtual bool isData() const {return true;}
98 
99          /// Debug output function.
100       virtual void dump(std::ostream& s=std::cout) const throw();
101 
102       std::string datatype;   ///< Data type : AR, AS, etc
103       RinexSatID sat;         ///< Satellite ID        (if AS)
104       std::string site;       ///< Site label (4-char) (if AR)
105       CommonTime time;        ///< Time of epoch for this record
106       RCDouble bias;          ///< Clock bias in seconds
107       RCDouble sig_bias;      ///< Clock bias sigma in seconds
108       RCDouble drift;         ///< Clock drift in sec/sec
109       RCDouble sig_drift;     ///< Clock drift sigma in sec/sec
110       RCDouble accel;         ///< Clock acceleration in 1/sec
111       RCDouble sig_accel;     ///< Clock acceleration sigma in 1/sec
112 
113    protected:
114 
clear()115       void clear() throw()
116       {
117          datatype = std::string();
118          sat = RinexSatID(-1,SatelliteSystem::GPS);
119          time = CommonTime::BEGINNING_OF_TIME;
120          bias = sig_bias = drift = sig_drift = accel = sig_accel = 0.0;
121       }
122 
123          /** Writes the formatted record to the FFStream \a s.
124           * @warning This function is currently unimplemented
125           * @throw std::exception
126           * @throw FFStreamError
127           * @throw StringUtils::StringException
128           */
129       virtual void reallyPutRecord(FFStream& s) const;
130 
131          /**
132           * This function reads a record from the given FFStream.
133           * If an error is encountered in retrieving the record, the
134           * stream is reset to its original position and its fail-bit is set.
135           * @throw std::exception
136           * @throw StringException when a StringUtils function fails
137           * @throw FFStreamError when exceptions(failbit) is set and
138           *  a read or formatting error occurs.  This also resets the
139           *  stream to its pre-read position.
140           */
141       virtual void reallyGetRecord(FFStream& s);
142    };
143 
144       //@}
145 
146 }  // namespace
147 
148 #endif // RINEX3CLOCKDATA_HPP
149