navfilterex-pseudo-container.cpp

Pseudo-code example of using a container of application data structures for storing the navigation messages processed by the filter.

//==============================================================================
//
// This file is part of GNSSTk, the ARL:UT GNSS Toolkit.
//
// The GNSSTk is free software; you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published
// by the Free Software Foundation; either version 3.0 of the License, or
// any later version.
//
// The GNSSTk is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with GNSSTk; if not, write to the Free Software Foundation,
// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
//
// This software was developed by Applied Research Laboratories at the
// University of Texas at Austin.
// Copyright 2004-2022, The Board of Regents of The University of Texas System
//
//==============================================================================
//==============================================================================
//
// This software was developed by Applied Research Laboratories at the
// University of Texas at Austin, under contract to an agency or agencies
// within the U.S. Department of Defense. The U.S. Government retains all
// rights to use, duplicate, distribute, disclose, or release this software.
//
// Pursuant to DoD Directive 523024
//
// DISTRIBUTION STATEMENT A: This software has been approved for public
// release, distribution is unlimited.
//
//==============================================================================
{
public:
std::vector<uint32_t> subframe;
};
typedef std::list<NavSubframe*> NavSubframeList;
{
while (sameEpoch)
{
nsf = new NavSubframe();
strm >> *nsf;
if (strm)
nsl.push_back(nsf);
}
}
void filterEX()
{
// Filter manager, where the work is done
// Individual filters being applied
// Data being passed to the filter
gnsstk::NavFilter::NavMsgList::const_iterator nmli;
// application's nav storage
NavSubframeList::iterator nsli;
// Tell the manager what filters to use
mgr.addFilter(&filtCook);
mgr.addFilter(&filtParity);
while (strm)
{
// process each subframe read from the input stream
for (nsli = nsl.begin(); nsli != nsl.end(); nsli++)
{
NavSubframe *nsf = *nsli;
// Point the filter data to the LNAV message
navFiltData.sf = &nsf->subframe[1];
// validate the subframe
gnsstk::NavFilter::NavMsgList l = mgr.validate(&navFiltData);
// process the results
for (nmli = l.begin(); nmli != l.end(); nmli++)
{
dynamic_cast<gnsstk::LNavFilterData*>(*nmli);
// do something with fd (nav message that passed the filters)
}
// Because the filters are depth 1, we can immediately
// free the application data storage. We set the value in
// the list to NULL as "good practice". Erase the list at
// the end so that we don't end up doing any weird
// unnecessary memory management internal to the list
// implementation.
delete nsf;
*nsli = NULL;
}
nsl.clear();
}
// Finalize the filters. Probably not necessary when using only
// depth 1 filters, but good practice in any case.
// process the results
for (nmli = l.begin(); nmli != l.end(); nmli++)
{
dynamic_cast<gnsstk::LNavFilterData*>(*nmli);
// do something with fd (nav message that passed the filters)
}
}
NavSubframe::subframe
std::vector< uint32_t > subframe
Definition: navfilterex-pseudo-container.cpp:49
filterEX
void filterEX()
Definition: navfilterex-pseudo-container.cpp:68
gnsstk::LNavParityFilter
Definition: LNavParityFilter.hpp:53
gnsstk::LNavCookFilter
Definition: LNavCookFilter.hpp:54
gnsstk::NavFilterMgr::finalize
virtual NavFilter::NavMsgList finalize()
Definition: NavFilterMgr.cpp:78
NULL
#define NULL
Definition: getopt1.c:64
gnsstk::NavFilterMgr
Definition: NavFilterMgr.hpp:170
gnsstk::NavFilterMgr::addFilter
void addFilter(NavFilter *filt)
Definition: NavFilterMgr.cpp:50
readNavEpoch
void readNavEpoch(NavSubframeList &nsl)
function to store a single epoch's worth of NavSubframe data
Definition: navfilterex-pseudo-container.cpp:56
NavSubframe
application's navigation message storage class
Definition: navfilterex-pseudo-container.cpp:44
gnsstk::NavFilterMgr::validate
NavFilter::NavMsgList validate(NavFilterKey *msgBits)
Definition: NavFilterMgr.cpp:57
NavSubframeList
std::list< NavSubframe * > NavSubframeList
use pointers because performance
Definition: navfilterex-pseudo-container.cpp:53
gnsstk::LNavFilterData
Definition: LNavFilterData.hpp:52
gnsstk::NavFilter::NavMsgList
std::list< NavFilterKey * > NavMsgList
Definition: NavFilter.hpp:58
gnsstk::LNavFilterData::sf
uint32_t * sf
Definition: LNavFilterData.hpp:68


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