RinexNavFilterOperators.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 
44 #ifndef GNSSTK_RINEXNAVFILTEROPERATORS_HPP
45 #define GNSSTK_RINEXNAVFILTEROPERATORS_HPP
46 
47 #include "GPSWeekSecond.hpp"
48 
49 #include "FileFilter.hpp"
50 #include "RinexNavData.hpp"
51 #include "RinexNavHeader.hpp"
52 #include "GPSWeekSecond.hpp"
53 
54 #include <set>
55 
56 namespace gnsstk
57 {
59 
60 
63  public std::binary_function<gnsstk::RinexNavData,
64  gnsstk::RinexNavData, bool>
65  {
66  public:
68  const gnsstk::RinexNavData& r) const
69  {
70  if (l.getXmitTime() < r.getXmitTime())
71  return true;
72  else if (l.getXmitTime() == r.getXmitTime())
73  {
74  // compare the times and all data members
75  if (l.time < r.time)
76  return true;
77  else if (l.time == r.time)
78  {
79  std::list<double>
80  llist = l.toList(),
81  rlist = r.toList();
82 
83  std::list<double>::iterator
84  litr = llist.begin(),
85  ritr = rlist.begin();
86 
87  while (litr != llist.end())
88  {
89  if (*litr < *ritr)
90  return true;
91  else if (*litr > *ritr)
92  return false;
93  else
94  {
95  litr++;
96  ritr++;
97  }
98  }
99  }
100  } // if (lXmitTime == rXmitTime)
101 
102  return false;
103  }
104  };
105 
108  public std::binary_function<gnsstk::RinexNavData,
109  gnsstk::RinexNavData, bool>
110  {
111  public:
113  const gnsstk::RinexNavData& r) const
114  {
115  // compare the times and all data members
116  if (l.time != r.time)
117  return false;
118  else // if (l.time == r.time)
119  {
120  std::list<double>
121  llist = l.toList(),
122  rlist = r.toList();
123 
124  std::list<double>::iterator
125  litr = llist.begin(),
126  ritr = rlist.begin();
127 
128  while (litr != llist.end())
129  {
130  if (*litr != *ritr)
131  return false;
132  litr++;
133  ritr++;
134  }
135  }
136 
137  return true;
138  }
139  };
140 
143  public std::binary_function<gnsstk::RinexNavData,
144  gnsstk::RinexNavData, bool>
145  {
146  public:
148  const gnsstk::RinexNavData& r) const
149  {
150  if (l.getXmitTime() < r.getXmitTime())
151  return true;
152  return false;
153  }
154  };
155 
163  public std::unary_function<gnsstk::RinexNavHeader, bool>
164  {
165  public:
167  : firstHeader(true)
168  {}
169 
171  {
172  if (firstHeader)
173  {
174  theHeader = l;
175  firstHeader = false;
176  }
177  else
178  {
179  std::set<std::string> commentSet;
180 
181  // insert the comments to the set
182  // and let the set take care of uniqueness
183  copy(theHeader.commentList.begin(),
184  theHeader.commentList.end(),
185  inserter(commentSet, commentSet.begin()));
186  copy(l.commentList.begin(),
187  l.commentList.end(),
188  inserter(commentSet, commentSet.begin()));
189  // then copy the comments back into theHeader
190  theHeader.commentList.clear();
191  copy(commentSet.begin(), commentSet.end(),
192  inserter(theHeader.commentList,
193  theHeader.commentList.begin()));
194  }
195  return true;
196  }
197 
200  };
201 
204  public std::unary_function<gnsstk::RinexNavData, bool>
205  {
206  public:
207  RinexNavDataFilterPRN(const std::list<long>& lst )
208  :prnList(lst)
209  {}
211  bool operator()(const gnsstk::RinexNavData& l) const
212  {
213  long testValue = (long) l.PRNID;
214  return find(prnList.begin(), prnList.end(), testValue )
215  == prnList.end();
216  }
217  private:
218  std::list<long> prnList;
219  };
220 
222 
223 }
224 
225 
226 #endif
gnsstk::RinexNavDataOperatorLessThanSimple
Only compares time. Suitable for sorting a RinexNav file.
Definition: RinexNavFilterOperators.hpp:142
gnsstk::RinexNavDataOperatorLessThanFull
This compares all elements of the RinexNavData with less than.
Definition: RinexNavFilterOperators.hpp:62
gnsstk::RinexNavData::toList
std::list< double > toList() const
Definition: RinexNavData.cpp:187
gnsstk::RinexNavHeaderTouchHeaderMerge
Definition: RinexNavFilterOperators.hpp:162
gnsstk::RinexNavDataOperatorEqualsFull::operator()
bool operator()(const gnsstk::RinexNavData &l, const gnsstk::RinexNavData &r) const
Definition: RinexNavFilterOperators.hpp:112
gnsstk::RinexNavDataFilterPRN
Filter based on PRN ID.
Definition: RinexNavFilterOperators.hpp:203
RinexNavHeader.hpp
FileFilter.hpp
gnsstk
For Sinex::InputHistory.
Definition: BasicFramework.cpp:50
gnsstk::RinexNavData
Definition: RinexNavData.hpp:67
gnsstk::RinexNavHeaderTouchHeaderMerge::RinexNavHeaderTouchHeaderMerge
RinexNavHeaderTouchHeaderMerge()
Definition: RinexNavFilterOperators.hpp:166
gnsstk::RinexNavDataFilterPRN::RinexNavDataFilterPRN
RinexNavDataFilterPRN(const std::list< long > &lst)
Definition: RinexNavFilterOperators.hpp:207
gnsstk::RinexNavHeader::commentList
std::vector< std::string > commentList
Definition: RinexNavHeader.hpp:110
gnsstk::RinexNavData::time
CommonTime time
Clock reference time (toc).
Definition: RinexNavData.hpp:198
gnsstk::RinexNavDataOperatorEqualsFull
This compares all elements of the RinexNavData with equals.
Definition: RinexNavFilterOperators.hpp:107
gnsstk::RinexNavDataFilterPRN::operator()
bool operator()(const gnsstk::RinexNavData &l) const
This should return true when the data are to be erased.
Definition: RinexNavFilterOperators.hpp:211
gnsstk::RinexNavData::PRNID
short PRNID
SV PRN ID.
Definition: RinexNavData.hpp:199
gnsstk::RinexNavData::getXmitTime
CommonTime getXmitTime() const
Definition: RinexNavData.hpp:141
gnsstk::RinexNavHeader
Definition: RinexNavHeader.hpp:63
gnsstk::RinexNavDataFilterPRN::prnList
std::list< long > prnList
Definition: RinexNavFilterOperators.hpp:218
gnsstk::RinexNavHeaderTouchHeaderMerge::operator()
bool operator()(const gnsstk::RinexNavHeader &l)
Definition: RinexNavFilterOperators.hpp:170
GPSWeekSecond.hpp
gnsstk::RinexNavDataOperatorLessThanFull::operator()
bool operator()(const gnsstk::RinexNavData &l, const gnsstk::RinexNavData &r) const
Definition: RinexNavFilterOperators.hpp:67
gnsstk::RinexNavDataOperatorLessThanSimple::operator()
bool operator()(const gnsstk::RinexNavData &l, const gnsstk::RinexNavData &r) const
Definition: RinexNavFilterOperators.hpp:147
gnsstk::RinexNavHeaderTouchHeaderMerge::firstHeader
bool firstHeader
Definition: RinexNavFilterOperators.hpp:198
gnsstk::RinexNavHeaderTouchHeaderMerge::theHeader
gnsstk::RinexNavHeader theHeader
Definition: RinexNavFilterOperators.hpp:199
RinexNavData.hpp


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