NavDataFactory.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 <iterator>
40 #include "NavDataFactory.hpp"
41 #include "TimeString.hpp"
42 #include "demangle.hpp"
43 
45 static const std::string dts("%Y/%03j/%02H:%02M:%02S %P");
46 
47 namespace gnsstk
48 {
50  const CommonTime& fromTime,
51  const CommonTime& toTime)
52  {
53  CommonTime t = fromTime;
54  NavDataPtr junk;
55  // std::cerr << __PRETTY_FUNCTION__ << " "
56  // << gnsstk::printTime(fromTime, dts) << " "
57  // << gnsstk::printTime(toTime, dts)
58  // << std::endl;
59  while (true)
60  {
61  // std::cerr << "isPresent calling find @ " << gnsstk::printTime(t, dts)
62  // << std::endl;
63  if (find(nmid, t, junk, SVHealth::Any, NavValidityType::Any,
65  {
66  return true;
67  }
68  // Jump forward a somewhat arbitrarily chosen 1 hour in
69  // time until we hit toTime to see if there are any other
70  // possibilities given that this time failed to turn up
71  // anything. The logic is used to include toTime but not
72  // get stuck in an infinite loop.
73  if (t < toTime)
74  {
75  t += 3600.0;
76  t = std::min(t, toTime);
77  }
78  else
79  {
80  break;
81  }
82  }
83  return false;
84  }
85 
86 
87  std::set<SatID> NavDataFactory ::
88  getIndexSet(const CommonTime& fromTime,
89  const CommonTime& toTime) const
90  {
91  NavSatelliteIDSet fullSatSet = getAvailableSats(fromTime,toTime);
92  std::set<SatID> rv;
93  for (const auto& fssi : fullSatSet)
94  {
95  rv.insert(fssi.sat);
96  }
97  return rv;
98  }
99 
100 
101  std::set<SatID> NavDataFactory ::
103  const CommonTime& fromTime,
104  const CommonTime& toTime) const
105  {
106  NavSatelliteIDSet fullSatSet = getAvailableSats(nmt,fromTime,toTime);
107  std::set<SatID> rv;
108  for (const auto& fssi : fullSatSet)
109  {
110  rv.insert(fssi.sat);
111  }
112  return rv;
113  }
114 
115 
116  std::string NavDataFactory ::
118  {
119  return demangle(typeid(*this).name());
120  }
121 }
gnsstk::NavDataPtr
std::shared_ptr< NavData > NavDataPtr
Factories instantiate these in response to find() requests.
Definition: NavData.hpp:62
gnsstk::NavMessageID
Class used to identify/categorize navigation message data.
Definition: NavMessageID.hpp:52
gnsstk::NavDataFactory::getIndexSet
std::set< SatID > getIndexSet(const CommonTime &fromTime, const CommonTime &toTime) const
Definition: NavDataFactory.cpp:88
gnsstk::NavSatelliteIDSet
std::set< NavSatelliteID > NavSatelliteIDSet
Definition: NavSatelliteID.hpp:174
gnsstk::NavDataFactory::getClassName
virtual std::string getClassName() const
Returns the fully-qualified class name. Used for debugging.
Definition: NavDataFactory.cpp:117
gnsstk
For Sinex::InputHistory.
Definition: BasicFramework.cpp:50
gnsstk::SVHealth::Any
@ Any
Use in searches when you don't care about the SV health.
gnsstk::NavDataFactory::getAvailableSats
virtual NavSatelliteIDSet getAvailableSats(const CommonTime &fromTime, const CommonTime &toTime) const =0
gnsstk::CommonTime
Definition: CommonTime.hpp:84
gnsstk::min
T min(const SparseMatrix< T > &SM)
Maximum element - return 0 if empty.
Definition: SparseMatrix.hpp:858
gnsstk::demangle
std::string demangle(const char *name)
Demangle G++ class names.
Definition: demangle.cpp:47
gnsstk::NavValidityType::Any
@ Any
Load/find nav messages regardless of validity checks.
demangle.hpp
gnsstk::NavDataFactory::find
virtual bool find(const NavMessageID &nmid, const CommonTime &when, NavDataPtr &navOut, SVHealth xmitHealth, NavValidityType valid, NavSearchOrder order)=0
gnsstk::NavMessageType
NavMessageType
Identify different types of navigation message data.
Definition: NavMessageType.hpp:59
gnsstk::NavSearchOrder::User
@ User
Return the latest message before the search time.
gnsstk::NavDataFactory::isPresent
virtual bool isPresent(const NavMessageID &nmid, const CommonTime &fromTime, const CommonTime &toTime)
Definition: NavDataFactory.cpp:49
NavDataFactory.hpp
TimeString.hpp
dts
static const std::string dts("%Y/%03j/%02H:%02M:%02S %P")
debug time string


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