RinexMetFilterOperators.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_RINEXMETFILTEROPERATORS_HPP
45 #define GNSSTK_RINEXMETFILTEROPERATORS_HPP
46 
47 #include <set>
48 
49 #include "CivilTime.hpp"
50 #include "FileFilter.hpp"
51 #include "RinexMetData.hpp"
52 #include "RinexMetHeader.hpp"
53 
54 namespace gnsstk
55 {
57 
58 
59  typedef std::unary_function<RinexMetHeader, bool> RinexMetDataUnaryOperator;
60  typedef std::binary_function<RinexMetData, RinexMetData, bool> RinexMetDataBinaryOperator;
61 
65  {
66  public:
67 
72  (const std::set<RinexMetHeader::RinexMetType>& rmhset)
73  : obsSet(rmhset)
74  {}
75 
76  bool operator()(const RinexMetData& l, const RinexMetData& r) const
77  {
78  // Compare the times, offsets, then only those elements
79  // common to both. This ignores the flags set to 0.
80 
81  if (l.time < r.time)
82  return true;
83  else if (l.time != r.time)
84  return false;
85 
86  // Then check that each observation has the same data
87  // for each item in the set of common observations.
88 
89  RinexMetData::RinexMetMap::const_iterator
90  lItr, rItr;
91  std::set<RinexMetHeader::RinexMetType>::const_iterator
92  obsItr = obsSet.begin();
93 
94  while (obsItr != obsSet.end())
95  {
96  rItr = r.data.find(*obsItr);
97  if (rItr == r.data.end())
98  return false;
99 
100  lItr = l.data.find(*obsItr);
101  if (lItr == l.data.end())
102  return false;
103 
104  if ((*lItr).second < (*rItr).second)
105  return true;
106  if ((*lItr).second > (*rItr).second)
107  return false;
108 
109  obsItr++;
110  }
111 
112  // the data is either == or > at this point
113  return false;
114  }
115 
116  private:
117  std::set<RinexMetHeader::RinexMetType> obsSet;
118  };
119 
122  {
123  public:
124 
125  bool operator()(const RinexMetData& l, const RinexMetData& r) const
126  {
127  if (l.time < r.time)
128  return true;
129  return false;
130  }
131  };
132 
135  {
136  public:
137 
138  bool operator()(const RinexMetData& l, const RinexMetData& r) const
139  {
140  if (l.time == r.time)
141  return true;
142  return false;
143  }
144  };
145 
153  {
154  public:
155 
157  : firstHeader(true)
158  {}
159 
160  bool operator()(const RinexMetHeader& l)
161  {
162  if (firstHeader)
163  {
164  theHeader = l;
165  firstHeader = false;
166  }
167  else
168  {
169  std::set<RinexMetHeader::RinexMetType> thisMetSet,
170  tempMetSet;
171  std::set<std::string> commentSet;
172  obsSet.clear();
173 
174  // insert the comments to the set and let the set take care of uniqueness
175  copy(theHeader.commentList.begin(),
176  theHeader.commentList.end(),
177  inserter(commentSet, commentSet.begin()));
178  copy(l.commentList.begin(),
179  l.commentList.end(),
180  inserter(commentSet, commentSet.begin()));
181  // then copy the comments back into theHeader
182  theHeader.commentList.clear();
183  copy(commentSet.begin(), commentSet.end(),
184  inserter(theHeader.commentList,
185  theHeader.commentList.begin()));
186 
187  // find the set intersection of the obs types
188  copy(theHeader.obsTypeList.begin(),
189  theHeader.obsTypeList.end(),
190  inserter(thisMetSet, thisMetSet.begin()));
191  copy(l.obsTypeList.begin(),
192  l.obsTypeList.end(),
193  inserter(tempMetSet, tempMetSet.begin()));
194  set_intersection(thisMetSet.begin(), thisMetSet.end(),
195  tempMetSet.begin(), tempMetSet.end(),
196  inserter(obsSet, obsSet.begin()));
197  // then copy the obsTypes back into theHeader
198  theHeader.obsTypeList.clear();
199  copy(obsSet.begin(), obsSet.end(),
200  inserter(theHeader.obsTypeList,
201  theHeader.obsTypeList.begin()));
202  }
203  return true;
204  }
205 
208  std::set<RinexMetHeader::RinexMetType> obsSet;
209  };
210 
213  {
214 
215  public:
216 
218  const CommonTime& endTime )
219  : start(startTime), end(endTime)
220  {}
221 
222  bool operator() (const RinexMetData& l) const
223  {
224  if ( l.time < start || l.time >= end )
225  return true;
226  return false;
227  }
228 
229  private:
230 
232 
233  };
234 
236 
237 } // namespace gnsstk
238 
239 #endif
gnsstk::RinexMetData
Definition: RinexMetData.hpp:71
gnsstk::RinexMetDataOperatorLessThanSimple
Compares only times.
Definition: RinexMetFilterOperators.hpp:121
gnsstk::RinexMetHeader::commentList
std::vector< std::string > commentList
A list of comments.
Definition: RinexMetHeader.hpp:203
gnsstk::RinexMetDataOperatorLessThanSimple::operator()
bool operator()(const RinexMetData &l, const RinexMetData &r) const
Definition: RinexMetFilterOperators.hpp:125
gnsstk::RinexMetHeaderTouchHeaderMerge::firstHeader
bool firstHeader
Definition: RinexMetFilterOperators.hpp:206
gnsstk::RinexMetDataOperatorLessThanFull::operator()
bool operator()(const RinexMetData &l, const RinexMetData &r) const
Definition: RinexMetFilterOperators.hpp:76
gnsstk::RinexMetHeaderTouchHeaderMerge
Definition: RinexMetFilterOperators.hpp:152
gnsstk::RinexMetDataBinaryOperator
std::binary_function< RinexMetData, RinexMetData, bool > RinexMetDataBinaryOperator
Definition: RinexMetFilterOperators.hpp:60
gnsstk::RinexMetDataOperatorLessThanFull
Definition: RinexMetFilterOperators.hpp:64
gnsstk::RinexMetDataOperatorLessThanFull::obsSet
std::set< RinexMetHeader::RinexMetType > obsSet
Definition: RinexMetFilterOperators.hpp:117
FileFilter.hpp
gnsstk::RinexMetHeaderTouchHeaderMerge::obsSet
std::set< RinexMetHeader::RinexMetType > obsSet
Definition: RinexMetFilterOperators.hpp:208
gnsstk
For Sinex::InputHistory.
Definition: BasicFramework.cpp:50
gnsstk::RinexMetDataFilterTime
This filter will return true for any data not within the specified time range.
Definition: RinexMetFilterOperators.hpp:212
gnsstk::RinexMetData::time
CommonTime time
The time this data was recorded, in GPS time system.
Definition: RinexMetData.hpp:103
gnsstk::RinexMetHeaderTouchHeaderMerge::theHeader
RinexMetHeader theHeader
Definition: RinexMetFilterOperators.hpp:207
gnsstk::CommonTime
Definition: CommonTime.hpp:84
gnsstk::RinexMetHeaderTouchHeaderMerge::operator()
bool operator()(const RinexMetHeader &l)
Definition: RinexMetFilterOperators.hpp:160
gnsstk::RinexMetDataOperatorLessThanFull::RinexMetDataOperatorLessThanFull
RinexMetDataOperatorLessThanFull(const std::set< RinexMetHeader::RinexMetType > &rmhset)
Definition: RinexMetFilterOperators.hpp:72
CivilTime.hpp
gnsstk::RinexMetDataFilterTime::operator()
bool operator()(const RinexMetData &l) const
Definition: RinexMetFilterOperators.hpp:222
gnsstk::RinexMetHeaderTouchHeaderMerge::RinexMetHeaderTouchHeaderMerge
RinexMetHeaderTouchHeaderMerge()
Definition: RinexMetFilterOperators.hpp:156
gnsstk::RinexMetDataUnaryOperator
std::unary_function< RinexMetHeader, bool > RinexMetDataUnaryOperator
Definition: RinexMetFilterOperators.hpp:59
RinexMetHeader.hpp
gnsstk::RinexMetDataOperatorEqualsSimple::operator()
bool operator()(const RinexMetData &l, const RinexMetData &r) const
Definition: RinexMetFilterOperators.hpp:138
gnsstk::RinexMetDataFilterTime::RinexMetDataFilterTime
RinexMetDataFilterTime(const CommonTime &startTime, const CommonTime &endTime)
Definition: RinexMetFilterOperators.hpp:217
RinexMetData.hpp
gnsstk::RinexMetHeader::obsTypeList
std::vector< RinexMetType > obsTypeList
Definition: RinexMetHeader.hpp:213
gnsstk::RinexMetDataFilterTime::end
CommonTime end
Definition: RinexMetFilterOperators.hpp:231
gnsstk::RinexMetData::data
RinexMetMap data
The data itself in map form.
Definition: RinexMetData.hpp:104
gnsstk::RinexMetDataFilterTime::start
CommonTime start
Definition: RinexMetFilterOperators.hpp:231
gnsstk::RinexMetDataOperatorEqualsSimple
Compares only times.
Definition: RinexMetFilterOperators.hpp:134
gnsstk::RinexMetHeader
Definition: RinexMetHeader.hpp:70


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