SatID.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 //
28 // This software was developed by Applied Research Laboratories at the
29 // University of Texas at Austin, under contract to an agency or agencies
30 // within the U.S. Department of Defense. The U.S. Government retains all
31 // rights to use, duplicate, distribute, disclose, or release this software.
32 //
33 // Pursuant to DoD Directive 523024
34 //
35 // DISTRIBUTION STATEMENT A: This software has been approved for public
36 // release, distribution is unlimited.
37 //
38 //==============================================================================
39 #include "SatID.hpp"
40 
41 namespace gnsstk
42 {
43  SatID ::
45  : id(-1), wildId(false),
46  system(SatelliteSystem::GPS), wildSys(false)
47  {
48  }
49 
50 
51  SatID ::
53  : id(p), wildId(false), system(s), wildSys(false)
54  {
55  }
56 
57 
58  SatID ::
59  SatID(int p)
60  : id(p), wildId(false),
61  system(SatelliteSystem::Unknown), wildSys(true)
62  {
63  }
64 
65 
66  SatID ::
68  : id(0), wildId(true), system(s), wildSys(false)
69  {
70  }
71 
72 
73  void SatID ::
75  {
76  wildId = wildSys = true;
77  }
78 
79 
80  bool SatID ::
81  isWild() const
82  {
83  return (wildId || wildSys);
84  }
85 
86 
87  void SatID ::
88  dump(std::ostream& s) const
89  {
90  if (wildSys)
91  s << "*";
92  else
94  s << " ";
95  if (wildId)
96  s << "*";
97  else
98  s << id;
99  }
100 
101 
102  bool SatID ::
103  operator==(const SatID& right) const
104  {
105  using namespace std;
106  return
107  (wildId || right.wildId || (id == right.id)) &&
108  (wildSys || right.wildSys || (system == right.system));
109  }
110 
111 
112  bool SatID ::
113  operator<(const SatID& right) const
114  {
115  // if either system is a wildcard, the systems are effectively equal
116  if (!wildSys && !right.wildSys)
117  {
118  if (system < right.system)
119  return true;
120  if (right.system < system)
121  return false;
122  }
123  // if either id is a wildcard, the ids are effectively equal
124  if (!wildId && !right.wildId)
125  {
126  if (id < right.id)
127  return true;
128  if (right.id < id)
129  return false;
130  }
131  return false;
132  }
133 
134 
135  bool SatID :: isValid() const
136  {
137  switch(system)
138  {
139  case SatelliteSystem::GPS: return (id > 0 && id <= MAX_PRN);
140  //case SatelliteSystem::Galileo:
141  //case SatelliteSystem::Glonass:
142  //case SatelliteSystem::Geosync:
143  //case SatelliteSystem::LEO:
144  //case SatelliteSystem::Transit:
145  default: return (id > 0 && id < 100);
146  }
147  }
148 }
gnsstk::SatID::isValid
bool isValid() const
Definition: SatID.cpp:135
gnsstk::SatID::id
int id
Satellite identifier, e.g. PRN.
Definition: SatID.hpp:154
gnsstk::SatID::makeWild
void makeWild()
Definition: SatID.cpp:74
gnsstk::SatID::operator==
bool operator==(const SatID &right) const
operator == for SatID
Definition: SatID.cpp:103
gnsstk::SatID::dump
void dump(std::ostream &s) const
Convenience output method.
Definition: SatID.cpp:88
gnsstk::SatelliteSystem
SatelliteSystem
Supported satellite systems.
Definition: SatelliteSystem.hpp:55
gnsstk::SatID
Definition: SatID.hpp:89
SatID.hpp
gnsstk::SatID::wildId
bool wildId
If true, any satellite matches.
Definition: SatID.hpp:155
gnsstk
For Sinex::InputHistory.
Definition: BasicFramework.cpp:50
gnsstk::IonexStoreStrategy::Unknown
@ Unknown
Unknown or uninitialized stategy value.
gnsstk::SatelliteSystem::GPS
@ GPS
gnsstk::SatID::wildSys
bool wildSys
If true, any system matches.
Definition: SatID.hpp:157
gnsstk::SatID::isWild
bool isWild() const
return true if any of the fields are set to match wildcards.
Definition: SatID.cpp:81
gnsstk::MAX_PRN
const long MAX_PRN
Definition: gps_constants.hpp:55
gnsstk::SatID::system
SatelliteSystem system
System for this satellite.
Definition: SatID.hpp:156
gnsstk::SatID::operator<
bool operator<(const SatID &right) const
operator < for SatID : order by system, id
Definition: SatID.cpp:113
std
Definition: Angle.hpp:142
gnsstk::SatID::SatID
SatID()
Initialize with invalid data with no wildcards.
Definition: SatID.cpp:44
gnsstk::convertSatelliteSystemToString
std::string convertSatelliteSystemToString(SatelliteSystem s)
Definition: SatelliteSystem.hpp:96


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