SP3SatID.hpp
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 
39 #ifndef GNSSTK_SP3_SATID_HPP
40 #define GNSSTK_SP3_SATID_HPP
41 
42 #include <iostream>
43 #include <sstream>
44 #include <iomanip>
45 
46 #include "Exception.hpp"
47 #include "SatID.hpp"
48 #include "gnsstk_export.h"
49 
56 namespace gnsstk
57 {
59 
61 
62 
63  class SP3SatID : public SatID
64  {
65  public:
66 
68  SP3SatID() = default;
69 
71  SP3SatID(int p, SatelliteSystem s) noexcept;
72 
76  SP3SatID(const std::string& str)
77  {
78  try { fromString(str); }
79  catch(Exception& e) { GNSSTK_RETHROW(e); }
80  }
81 
83  SP3SatID(const SatID& sat) noexcept
84  : SatID(sat)
85  { validate(); }
86 
89  char setfill(char c) noexcept
90  { char csave=fillchar; fillchar=c; return csave; }
91 
93  char getfill() noexcept
94  { return fillchar; }
95 
96  // operator=, copy constructor and destructor built by compiler
97 
99  bool operator==(const SP3SatID& right) const
100  {
101  return ((system == right.system) && (id == right.id));
102  }
103 
105  bool operator!=(const SP3SatID& right) const
106  {
107  return !(operator==(right));
108  }
109 
111  bool operator<(const SP3SatID& right) const
112  {
113  if(system==right.system)
114  return (id < right.id);
115  return (system < right.system);
116  }
117 
119  bool operator>(const SP3SatID& right) const
120  {
121  return (!operator<(right) && !operator==(right));
122  }
123 
125  bool operator>=(const SP3SatID& right) const
126  {
127  return (!operator<(right));
128  }
129 
131  bool operator<=(const SP3SatID& right) const
132  {
133  return (!operator>(right));
134  }
135 
139  char systemChar() const noexcept;
140 
141  std::string systemString() const noexcept;
142 
147  void fromString(const std::string s);
148 
150  std::string toString() const noexcept;
151 
152  private:
154  void validate();
155 
157  GNSSTK_EXPORT static char fillchar;
158 
159  }; // class SP3SatID
160 
162  inline std::ostream& operator<<(std::ostream& s, const SP3SatID& sat)
163  {
164  s << sat.toString();
165  return s;
166  }
167 
169 
170 } // namespace gnsstk
171 
172 #endif
gnsstk::SP3SatID::SP3SatID
SP3SatID(const std::string &str)
Definition: SP3SatID.hpp:76
gnsstk::SatID::id
int id
Satellite identifier, e.g. PRN.
Definition: SatID.hpp:154
const
#define const
Definition: getopt.c:43
gnsstk::SP3SatID::fillchar
static GNSSTK_EXPORT char fillchar
fill character used during stream output
Definition: SP3SatID.hpp:157
gnsstk::SatelliteSystem
SatelliteSystem
Supported satellite systems.
Definition: SatelliteSystem.hpp:55
gnsstk::SP3SatID::systemChar
char systemChar() const noexcept
Definition: SP3SatID.cpp:60
gnsstk::SatID
Definition: SatID.hpp:89
SatID.hpp
gnsstk
For Sinex::InputHistory.
Definition: BasicFramework.cpp:50
gnsstk::SP3SatID::SP3SatID
SP3SatID()=default
empty constructor, creates an invalid object
gnsstk::SP3SatID::validate
void validate()
If an unsupported system is used, set to unknown and PRN -1.
Definition: SP3SatID.cpp:178
gnsstk::Exception
Definition: Exception.hpp:151
gnsstk::SP3SatID::operator>
bool operator>(const SP3SatID &right) const
operator > (greater than) for SP3SatID
Definition: SP3SatID.hpp:119
gnsstk::SP3SatID::fromString
void fromString(const std::string s)
Definition: SP3SatID.cpp:95
gnsstk::SP3SatID::toString
std::string toString() const noexcept
convert to string
Definition: SP3SatID.cpp:159
gnsstk::SP3SatID::SP3SatID
SP3SatID(const SatID &sat) noexcept
cast SatID to SP3SatID
Definition: SP3SatID.hpp:83
gnsstk::SP3SatID::operator<=
bool operator<=(const SP3SatID &right) const
operator <= (less than or equal) for SP3SatID
Definition: SP3SatID.hpp:131
gnsstk::SP3SatID::operator!=
bool operator!=(const SP3SatID &right) const
operator != for SP3SatID
Definition: SP3SatID.hpp:105
GNSSTK_RETHROW
#define GNSSTK_RETHROW(exc)
Definition: Exception.hpp:369
gnsstk::SatID::system
SatelliteSystem system
System for this satellite.
Definition: SatID.hpp:156
gnsstk::SP3SatID::operator>=
bool operator>=(const SP3SatID &right) const
operator >= (greater than or equal) for SP3SatID
Definition: SP3SatID.hpp:125
gnsstk::SP3SatID::operator<
bool operator<(const SP3SatID &right) const
operator < (less than) for SP3SatID : order by system, then number
Definition: SP3SatID.hpp:111
gnsstk::SP3SatID::systemString
std::string systemString() const noexcept
Definition: SP3SatID.cpp:78
gnsstk::SP3SatID::setfill
char setfill(char c) noexcept
Definition: SP3SatID.hpp:89
Exception.hpp
std
Definition: Angle.hpp:142
gnsstk::SP3SatID::getfill
char getfill() noexcept
get the fill character used in output
Definition: SP3SatID.hpp:93
gnsstk::SP3SatID
Definition: SP3SatID.hpp:63
gnsstk::SatID::SatID
SatID()
Initialize with invalid data with no wildcards.
Definition: SatID.cpp:44
gnsstk::SP3SatID::operator==
bool operator==(const SP3SatID &right) const
operator == for SP3SatID
Definition: SP3SatID.hpp:99


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