NavFilterMgr.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 // 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 
39 #include "NavFilterMgr.hpp"
40 
41 namespace gnsstk
42 {
45  {
46  }
47 
48 
49  void NavFilterMgr ::
51  {
52  filters.push_back(filt);
53  }
54 
55 
58  {
59  NavFilter::NavMsgList rv, newrv;
60  rv.push_back(msgBits);
61  rejected.clear();
62  for (FilterList::iterator i = filters.begin(); i != filters.end(); i++)
63  {
64  if (rv.empty())
65  break;
66  (*i)->rejected.clear();
67  newrv.clear();
68  (*i)->validate(rv, newrv);
69  if (!(*i)->rejected.empty())
70  rejected.insert(*i);
71  rv = newrv;
72  }
73  return rv;
74  }
75 
76 
79  {
80  // final and intermediate return values
81  NavFilter::NavMsgList rv, rv1, rv2;
82  // current and next filter
83  FilterList::iterator fliCur, fliNxt;
84  rejected.clear();
85  // touch ALL filters
86  for (fliCur = filters.begin(); fliCur != filters.end(); fliCur++)
87  {
88  // finalize the data in the current filter
89  (*fliCur)->rejected.clear();
90  rv2.clear();
91  (*fliCur)->finalize(rv2);
92 
93  // If the filter returned some data, we need to push it
94  // into the next filter using validate.
95  if (!rv2.empty())
96  {
97  fliNxt = fliCur;
98  fliNxt++;
99  // cascade the data through the end.
100  rv1 = rv2;
101  while ((fliNxt != filters.end()) && !rv1.empty())
102  {
103  (*fliNxt)->rejected.clear();
104  rv2.clear();
105  (*fliNxt)->validate(rv1, rv2);
106  rv1 = rv2;
107  fliNxt++;
108  }
109  // If the filter cascade got some data that passed all
110  // filters, add it to the final return value.
111  if (!rv1.empty())
112  {
113  std::copy(rv1.begin(), rv1.end(),
114  std::back_insert_iterator<NavFilter::NavMsgList>(rv));
115  }
116  }
117  }
118  return rv;
119  }
120 
121 
122  unsigned NavFilterMgr ::
124  const noexcept
125  {
126  FilterList::const_iterator fli;
127  unsigned rv = 1;
128  for (fli = filters.begin(); fli != filters.end(); fli++)
129  {
130  rv += (*fli)->processingDepth();
131  }
132  return rv;
133  }
134 }
gnsstk::NavFilterMgr::rejected
FilterSet rejected
Definition: NavFilterMgr.hpp:233
const
#define const
Definition: getopt.c:43
gnsstk::NavFilterMgr::finalize
virtual NavFilter::NavMsgList finalize()
Definition: NavFilterMgr.cpp:78
gnsstk::NavFilterMgr::NavFilterMgr
NavFilterMgr()
Do-nothing default constructor.
Definition: NavFilterMgr.cpp:44
gnsstk::NavFilterMgr::processingDepth
unsigned processingDepth() const noexcept
Definition: NavFilterMgr.cpp:123
gnsstk
For Sinex::InputHistory.
Definition: BasicFramework.cpp:50
gnsstk::NavFilterMgr::addFilter
void addFilter(NavFilter *filt)
Definition: NavFilterMgr.cpp:50
gnsstk::NavFilterMgr::filters
FilterList filters
The collection of navigation message filters to apply.
Definition: NavFilterMgr.hpp:237
NavFilterMgr.hpp
gnsstk::NavFilter
Definition: NavFilter.hpp:55
gnsstk::NavFilterMgr::validate
NavFilter::NavMsgList validate(NavFilterKey *msgBits)
Definition: NavFilterMgr.cpp:57
gnsstk::NavFilter::NavMsgList
std::list< NavFilterKey * > NavMsgList
Definition: NavFilter.hpp:58
gnsstk::NavFilterKey
Definition: NavFilterKey.hpp:66


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