NavDataFactoryWithStore.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>
41 #include "TimeString.hpp"
42 #include "OrbitDataKepler.hpp"
43 #include "NavHealthData.hpp"
44 #include "GLOFNavData.hpp"
45 #include "GLOCNavData.hpp"
47 #include "DebugTrace.hpp"
48 
50 static const std::string dts("%Y/%03j/%02H:%02M:%02S %P");
51 
52 namespace gnsstk
53 {
56  {
57  // We are NOT using END_OF_TIME or BEGINNING_OF_TIME here
58  // because of issues with static initialization order. As
59  // such we're essentially forced to use magic numbers here,
60  // because we can't guarantee that any static data (outside
61  // this class) will be initialized prior to this constructor.
62  initialTime.set(3442448L,0,0.0,TimeSystem::Any);
63  finalTime.set(0,0,0.0,TimeSystem::Any);
64  }
65 
66 
68  find(const NavMessageID& nmid, const CommonTime& when,
69  NavDataPtr& navOut, SVHealth xmitHealth, NavValidityType valid,
70  NavSearchOrder order)
71  {
72  bool rv = false;
73  switch (order)
74  {
76  rv = findUser(nmid, when, navOut, xmitHealth, valid);
77  break;
79  rv = findNearest(nmid, when, navOut, xmitHealth, valid);
80  break;
81  default:
82  // requested an invalid search order
83  return false;
84  }
85  if (rv)
86  {
87  // One last check for fit interval validity, but it only
88  // applies to classes that inherit from NavFit.
89  NavFit *nf = dynamic_cast<NavFit*>(navOut.get());
90  if (nf != nullptr)
91  {
92  if ((when < nf->beginFit) || (when > nf->endFit))
93  {
94  // not a valid match, so clear the results.
95  navOut.reset();
96  rv = false;
97  }
98  }
99  }
100  return rv;
101  }
102 
103 
105  findUser(const NavMessageID& nmid, const CommonTime& when,
106  NavDataPtr& navData, SVHealth xmitHealth,
108  {
110  DEBUGTRACE("class: " << getClassName());
114  class FindMatches
115  {
116  public:
117  FindMatches()
118  : map(nullptr), finished(true)
119  {}
120  FindMatches(NavMap *theMap, const NavMap::iterator& theIt)
121  : map(theMap), finished(false), it(theIt)
122  {}
123  NavMap *map;
124  bool finished;
125  NavMap::iterator it;
126  };
127  typedef std::list<FindMatches> MatchList;
128 
129  DEBUGTRACE("nmid=" << nmid << " when=" << gnsstk::printTime(when,dts));
130 
131  // dig through the maps of maps, matching keys with nmid along the way
132  auto dataIt = data.find(nmid.messageType);
133  if (dataIt == data.end())
134  {
135  DEBUGTRACE("false = not found 1");
136  return false; // not found.
137  }
138  // Make a collection of the NavMap iterators that match the
139  // requested NavMessageID. If wildcards are used in the
140  // NavMessageID, we have to do a linear search for matches,
141  // otherwise we can do a direct match using map::find. The
142  // bool of the pair in itMap is used to indicate that there
143  // is no point in further manipulating the iterator as it is
144  // either older than the most recent matching data or there's
145  // nothing more to find.
146  MatchList itList;
147  if (nmid.isWild())
148  {
149  DEBUGTRACE("wildcard search: " << nmid);
150  for (NavSatMap::iterator sati = dataIt->second.begin();
151  sati != dataIt->second.end(); sati++)
152  {
153  if (sati->first != nmid)
154  {
155  DEBUGTRACE(sati->first << " != " << nmid);
156  continue; // skip non matches
157  }
158  DEBUGTRACE("matches " << sati->first);
159  NavMap::iterator nmi = sati->second.lower_bound(when);
160  if (nmi == sati->second.end())
161  {
162  nmi = std::prev(nmi);
163  }
164  DEBUGTRACE("user time : "
165  << gnsstk::printTime(nmi->second->getUserTime(),dts));
166  DEBUGTRACE("(nmi != sati->second.end()) = "
167  << (nmi != sati->second.end()));
168  DEBUGTRACE("(nmi->second->getUserTime() > when) = "
169  << (nmi->second->getUserTime() > when));
170  while ((nmi != sati->second.end()) &&
171  (nmi->second->getUserTime() > when))
172  {
173  DEBUGTRACE("backing up (maybe)");
174  nmi = (nmi == sati->second.begin() ? sati->second.end()
175  : std::prev(nmi));
176  if (nmi != sati->second.end())
177  {
178  DEBUGTRACE("user time : "
179  << gnsstk::printTime(nmi->second->getUserTime(),
180  dts));
181  }
182  }
183  if (nmi != sati->second.end())
184  {
185  itList.push_back(FindMatches(&(sati->second), nmi));
186  }
187  else
188  {
189  DEBUGTRACE("did not add match");
190  }
191  }
192  }
193  else
194  {
195  DEBUGTRACE("non-wildcard search: " << nmid);
196  auto sati = dataIt->second.find(nmid);
197  if (sati != dataIt->second.end())
198  {
199  DEBUGTRACE("found");
200  NavMap::iterator nmi = sati->second.lower_bound(when);
201  if (nmi == sati->second.end())
202  {
203  nmi = std::prev(nmi);
204  }
205  DEBUGTRACE("user time : "
206  << gnsstk::printTime(nmi->second->getUserTime(),dts));
207  while ((nmi != sati->second.end()) &&
208  (nmi->second->getUserTime() > when))
209  {
210  nmi = (nmi == sati->second.begin() ? sati->second.end()
211  : std::prev(nmi));
212  if (nmi != sati->second.end())
213  {
214  DEBUGTRACE("user time : "
215  << gnsstk::printTime(nmi->second->getUserTime(),
216  dts));
217  }
218  }
219  if (nmi != sati->second.end())
220  {
221  itList.push_back(FindMatches(&(sati->second), nmi));
222  }
223  else
224  {
225  DEBUGTRACE("did not add match");
226  }
227  }
228  else
229  {
230  DEBUGTRACE("not found");
231  }
232  }
233  DEBUGTRACE("itList.size() = " << itList.size());
236  bool done = itList.empty();
237  bool rv = false;
238  while (!done)
239  {
240  for (auto& imi : itList)
241  {
242  done = true; // default to being done. Gets reset to false below.
243  if (imi.finished)
244  {
245  // no need to process this iterator any further
246  continue;
247  }
248  else if ((imi.it != imi.map->end()) &&
249  (imi.it->second->getUserTime() < mostRecent))
250  {
251  // Data is less recent than the most recent good data, so stop
252  // processing this iterator.
253  imi.finished = true;
254  }
255  else if (((imi.it != imi.map->end()) &&
256  (imi.it->second->getUserTime() > when)) ||
257  !validityCheck(imi.it,*imi.map,valid,xmitHealth,when))
258  {
259  DEBUGTRACE("not end, not right time");
260  imi.it = (imi.it == imi.map->begin()
261  ? imi.map->end()
262  : std::prev(imi.it));
263  done = false;
264  }
265  else if (imi.it == imi.map->end())
266  {
267  // give up.
268  imi.finished = true;
269  }
270  else
271  {
272  DEBUGTRACE("Found something good at "
273  << printTime(imi.it->first, dts));
274  if (imi.it->second->getUserTime() > mostRecent)
275  {
276  mostRecent = imi.it->second->getUserTime();
277  navData = imi.it->second;
278  DEBUGTRACE("result is now " << navData->signal);
279  }
280  imi.finished = true;
281  rv = true;
282  }
283  }
284  }
285  DEBUGTRACE("Most recent = " << printTime(mostRecent, dts));
286  return rv;
287  }
288 
289 
291  findNearest(const NavMessageID& nmid, const CommonTime& when,
292  NavDataPtr& navData, SVHealth xmitHealth,
294  {
296  DEBUGTRACE("class: " << getClassName());
300  class FindMatches
301  {
302  public:
303  // FindMatches()
304  // : map(nullptr)
305  // {}
312  FindMatches(NavNearMap *theMap, const NavNearMap::iterator& theIt,
313  const CommonTime& t)
314  : map(theMap), itGT(theIt), when(t)
315  {
316  // set the "less than" iterator to an appropriate value
317  itLT = (itGT == theMap->begin() ? theMap->end() : std::prev(itGT));
318 
319  }
320  double getDistGT() const
321  { return itGT == map->end() ? 999e99 : fabs(itGT->first - when); }
322  double getDistLT() const
323  { return itLT == map->end() ? 999e99 : fabs(itLT->first - when); }
324  NavNearMap *map;
325  NavNearMap::iterator itGT, itLT;
326  const CommonTime& when;
327  };
328  typedef std::list<FindMatches> MatchList;
329 
330  // dig through the maps of maps, matching keys with nmid along the way
331  auto dataIt = nearestData.find(nmid.messageType);
332  if (dataIt == nearestData.end())
333  {
334  DEBUGTRACE(" false = not found 1");
335  return false; // not found.
336  }
337  // Make a collection of the NavMap iterators that match the
338  // requested NavMessageID. If wildcards are used in the
339  // NavMessageID, we have to do a linear search for matches,
340  // otherwise we can do a direct match using map::find. The
341  // bool of the pair in itMap is used to indicate that there
342  // is no point in further manipulating the iterator as it is
343  // either older than the most recent matching data or there's
344  // nothing more to find.
345  MatchList itList;
346  if (nmid.isWild())
347  {
348  DEBUGTRACE("wildcard search: " << nmid);
349  for (NavNearSatMap::iterator sati = dataIt->second.begin();
350  sati != dataIt->second.end(); sati++)
351  {
352  if (sati->first != nmid)
353  continue; // skip non matches
354  DEBUGTRACE("matches " << sati->first);
355  DEBUGTRACE("when = " << gnsstk::printTime(when,dts));
356  NavNearMap::iterator nmi = sati->second.lower_bound(when);
357  itList.push_back(FindMatches(&(sati->second), nmi, when));
358  }
359  }
360  else
361  {
362  DEBUGTRACE("non-wildcard search: " << nmid);
363  auto sati = dataIt->second.find(nmid);
364  if (sati != dataIt->second.end())
365  {
366  DEBUGTRACE("found");
367  NavNearMap::iterator nmi = sati->second.lower_bound(when);
368  itList.push_back(FindMatches(&(sati->second), nmi, when));
369  }
370  else
371  {
372  DEBUGTRACE("not found");
373  }
374  }
375  bool done = itList.empty();
376  bool rv = false;
377  while (!done)
378  {
379  for (auto& imi : itList)
380  {
381  done = true; // default to being done. Gets reset to false below.
382  if ((imi.itGT == imi.map->end()) && (imi.itLT == imi.map->end()))
383  {
384  // nothing more to do, we've reached the end of both
385  // directions
386  break;
387  }
388  // At this point we have up to two iterators that refer
389  // to data in a NavNearMap, which is a list of possible
390  // matches. So we iterate through each item in the
391  // list until we find one that matches validity/health
392  // requirements and return that. If we do *not* find a
393  // match in the list, then we increment or decrement
394  // the iterators accordingly and try again until we DO
395  // find a match or run out of options.
396  if ((imi.itGT != imi.map->end()) &&
397  ((imi.itLT == imi.map->end()) ||
398  (fabs(imi.itGT->first - when) < fabs(imi.itLT->first - when))))
399  {
400  // time for itGT is nearer to time of interest, try it first.
401  for (auto& ndpli : imi.itGT->second)
402  {
403  if (validityCheck(ndpli, valid, xmitHealth,when))
404  {
405  // got a match
406  navData = ndpli;
407  return true;
408  }
409  }
410  // no match, so advance the iterator and try again
411  done = false;
412  ++(imi.itGT);
413  }
414  else
415  {
416  // time for itLT is nearer to time of interest, try it first.
417  for (auto& ndpli : imi.itLT->second)
418  {
419  if (validityCheck(ndpli, valid, xmitHealth,when))
420  {
421  // got a match
422  navData = ndpli;
423  return true;
424  }
425  }
426  // no match, so decrement the iterator and try again
427  done = false;
428  imi.itLT = (imi.itLT == imi.map->begin()
429  ? imi.map->end()
430  : std::prev(imi.itLT));
431  }
432  }
433  }
434  return false;
435  }
436 
437 
440  const CommonTime& when, NavDataPtr& offset,
441  SVHealth xmitHealth, NavValidityType valid)
442  {
444  DEBUGTRACE("class: " << getClassName());
445  DEBUGTRACE(printTime(when,"looking for "+dts));
446  bool rv = false;
447  // Only search for forward key and let the TimeOffset classes
448  // and factories handle the reverse offset.
449  TimeCvtKey fwdKey(fromSys,toSys);
450  // First look in the offsetData map for the key matching the
451  // offset translation in the forward direction (fromSys->toSys).
452  auto odi = offsetData.find(fwdKey);
453  DEBUGTRACE("fwdKey=<" << gnsstk::StringUtils::asString(fwdKey.first)
454  << "," << gnsstk::StringUtils::asString(fwdKey.second) << ">");
455  if (odi == offsetData.end())
456  {
458  {
459  DEBUGTRACE("did not find key, giving up");
460  DEBUGTRACE("offsetData.size() = " << offsetData.size());
461  for (const auto& x : offsetData)
462  {
463  DEBUGTRACE("fwdKey=<"
464  << gnsstk::StringUtils::asString(x.first.first) << ","
465  << gnsstk::StringUtils::asString(x.first.second)
466  << ">");
467  }
468  }
469  return false; // no conversion available
470  }
471  else
472  {
473  DEBUGTRACE("found forward key");
474  }
475  // Make a copy of "when" with a time system of Any so that we
476  // can search for offset data whether we're doing a "forward"
477  // conversion (e.g. GPS->UTC) or "backward" conversion
478  // (e.g. UTC->GPS).
479  CommonTime whenny(when);
481  auto oemi = odi->second.lower_bound(whenny);
482  if (oemi == odi->second.end())
483  {
484  DEBUGTRACE("got end right away, backing up one");
485  oemi = std::prev(oemi);
486  }
487  DEBUGTRACE(printTime(oemi->first,"found "+dts));
488  bool done = false;
489  while (!done)
490  {
491  if (oemi == odi->second.end())
492  {
493  // give up, couldn't find any valid matches.
494  DEBUGTRACE("giving up, reached the end");
495  done = true;
496  }
497  else if (oemi->first > whenny)
498  {
499  // time of data is after the requested time of interest
500  // so back up if possible
501  oemi = (oemi == odi->second.begin()
502  ? odi->second.end() : std::prev(oemi));
503  DEBUGTRACE(printTime(oemi->first,"backed up to "+dts));
504  }
505  else
506  {
507  DEBUGTRACE("looking for acceptable data "
509  << gnsstk::StringUtils::asString(xmitHealth));
510  // Message time is valid, so iterate through the
511  // per-signal data for a usable record (matching
512  // validity and transmit satellite health)
513  for (const auto& omi : oemi->second)
514  {
515  TimeOffsetData *todp = dynamic_cast<TimeOffsetData*>(
516  omi.second.get());
517  DEBUGTRACE("checking " << todp->signal);
518  if (todp == nullptr)
519  continue; // shouldn't happen.
520  switch (valid)
521  {
523  if (omi.second->validate() && matchHealth(todp,xmitHealth))
524  {
525  offset = omi.second;
526  return true;
527  }
528  break;
530  if (!omi.second->validate() &&
531  matchHealth(todp,xmitHealth))
532  {
533  offset = omi.second;
534  return true;
535  }
536  break;
537  default:
538  if (matchHealth(todp,xmitHealth))
539  {
540  offset = omi.second;
541  return true;
542  }
543  break;
544  }
545  }
546  DEBUGTRACE("didn't find any acceptable data");
547  oemi = (oemi == odi->second.begin()
548  ? odi->second.end() : std::prev(oemi));
549  }
550  }
551  return rv;
552  }
553 
554 
556  edit(const CommonTime& fromTime, const CommonTime& toTime)
557  {
558  // edit transmit time storage
559  for (auto mti = data.begin(); mti != data.end();)
560  {
561  for (auto sati = mti->second.begin(); sati != mti->second.end();)
562  {
563  auto ti1 = sati->second.lower_bound(fromTime);
564  auto ti2 = sati->second.lower_bound(toTime);
565  sati->second.erase(ti1,ti2);
566  // clean out empty maps
567  if (sati->second.empty())
568  {
569  sati = mti->second.erase(sati);
570  }
571  else
572  {
573  ++sati;
574  }
575  }
576  // clean out empty maps
577  if (mti->second.empty())
578  {
579  mti = data.erase(mti);
580  }
581  else
582  {
583  ++mti;
584  }
585  } // for (auto& mti : data)
586  // edit nearest storage
587  // iterate over message types
588  for (auto mti = nearestData.begin(); mti != nearestData.end();)
589  {
590  // iterate over NavSatelliteIDs
591  for (auto sati = mti->second.begin(); sati != mti->second.end();)
592  {
593  // iterate over CommonTimes
594  for (auto cti = sati->second.begin(); cti != sati->second.end();)
595  {
596  // and iterate over the list.
597  for (auto ndpli = cti->second.begin();
598  ndpli != cti->second.end();)
599  {
600  if (((*ndpli)->timeStamp < toTime) &&
601  ((*ndpli)->timeStamp >= fromTime))
602  {
603  ndpli = cti->second.erase(ndpli);
604  }
605  else
606  {
607  ++ndpli;
608  }
609  }
610  // clean out empty maps
611  if (cti->second.empty())
612  {
613  cti = sati->second.erase(cti);
614  }
615  else
616  {
617  ++cti;
618  }
619  }
620  // clean out empty maps
621  if (sati->second.empty())
622  {
623  sati = mti->second.erase(sati);
624  }
625  else
626  {
627  ++sati;
628  }
629  }
630  // clean out empty maps
631  if (mti->second.empty())
632  {
633  mti = nearestData.erase(mti);
634  }
635  else
636  {
637  ++mti;
638  }
639  }
640  // edit time offset storage
641  // iterate over TimeCvtKey
642  for (auto ocmi = offsetData.begin(); ocmi != offsetData.end();)
643  {
644  // iterate over CommonTimes
645  for (auto cti = ocmi->second.begin(); cti != ocmi->second.end();)
646  {
647  // iterate over NavSatelliteIDs
648  for (auto sati = cti->second.begin(); sati != cti->second.end();)
649  {
650  if ((sati->second->timeStamp < toTime) &&
651  (sati->second->timeStamp >= fromTime))
652  {
653  sati = cti->second.erase(sati);
654  }
655  else
656  {
657  ++sati;
658  }
659  }
660  // clean out empty maps
661  if (cti->second.empty())
662  {
663  cti = ocmi->second.erase(cti);
664  }
665  else
666  {
667  ++cti;
668  }
669  }
670  // clean out empty maps
671  if (ocmi->second.empty())
672  {
673  ocmi = offsetData.erase(ocmi);
674  }
675  else
676  {
677  ++ocmi;
678  }
679  }
680  }
681 
682 
684  edit(const CommonTime& fromTime, const CommonTime& toTime,
685  const NavSatelliteID& satID)
686  {
687  // edit transmit time storage
688  for (auto mti = data.begin(); mti != data.end();)
689  {
690  for (auto sati = mti->second.begin(); sati != mti->second.end();)
691  {
692  if (sati->first != satID)
693  {
694  // not a match
695  ++sati;
696  continue;
697  }
698  auto ti1 = sati->second.lower_bound(fromTime);
699  auto ti2 = sati->second.lower_bound(toTime);
700  sati->second.erase(ti1,ti2);
701  // clean out empty maps
702  if (sati->second.empty())
703  {
704  sati = mti->second.erase(sati);
705  }
706  else
707  {
708  ++sati;
709  }
710  }
711  // clean out empty maps
712  if (mti->second.empty())
713  {
714  mti = data.erase(mti);
715  }
716  else
717  {
718  ++mti;
719  }
720  }
721  // edit nearest storage
722  // iterate over message types
723  for (auto mti = nearestData.begin(); mti != nearestData.end();)
724  {
725  // iterate over NavSatelliteIDs
726  for (auto sati = mti->second.begin(); sati != mti->second.end();)
727  {
728  if (sati->first != satID)
729  {
730  // not a match
731  ++sati;
732  continue;
733  }
734  // iterate over CommonTimes
735  for (auto cti = sati->second.begin(); cti != sati->second.end();)
736  {
737  // and iterate over the list.
738  for (auto ndpli = cti->second.begin();
739  ndpli != cti->second.end();)
740  {
741  if (((*ndpli)->timeStamp < toTime) &&
742  ((*ndpli)->timeStamp >= fromTime))
743  {
744  ndpli = cti->second.erase(ndpli);
745  }
746  else
747  {
748  ++ndpli;
749  }
750  }
751  // clean out empty maps
752  if (cti->second.empty())
753  {
754  cti = sati->second.erase(cti);
755  }
756  else
757  {
758  ++cti;
759  }
760  }
761  // clean out empty maps
762  if (sati->second.empty())
763  {
764  sati = mti->second.erase(sati);
765  }
766  else
767  {
768  ++sati;
769  }
770  }
771  // clean out empty maps
772  if (mti->second.empty())
773  {
774  mti = nearestData.erase(mti);
775  }
776  else
777  {
778  ++mti;
779  }
780  }
781  // edit time offset storage
782  // iterate over TimeCvtKey
783  for (auto ocmi = offsetData.begin(); ocmi != offsetData.end();)
784  {
785  // iterate over CommonTimes
786  for (auto cti = ocmi->second.begin(); cti != ocmi->second.end();)
787  {
788  // iterate over NavSatelliteIDs
789  for (auto sati = cti->second.begin(); sati != cti->second.end();)
790  {
791  if (sati->first != satID)
792  {
793  // not a match
794  ++sati;
795  continue;
796  }
797  if ((sati->second->timeStamp < toTime) &&
798  (sati->second->timeStamp >= fromTime))
799  {
800  sati = cti->second.erase(sati);
801  }
802  else
803  {
804  ++sati;
805  }
806  }
807  // clean out empty maps
808  if (cti->second.empty())
809  {
810  cti = ocmi->second.erase(cti);
811  }
812  else
813  {
814  ++cti;
815  }
816  }
817  // clean out empty maps
818  if (ocmi->second.empty())
819  {
820  ocmi = offsetData.erase(ocmi);
821  }
822  else
823  {
824  ++ocmi;
825  }
826  }
827  }
828 
829 
831  edit(const CommonTime& fromTime, const CommonTime& toTime,
832  const NavSignalID& signal)
833  {
834  NavSatelliteID satMatch(signal);
835  return edit(fromTime, toTime, satMatch);
836  }
837 
838 
841  {
842  data.clear();
843  nearestData.clear();
844  offsetData.clear();
847  }
848 
849 
852  NavNearMessageMap& navNearMap, OffsetCvtMap& ofsMap)
853  {
855  DEBUGTRACE("class: " << getClassName());
856  NavFit *nf = nullptr;
857  OrbitData *odp = nullptr;
858  TimeOffsetData *todp = nullptr;
859  DEBUGTRACE("addNavData user = " << nd->getUserTime()
860  << " nearest = " << nd->getNearTime());
861  SatID satID = nd->signal.sat;
862  // transmit satellite to use as key
863  SatID xsat(nd->signal.xmitSat);
864  switch (factControl.timeOffsFilt)
865  {
867  // this is default behavior
868  break;
870  if (auto stodp = std::dynamic_pointer_cast<StdNavTimeOffset>(nd))
871  {
872  auto result = touBySV[xsat].insert(stodp);
873  if (!result.second)
874  {
875  // already in set
876  return true;
877  }
878  }
879  // Default is still to add, which it will do if the
880  // data type is not a StdNavTimeOffset.
881  break;
883  if (auto stodp = std::dynamic_pointer_cast<StdNavTimeOffset>(nd))
884  {
885  auto result = touBySig[nd->signal].insert(stodp);
886  if (!result.second)
887  {
888  // already in set
889  return true;
890  }
891  }
892  // Default is still to add, which it will do if the
893  // data type is not a StdNavTimeOffset.
894  break;
895  default:
896  break;
897  }
898  // TimeOffset data doesn't have an associated satellite, so
899  // ignore those to avoid time system conflicts in this block
900  // of code.
901  if (satID.system != SatelliteSystem::Unknown)
902  {
903  if (firstLastMap.find(satID) == firstLastMap.end())
904  {
905  firstLastMap[satID] = std::pair<CommonTime,CommonTime>(
906  nd->timeStamp,nd->timeStamp);
907  }
908  else
909  {
910  // Ignore time systems when comparing, because I'm
911  // lazy. The few seconds difference in time systems
912  // isn't going to have a big effect on this information
913  // anyway.
914  CommonTime anyFirst(firstLastMap[satID].first),
915  anyLast(firstLastMap[satID].second),
916  anyTimeStamp(nd->timeStamp);
917  anyFirst.setTimeSystem(TimeSystem::Any);
918  anyLast.setTimeSystem(TimeSystem::Any);
919  anyTimeStamp.setTimeSystem(TimeSystem::Any);
920  // set the stored time stamps using the original time system.
921  if (anyTimeStamp < anyFirst)
922  firstLastMap[satID].first = nd->timeStamp;
923  if (anyTimeStamp > anyLast)
924  firstLastMap[satID].second = nd->timeStamp;
925  }
926  }
927  if ((nf = dynamic_cast<NavFit*>(nd.get())) != nullptr)
928  {
929  if (!updateInitialFinal(nf->beginFit, nf->endFit))
930  return false;
931  }
932  else if ((odp = dynamic_cast<OrbitData*>(nd.get())) != nullptr)
933  {
934  // Non-Keplerian orbit data. Tabular, usually. Use the
935  // reference time to update initial/final time.
936  if (!updateInitialFinal(odp->timeStamp,odp->timeStamp))
937  return false;
938  }
939  // always add to navMap/navNearMap
940  navMap[nd->signal.messageType][nd->signal][nd->getUserTime()] = nd;
941  navNearMap[nd->signal.messageType][nd->signal][nd->getNearTime()]
942  .push_back(nd);
943  // TimeOffsetData has its own special map for look-up.
944  if ((todp = dynamic_cast<TimeOffsetData*>(nd.get())) != nullptr)
945  {
946  TimeCvtSet conversions = todp->getConversions();
947  for (const auto& ci : conversions)
948  {
949  ofsMap[ci][nd->getUserTime()][nd->signal] = nd;
950  }
951  }
952  return true;
953  }
954 
955 
957  updateInitialFinal(const CommonTime& begin, const CommonTime& end)
958  {
959  if (((initialTime.getTimeSystem() != begin.getTimeSystem()) &&
961  ((finalTime.getTimeSystem() != end.getTimeSystem()) &&
963  {
964  // different time systems, convert to UTC first.
965  CommonTime t0(initialTime), t1(finalTime), f0(begin),
966  f1(end);
968  if ((t0.getTimeSystem() != TimeSystem::Any) &&
969  !t0.changeTimeSystem(TimeSystem::UTC, &btsc))
970  {
971  return false;
972  }
973  if ((t1.getTimeSystem() != TimeSystem::Any) &&
974  !t1.changeTimeSystem(TimeSystem::UTC, &btsc))
975  {
976  return false;
977  }
978  if ((f0.getTimeSystem() != TimeSystem::Any) &&
979  !f0.changeTimeSystem(TimeSystem::UTC, &btsc))
980  {
981  return false;
982  }
983  if ((f1.getTimeSystem() != TimeSystem::Any) &&
984  !f1.changeTimeSystem(TimeSystem::UTC, &btsc))
985  {
986  return false;
987  }
988  // Compare UTC times, but set initialTime/finalTime to
989  // original time system
990  if (f0 < t0)
991  initialTime = begin;
992  if (f1 > t1)
993  finalTime = end;
994  }
995  else
996  {
997  initialTime = std::min(initialTime, begin);
998  finalTime = std::max(finalTime, end);
999  }
1000  return true;
1001  }
1002 
1003 
1005  size() const
1006  {
1007  size_t rv = 0;
1008  for (const auto& mti : data)
1009  {
1010  for (const auto& satIt : mti.second)
1011  {
1012  rv += satIt.second.size();
1013  }
1014  }
1015  // OffsetCvtMap doesn't need to be counted because the data
1016  // is now also being stored in the data above.
1017  return rv;
1018  }
1019 
1020 
1022  count(const NavMessageID& nmid) const
1023  {
1025  DEBUGTRACE("class: " << getClassName());
1026  size_t rv = 0;
1027  // Make a copy of the key that can be modified so that values
1028  // that are otherwise not wildcards e.g. SatelliteSystem can
1029  // be managed like wildcards.
1030  NavMessageID key(nmid);
1031  // Iterate over all nav message types. Skip anything that
1032  // doesn't match, treating "Unknown" as a wildcard.
1034  {
1035  if ((nmid.messageType != NavMessageType::Unknown) &&
1036  (nmid.messageType != i))
1037  {
1038  DEBUGTRACE("skipping message type " << StringUtils::asString(i));
1039  continue;
1040  }
1041  DEBUGTRACE("counting message type " << StringUtils::asString(i));
1042  auto dataIt = data.find(i);
1043  if (dataIt == data.end())
1044  {
1045  // no data for this message type, move on
1046  continue;
1047  }
1048  // There are no non-wildcard searches because we treat
1049  // SatelliteSystem::Unknown as a wildcard when it normally
1050  // is not.
1051  DEBUGTRACE("wildcard search: " << nmid);
1052  for (const auto& sati : dataIt->second)
1053  {
1054  // treat the SatelliteSystem::Unknown like a wildcard
1055  if (nmid.system == SatelliteSystem::Unknown)
1056  {
1057  key.system = sati.first.system;
1058  }
1059  if (sati.first == key)
1060  {
1061  DEBUGTRACE("matches " << sati.second.size() << " x "
1062  << sati.first);
1063  rv += sati.second.size();
1064  }
1065  else
1066  {
1067  DEBUGTRACE(sati.first << " != " << nmid);
1068  }
1069  }
1070  }
1071  return rv;
1072  }
1073 
1074 
1077  {
1078  NavMessageID key(
1086  nmt);
1087  key.sat.makeWild();
1088  key.xmitSat.makeWild();
1089  key.system = sys;
1090  return count(key);
1091  }
1092 
1093 
1095  count(const SatID& satID, NavMessageType nmt) const
1096  {
1097  NavMessageID key(
1098  NavSatelliteID(satID,
1105  nmt);
1106  key.xmitSat.makeWild();
1107  return count(key);
1108  }
1109 
1110 
1113  {
1114  NavMessageID key(
1122  nmt);
1123  key.sat.makeWild();
1124  key.xmitSat.makeWild();
1125  return count(key);
1126  }
1127 
1128 
1131  {
1132  std::set<NavSignalID> uniques;
1133  for (const auto& mti : data)
1134  {
1135  for (const auto& satIt : mti.second)
1136  {
1137  uniques.insert(satIt.first);
1138  }
1139  }
1140  return uniques.size();
1141  }
1142 
1143 
1146  {
1147  std::set<NavSatelliteID> uniques;
1148  for (const auto& mti : data)
1149  {
1150  for (const auto& satIt : mti.second)
1151  {
1152  uniques.insert(satIt.first);
1153  }
1154  }
1155  return uniques.size();
1156  }
1157 
1158 
1160  validityCheck(const NavMap::iterator& ti,
1161  NavMap& nm,
1163  SVHealth xmitHealth,
1164  const CommonTime& when)
1165  {
1166  // We can't check the validity of an invalid iterator, BUT we
1167  // have to say it's valid because otherwise the while loop in
1168  // find() breaks.
1169  if (ti == nm.end())
1170  {
1171  return true;
1172  }
1173  return validityCheck(ti->second, valid, xmitHealth, when);
1174  }
1175 
1176 
1180  SVHealth xmitHealth,
1181  const CommonTime& when)
1182  {
1183  bool rv = true;
1184  // One last check for fit interval validity, but it only
1185  // applies to classes that inherit from NavFit.
1186  NavFit *nf = dynamic_cast<NavFit*>(ndp.get());
1187  if (nf != nullptr)
1188  {
1189  if ((when < nf->beginFit) || (when > nf->endFit))
1190  {
1191  return false;
1192  }
1193  }
1194  switch (valid)
1195  {
1197  rv = ndp->validate();
1198  break;
1200  rv = !ndp->validate();
1201  break;
1202  default:
1203  rv = true;
1204  break;
1205  }
1206  if (!rv)
1207  {
1208  // already determined to be invalid, don't bother doing
1209  // further checking
1210  return false;
1211  }
1212  // We're already trying to get health information, seems like
1213  // we could/should avoid getting into a loop by just
1214  // returning what we have.
1215  if (ndp->signal.messageType == gnsstk::NavMessageType::Health)
1216  {
1217  return rv;
1218  }
1219  return matchHealth(ndp.get(), xmitHealth);
1220  }
1221 
1222 
1224  matchHealth(NavData *ndp, SVHealth xmitHealth)
1225  {
1227  DEBUGTRACE("class: " << getClassName());
1228  bool rv = true;
1229  // Set to true if the health status matched. If it remains
1230  // false, we have to do a look up of the health status of the
1231  // transmitting satellite because the presumed matched data
1232  // doesn't contain the health status of the transmitting
1233  // satellite.
1234  bool rvSet = false;
1235  OrbitDataKepler *orb;
1236  GLOFNavData *glof;
1237  GLOCNavData *gloc;
1238  NavHealthData *hea;
1239  // This is a kludge to handle those cases where we don't have
1240  // a valid satellite ID, e.g. RINEX iono corrections.
1241  if (ndp->signal.xmitSat.id == 0)
1242  {
1243  DEBUGTRACE("assuming health matches for missing sat ID");
1244  return true;
1245  }
1246  switch (xmitHealth)
1247  {
1248  case SVHealth::Healthy:
1249  case SVHealth::Unhealthy:
1250  case SVHealth::Degraded:
1251  DEBUGTRACE("attempting to match "
1252  << gnsstk::StringUtils::asString(xmitHealth));
1253  // make sure the health status is the desired state
1254  if (ndp->signal.sat == ndp->signal.xmitSat)
1255  {
1256  // If the subject and transmitting satellite are the
1257  // same, assume the health state is up-to-date for
1258  // the satellite.
1259  if ((orb = dynamic_cast<OrbitDataKepler*>(ndp)) != nullptr)
1260  {
1261  rv = (xmitHealth == orb->health);
1262  rvSet = true;
1263  }
1264  else if ((glof = dynamic_cast<GLOFNavData*>(ndp)) != nullptr)
1265  {
1266  rv = (xmitHealth == glof->health);
1267  rvSet = true;
1268  }
1269  else if ((gloc = dynamic_cast<GLOCNavData*>(ndp)) != nullptr)
1270  {
1271  DEBUGTRACE("gloc->header.health=" << StringUtils::asString(gloc->header.health));
1272  rv = (xmitHealth == gloc->header.health);
1273  rvSet = true;
1274  }
1275  else if ((hea = dynamic_cast<NavHealthData*>(ndp)) != nullptr)
1276  {
1277  rv = (xmitHealth == hea->getHealth());
1278  rvSet = true;
1279  }
1280  }
1281  if (!rvSet)
1282  {
1283  DEBUGTRACE("looking up health data");
1284  // We were not able to obtain health status of the
1285  // transmitting satellite so look it up. We
1286  // specifically use SVHealth::Any because we're
1287  // looking up the health. Not sure if
1288  // NavValidityType::Any is the proper choice, but
1289  // NavSearchOrder::User definitely is, as that will
1290  // result in getting the most recent health
1291  // information prior to the time stamp of the data
1292  // we're interested in.
1293  NavDataPtr heaPtr;
1294  NavMessageID nmid = ndp->signal;
1303  nmid.sat = nmid.xmitSat;
1304  if (!find(nmid, ndp->timeStamp, heaPtr,
1307  {
1308  DEBUGTRACE(" couldn't find health");
1309  return false;
1310  }
1311  hea = dynamic_cast<NavHealthData*>(heaPtr.get());
1312  rv = (xmitHealth == hea->getHealth());
1313  DEBUGTRACE("transmit health "
1314  << (rv ? "matches" : "does not match"));
1315  }
1316  break;
1317  default:
1318  // treat all other cases as valid
1319  break;
1320  }
1321  DEBUGTRACE("matchHealth rv=" << rv);
1322  return rv;
1323  }
1324 
1325 
1327  {
1328  auto i = firstLastMap.find(sat);
1329  if (i != firstLastMap.end())
1330  return i->second.first;
1331  return CommonTime::END_OF_TIME;
1332  }
1333 
1334 
1336  {
1337  auto i = firstLastMap.find(sat);
1338  if (i != firstLastMap.end())
1339  return i->second.second;
1341  }
1342 
1343 
1345  const CommonTime& fromTime, const CommonTime& toTime)
1346  const
1347  {
1348  NavSatelliteIDSet rv;
1349  NavMessageIDSet tmp = getAvailableMsgs(fromTime, toTime);
1350  // copy the NavMessageID objects into the return value which
1351  // will cast the NavMessageID to NavSatelliteID.
1352  for (const auto& i : tmp)
1353  rv.insert(i);
1354  return rv;
1355  }
1356 
1357 
1359  NavMessageType nmt, const CommonTime& fromTime, const CommonTime& toTime)
1360  const
1361  {
1362  NavSatelliteIDSet rv;
1363  auto nmmi = data.find(nmt);
1364  if (nmmi != data.end())
1365  {
1366  for (const auto& nsmi : nmmi->second)
1367  {
1368  auto ti1 = nsmi.second.lower_bound(fromTime);
1369  if ((ti1 != nsmi.second.end()) && (ti1->first < toTime))
1370  {
1371  rv.insert(nsmi.first);
1372  }
1373  }
1374  }
1375  return rv;
1376  }
1377 
1378 
1379  std::set<SatID> NavDataFactoryWithStore ::
1380  getIndexSet(const CommonTime& fromTime,
1381  const CommonTime& toTime) const
1382  {
1383  std::set<SatID> rv;
1384  for (const auto& nmmi : data)
1385  {
1386  for (const auto& nsmi : nmmi.second)
1387  {
1388  auto ti1 = nsmi.second.lower_bound(fromTime);
1389  if ((ti1 != nsmi.second.end()) && (ti1->first < toTime))
1390  {
1391  rv.insert(nsmi.first.sat);
1392  }
1393  }
1394  }
1395  return rv;
1396  }
1397 
1398 
1399  std::set<SatID> NavDataFactoryWithStore ::
1401  const CommonTime& fromTime,
1402  const CommonTime& toTime) const
1403  {
1404  std::set<SatID> rv;
1405  auto nmmi = data.find(nmt);
1406  if (nmmi != data.end())
1407  {
1408  for (const auto& nsmi : nmmi->second)
1409  {
1410  auto ti1 = nsmi.second.lower_bound(fromTime);
1411  if ((ti1 != nsmi.second.end()) && (ti1->first < toTime))
1412  {
1413  rv.insert(nsmi.first.sat);
1414  }
1415  }
1416  }
1417  return rv;
1418  }
1419 
1420 
1422  const CommonTime& fromTime, const CommonTime& toTime)
1423  const
1424  {
1425  NavMessageIDSet rv;
1426  for (const auto& nmmi : data)
1427  {
1428  for (const auto& nsmi : nmmi.second)
1429  {
1430  auto ti1 = nsmi.second.lower_bound(fromTime);
1431  if ((ti1 != nsmi.second.end()) && (ti1->first < toTime))
1432  {
1433  rv.insert(NavMessageID(nsmi.first, nmmi.first));
1434  }
1435  }
1436  }
1437  return rv;
1438  }
1439 
1440 
1442  getNavMap(const NavMessageID& nmid) const
1443  {
1444  auto nmmi = data.find(nmid.messageType);
1445  if (nmmi != data.end())
1446  {
1447  auto nsmi = nmmi->second.find(nmid);
1448  if (nsmi != nmmi->second.end())
1449  {
1450  return &nsmi->second;
1451  }
1452  }
1453  return nullptr;
1454  }
1455 
1456 
1458  dump(std::ostream& s, DumpDetail dl) const
1459  {
1461  DEBUGTRACE("class: " << getClassName());
1462  DEBUGTRACE("data.size() = " << data.size());
1463  for (const auto& nmmi : data)
1464  {
1465  for (const auto& nsami : nmmi.second)
1466  {
1467  switch (dl)
1468  {
1469  case DumpDetail::OneLine:
1470  s << StringUtils::asString(nmmi.first) << " "
1471  << StringUtils::asString(nsami.first) << " "
1472  << nsami.second.size() << " objects" << std::endl;
1473  break;
1474  case DumpDetail::Terse:
1481  s << " Map for " << StringUtils::asString(nmmi.first)
1482  << " " << StringUtils::asString(nsami.first) << " has "
1483  << nsami.second.size() << " entries." << std::endl
1484  << "SVN PRN Begin Fit Toe End Fit"
1485  << " URA IODC Health" << std::endl;
1486  for (const auto& cti : nsami.second)
1487  {
1488  cti.second->dump(s, dl);
1489  }
1490  break;
1491  case DumpDetail::Brief:
1492  for (const auto& cti : nsami.second)
1493  {
1494  s << StringUtils::asString(nmmi.first) << " "
1495  << StringUtils::asString(nsami.first) << " "
1496  << printTime(cti.first, "%Y %2m %2d %02H:%02M:%04.1f")
1497  << std::endl;
1498  }
1499  break;
1500  case DumpDetail::Full:
1501  for (const auto& cti : nsami.second)
1502  {
1503  cti.second->dump(s,dl);
1504  }
1505  break;
1506  }
1507  }
1508  }
1509  } // NavDataFactoryWithStore::dump()
1510 
1511 
1513  operator()(const std::shared_ptr<StdNavTimeOffset>& left,
1514  const std::shared_ptr<StdNavTimeOffset>& right) const
1515  {
1516  if (left->refTime < right->refTime) return true;
1517  if (right->refTime < left->refTime) return false;
1518  if (left->a0 < right->a0) return true;
1519  if (right->a0 < left->a0) return false;
1520  if (left->a1 < right->a1) return true;
1521  if (right->a1 < left->a1) return false;
1522  if (left->a2 < right->a2) return true;
1523  return false;
1524  }
1525 
1526 } // namespace gnsstk
gnsstk::NavDataPtr
std::shared_ptr< NavData > NavDataPtr
Factories instantiate these in response to find() requests.
Definition: NavData.hpp:62
gnsstk::NavDataFactoryWithStore::addNavData
bool addNavData(const NavDataPtr &nd)
Definition: NavDataFactoryWithStore.hpp:149
dts
static const std::string dts("%Y/%03j/%02H:%02M:%02S %P")
debug time string
gnsstk::NavDataFactoryWithStore::findNearest
virtual bool findNearest(const NavMessageID &nmid, const CommonTime &when, NavDataPtr &navData, SVHealth xmitHealth, NavValidityType valid)
Definition: NavDataFactoryWithStore.cpp:291
gnsstk::NavMessageID
Class used to identify/categorize navigation message data.
Definition: NavMessageID.hpp:52
nf
int nf
Definition: IERS1996NutationData.hpp:44
gnsstk::SatID::id
int id
Satellite identifier, e.g. PRN.
Definition: SatID.hpp:154
gnsstk::SatID::makeWild
void makeWild()
Definition: SatID.cpp:74
gnsstk::NavSatelliteID::isWild
bool isWild() const override
Return true if any of the fields are set to match wildcards.
Definition: NavSatelliteID.cpp:166
gnsstk::GLOFNavData::health
SVHealth health
SV health status.
Definition: GLOFNavData.hpp:71
gnsstk::NavNearMap
std::map< CommonTime, NavDataPtrList > NavNearMap
Map from "nearest" time reference (e.g. toe) to list of NavDataPtr.
Definition: NavData.hpp:77
gnsstk::NavDataFactoryWithStore::dump
void dump(std::ostream &s, DumpDetail dl) const override
Definition: NavDataFactoryWithStore.cpp:1458
NavHealthData.hpp
gnsstk::NavDataFactoryWithStore::OffsetCvtMap
std::map< TimeCvtKey, OffsetEpochMap > OffsetCvtMap
Map from the time system conversion pair to the conversion objects.
Definition: NavDataFactoryWithStore.hpp:74
gnsstk::NavMessageMap
std::map< NavMessageType, NavSatMap > NavMessageMap
Map nav message type to the rest of the storage.
Definition: NavData.hpp:71
gnsstk::NavDataFactory::factControl
FactoryControl factControl
Configuration for the behavior of this factory.
Definition: NavDataFactory.hpp:383
gnsstk::FactoryControl::timeOffsFilt
TimeOffsetFilter timeOffsFilt
Definition: FactoryControl.hpp:73
gnsstk::TimeOffsetFilter::BySV
@ BySV
TimeOffsetData is unique filtered on a per-SV basis.
gnsstk::NavDataFactoryWithStore::numSignals
virtual size_t numSignals() const
Return the number of distinct signals (ignoring PRN) in the data.
Definition: NavDataFactoryWithStore.cpp:1130
gnsstk::NavDataFactoryWithStore::findUser
virtual bool findUser(const NavMessageID &nmid, const CommonTime &when, NavDataPtr &navData, SVHealth xmitHealth, NavValidityType valid)
Definition: NavDataFactoryWithStore.cpp:105
gnsstk::GLOCNavData::header
GLOCNavHeader header
Common data.
Definition: GLOCNavData.hpp:65
gnsstk::TimeCvtKey
std::pair< TimeSystem, TimeSystem > TimeCvtKey
Definition: TimeOffsetData.hpp:53
gnsstk::NavMessageID::messageType
NavMessageType messageType
Definition: NavMessageID.hpp:97
gnsstk::NavSatelliteID
Definition: NavSatelliteID.hpp:57
gnsstk::max
T max(const SparseMatrix< T > &SM)
Maximum element - return 0 if empty.
Definition: SparseMatrix.hpp:881
gnsstk::NavDataFactoryWithStore::touBySV
TOUSatMap touBySV
Each satellite's uniquely transmitted time offset.
Definition: NavDataFactoryWithStore.hpp:493
DEBUGTRACE
#define DEBUGTRACE(EXPR)
Definition: DebugTrace.hpp:119
gnsstk::SatelliteSystem
SatelliteSystem
Supported satellite systems.
Definition: SatelliteSystem.hpp:55
gnsstk::NavSatelliteIDSet
std::set< NavSatelliteID > NavSatelliteIDSet
Definition: NavSatelliteID.hpp:174
gnsstk::NavData
Definition: NavData.hpp:86
OrbitDataKepler.hpp
gnsstk::CarrierBand::Any
@ Any
Used to match any carrier band.
gnsstk::SatID
Definition: SatID.hpp:89
gnsstk::NavMessageType::Health
@ Health
SV health status information message.
gnsstk::TimeSystem::Any
@ Any
wildcard; allows comparison with any other type
gnsstk::StringUtils::asString
std::string asString(IonexStoreStrategy e)
Convert a IonexStoreStrategy to a whitespace-free string name.
Definition: IonexStoreStrategy.cpp:46
gnsstk::CommonTime::setTimeSystem
CommonTime & setTimeSystem(TimeSystem timeSystem)
Definition: CommonTime.hpp:195
gnsstk::NavDataFactoryWithStore::updateInitialFinal
bool updateInitialFinal(const CommonTime &begin, const CommonTime &end)
Definition: NavDataFactoryWithStore.cpp:957
gnsstk::CommonTime::BEGINNING_OF_TIME
static const GNSSTK_EXPORT CommonTime BEGINNING_OF_TIME
earliest representable CommonTime
Definition: CommonTime.hpp:102
gnsstk::SVHealth
SVHealth
Identify different types of SV health states.
Definition: SVHealth.hpp:52
gnsstk::NavValidityType
NavValidityType
Definition: NavValidityType.hpp:53
gnsstk::NavData::signal
NavMessageID signal
Source signal identification for this navigation message data.
Definition: NavData.hpp:175
gnsstk::NavSearchOrder
NavSearchOrder
Specify the behavior of nav data searches in NavLibrary/NavDataFactory.
Definition: NavSearchOrder.hpp:51
gnsstk::NavDataFactory::getClassName
virtual std::string getClassName() const
Returns the fully-qualified class name. Used for debugging.
Definition: NavDataFactory.cpp:117
gnsstk::SVHealth::Degraded
@ Degraded
Satellite is in a degraded state. Use at your own risk.
gnsstk
For Sinex::InputHistory.
Definition: BasicFramework.cpp:50
gnsstk::NavDataFactoryWithStore::getAvailableMsgs
NavMessageIDSet getAvailableMsgs(const CommonTime &fromTime, const CommonTime &toTime) const override
Definition: NavDataFactoryWithStore.cpp:1421
gnsstk::NavDataFactoryWithStore::count
virtual size_t count(const NavMessageID &nmid) const
Definition: NavDataFactoryWithStore.cpp:1022
gnsstk::TimeCvtSet
std::set< TimeCvtKey > TimeCvtSet
Define a unique set of time system conversions.
Definition: TimeOffsetData.hpp:55
gnsstk::NavData::timeStamp
CommonTime timeStamp
Definition: NavData.hpp:173
gnsstk::NavDataFactoryWithStore::NavDataFactoryWithStore
NavDataFactoryWithStore()
Initialize internal data.
Definition: NavDataFactoryWithStore.cpp:55
gnsstk::SVHealth::Any
@ Any
Use in searches when you don't care about the SV health.
gnsstk::NavDataFactoryWithStore::initialTime
CommonTime initialTime
Store the earliest applicable orbit time here, by addNavData.
Definition: NavDataFactoryWithStore.hpp:463
gnsstk::CommonTime::END_OF_TIME
static const GNSSTK_EXPORT CommonTime END_OF_TIME
latest representable CommonTime
Definition: CommonTime.hpp:104
gnsstk::NavType::Any
@ Any
Used to match any nav code.
gnsstk::NavDataFactoryWithStore::getFirstTime
CommonTime getFirstTime(const SatID &sat) const
Definition: NavDataFactoryWithStore.cpp:1326
gnsstk::DebugTrace::enabled
static GNSSTK_EXPORT std::atomic< bool > enabled
If true, debugging/trace output will be printed to stderr.
Definition: DebugTrace.hpp:86
gnsstk::NavSignalID::system
SatelliteSystem system
GNSS for this signal.
Definition: NavSignalID.hpp:94
example6.second
second
Definition: example6.py:69
gnsstk::ObservationType::Any
@ Any
Used to match any observation type.
gnsstk::NavDataFactoryWithStore::firstLastMap
std::map< SatID, std::pair< CommonTime, CommonTime > > firstLastMap
Map subject satellite ID to time stamp pair (oldest,newest).
Definition: NavDataFactoryWithStore.hpp:467
gnsstk::SVHealth::Healthy
@ Healthy
Satellite is in a healthy and useable state.
gnsstk::NavMessageType::Unknown
@ Unknown
Message type is not known or is uninitialized.
BasicTimeSystemConverter.hpp
gnsstk::NavDataFactoryWithStore::size
virtual size_t size() const
Return the number of nav messages in data.
Definition: NavDataFactoryWithStore.cpp:1005
gnsstk::NavValidityType::InvalidOnly
@ InvalidOnly
Only load/find nav messages that fail validity checks.
gnsstk::NavDataFactoryWithStore::getLastTime
CommonTime getLastTime(const SatID &sat) const
Definition: NavDataFactoryWithStore.cpp:1335
gnsstk::SatelliteSystem::Unknown
@ Unknown
gnsstk::NavValidityType::ValidOnly
@ ValidOnly
Only load/find nav messages that pass validity checks.
gnsstk::NavDataFactoryWithStore::getAvailableSats
NavSatelliteIDSet getAvailableSats(const CommonTime &fromTime, const CommonTime &toTime) const override
Definition: NavDataFactoryWithStore.cpp:1344
gnsstk::ObsID
Definition: ObsID.hpp:82
gnsstk::TimeOffsetData
Definition: TimeOffsetData.hpp:60
gnsstk::NavDataFactoryWithStore::edit
void edit(const CommonTime &fromTime, const CommonTime &toTime) override
Definition: NavDataFactoryWithStore.cpp:556
nd
int nd
Definition: IERS1996NutationData.hpp:44
gnsstk::NavSatelliteID::sat
SatID sat
ID of satellite to which the nav data applies.
Definition: NavSatelliteID.hpp:169
gnsstk::TimeOffsetFilter::NoFilt
@ NoFilt
No filtering is performed on TimeOffsetData.
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::TimeSystem
TimeSystem
Definition of various time systems.
Definition: TimeSystem.hpp:51
GLOFNavData.hpp
example6.valid
valid
Definition: example6.py:20
gnsstk::NavHealthData
Definition: NavHealthData.hpp:52
gnsstk::NavValidityType::Any
@ Any
Load/find nav messages regardless of validity checks.
gnsstk::DumpDetail::Full
@ Full
Include all detailed information.
gnsstk::NavDataFactoryWithStore::numSatellites
virtual size_t numSatellites() const
Return the number of distinct signals including PRN, in the data.
Definition: NavDataFactoryWithStore.cpp:1145
gnsstk::NavDataFactoryWithStore::touBySig
TOUSigMap touBySig
Each signal's uniquely transmitted time offset.
Definition: NavDataFactoryWithStore.hpp:494
gnsstk::SatID::system
SatelliteSystem system
System for this satellite.
Definition: SatID.hpp:156
gnsstk::GLOCNavHeader::health
SVHealth health
SV health status.
Definition: GLOCNavHeader.hpp:89
gnsstk::TimeSystem::UTC
@ UTC
Coordinated Universal Time (e.g., from NTP)
gnsstk::DumpDetail::Terse
@ Terse
Aptly named, multiple lines of output with no labels.
gnsstk::NavDataFactoryWithStore::find
bool find(const NavMessageID &nmid, const CommonTime &when, NavDataPtr &navOut, SVHealth xmitHealth, NavValidityType valid, NavSearchOrder order) override
Definition: NavDataFactoryWithStore.cpp:68
gnsstk::NavDataFactoryWithStore::data
NavMessageMap data
Internal storage of navigation data for User searches.
Definition: NavDataFactoryWithStore.hpp:456
gnsstk::NavSignalID
Class used to identify navigation data signal types.
Definition: NavSignalID.hpp:54
gnsstk::TimeOffsetData::getConversions
virtual TimeCvtSet getConversions() const =0
gnsstk::CommonTime::getTimeSystem
TimeSystem getTimeSystem() const
Obtain time system info (enum).
Definition: CommonTime.cpp:288
gnsstk::BasicTimeSystemConverter
Definition: BasicTimeSystemConverter.hpp:51
gnsstk::DumpDetail
DumpDetail
Specify level of detail for dump output.
Definition: DumpDetail.hpp:51
gnsstk::NavHealthData::getHealth
virtual SVHealth getHealth() const =0
gnsstk::NavDataFactoryWithStore::getIndexSet
std::set< SatID > getIndexSet(const CommonTime &fromTime, const CommonTime &toTime) const
Definition: NavDataFactoryWithStore.cpp:1380
gnsstk::printTime
std::string printTime(const CommonTime &t, const std::string &fmt)
Definition: TimeString.cpp:64
gnsstk::NavMessageTypeIterator
EnumIterator< NavMessageType, NavMessageType::Unknown, NavMessageType::Last > NavMessageTypeIterator
Definition: NavMessageType.hpp:74
gnsstk::DumpDetail::Brief
@ Brief
Limit output to <= 5 lines of minimal information.
DebugTrace.hpp
gnsstk::OrbitDataKepler
Base class for orbit information that uses Keplerian parameters.
Definition: OrbitDataKepler.hpp:52
gnsstk::NavMessageType
NavMessageType
Identify different types of navigation message data.
Definition: NavMessageType.hpp:59
example4.navData
navData
Definition: example4.py:15
gnsstk::GLOFNavData
Definition: GLOFNavData.hpp:55
gnsstk::NavDataFactoryWithStore::UniqueTimeOffset::operator()
bool operator()(const std::shared_ptr< StdNavTimeOffset > &left, const std::shared_ptr< StdNavTimeOffset > &right) const
Definition: NavDataFactoryWithStore.cpp:1513
gnsstk::NavSearchOrder::Nearest
@ Nearest
Return the message closest to the search time.
gnsstk::DumpDetail::OneLine
@ OneLine
Limit output to minimal information on a single line.
gnsstk::NavDataFactoryWithStore::matchHealth
bool matchHealth(NavData *ndp, SVHealth xmitHealth)
Definition: NavDataFactoryWithStore.cpp:1224
gnsstk::TimeOffsetFilter::BySignal
@ BySignal
TimeOffsetData is unique filtered across a signal.
gnsstk::NavDataFactoryWithStore::clear
void clear() override
Remove all data from the internal store.
Definition: NavDataFactoryWithStore.cpp:840
DEBUGTRACE_FUNCTION
#define DEBUGTRACE_FUNCTION()
Definition: DebugTrace.hpp:117
gnsstk::NavFit
Definition: NavFit.hpp:51
gnsstk::OrbitData
Definition: OrbitData.hpp:53
gnsstk::NavMap
std::map< CommonTime, NavDataPtr > NavMap
Map nav message transmit time to nav message.
Definition: NavData.hpp:67
gnsstk::NavSearchOrder::User
@ User
Return the latest message before the search time.
gnsstk::NavDataFactoryWithStore::nearestData
NavNearMessageMap nearestData
Internal storage of navigation data for Nearest searches.
Definition: NavDataFactoryWithStore.hpp:458
gnsstk::CommonTime::changeTimeSystem
bool changeTimeSystem(TimeSystem timeSystem, TimeSystemConverter *conv)
Definition: CommonTime.cpp:190
gnsstk::NavID
Definition: NavID.hpp:61
gnsstk::NavDataFactoryWithStore::offsetData
OffsetCvtMap offsetData
Definition: NavDataFactoryWithStore.hpp:461
gnsstk::OrbitDataKepler::health
SVHealth health
SV health status.
Definition: OrbitDataKepler.hpp:173
gnsstk::NavNearMessageMap
std::map< NavMessageType, NavNearSatMap > NavNearMessageMap
Map nav message type to the rest of the storage.
Definition: NavData.hpp:81
gnsstk::SVHealth::Unhealthy
@ Unhealthy
Satellite is unhealthy and should not be used.
gnsstk::XmitAnt::Any
@ Any
When making comparisons in ObsID, matches any enumeration.
NavDataFactoryWithStore.hpp
gnsstk::NavMessageIDSet
std::set< NavMessageID > NavMessageIDSet
Definition: NavMessageID.hpp:101
gnsstk::NavSatelliteID::xmitSat
SatID xmitSat
ID of the satellite transmitting the nav data.
Definition: NavSatelliteID.hpp:170
gnsstk::GLOCNavData
Definition: GLOCNavData.hpp:53
gnsstk::NavDataFactoryWithStore::getNavMap
const NavMap * getNavMap(const NavMessageID &nmid) const
Definition: NavDataFactoryWithStore.cpp:1442
GLOCNavData.hpp
gnsstk::TrackingCode::Any
@ Any
Used to match any tracking code.
gnsstk::NavDataFactoryWithStore::validityCheck
bool validityCheck(const NavMap::iterator &ti, NavMap &nm, NavValidityType valid, SVHealth xmitHealth, const CommonTime &when)
Definition: NavDataFactoryWithStore.cpp:1160
TimeString.hpp
gnsstk::NavDataFactoryWithStore::finalTime
CommonTime finalTime
Store the latest applicable orbit time here, by addNavData.
Definition: NavDataFactoryWithStore.hpp:465
gnsstk::CommonTime::set
CommonTime & set(long day, long sod, double fsod=0.0, TimeSystem timeSystem=TimeSystem::Unknown)
Definition: CommonTime.cpp:87
gnsstk::NavDataFactoryWithStore::getOffset
bool getOffset(TimeSystem fromSys, TimeSystem toSys, const CommonTime &when, NavDataPtr &offset, SVHealth xmitHealth=SVHealth::Any, NavValidityType valid=NavValidityType::ValidOnly) override
Definition: NavDataFactoryWithStore.cpp:439


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