core
lib
NewNav
NDFUniqIterator.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
//
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
#ifndef GNSSTK_NDFUNIQUEITERATOR_HPP
40
#define GNSSTK_NDFUNIQUEITERATOR_HPP
41
42
#include <type_traits>
43
44
namespace
gnsstk
45
{
59
template
<
typename
T>
60
class
NDFUniqIterator
61
{
62
public
:
63
NDFUniqIterator
()
64
:
map
(nullptr)
65
{}
66
NDFUniqIterator
(T& omap)
67
:
nuit
(omap.
begin
()),
map
(&omap)
68
{}
69
NDFUniqIterator
(T& omap,
typename
T::iterator i)
70
:
nuit
(i),
map
(&omap)
71
{}
72
NDFUniqIterator
(std::shared_ptr<T> omap)
73
:
nuit
(omap->
begin
()),
map
(omap.get())
74
{}
75
NDFUniqIterator
(std::shared_ptr<T> omap,
typename
T::iterator i)
76
:
nuit
(i),
map
(omap.get())
77
{}
78
NDFUniqIterator
&
operator++
()
79
{
80
81
nuit
++;
82
NavDataFactory
*ndfp =
dynamic_cast<
NavDataFactory
*
>
(
83
nuit
->second.get());
84
while
((
nuit
!=
map
->end()) && (
uniques
.count(ndfp) > 0))
85
{
86
nuit
++;
87
if
(
nuit
!=
map
->end())
88
{
89
ndfp =
dynamic_cast<
NavDataFactory
*
>
(
nuit
->second.get());
90
}
91
}
92
return
*
this
;
93
}
94
typename
T::value_type&
operator*
()
95
{
96
if
(
nuit
!=
map
->end())
97
{
98
NavDataFactory
*ndfp =
dynamic_cast<
NavDataFactory
*
>
(
99
nuit
->second.get());
100
uniques
.insert(ndfp);
101
}
102
return
*
nuit
;
103
}
104
NDFUniqIterator
begin
()
105
{
return
NDFUniqIterator
(*
map
); }
106
NDFUniqIterator
end
()
107
{
return
NDFUniqIterator
(*
map
,
map
->end()); }
108
bool
operator!=
(
const
NDFUniqIterator
& i)
109
{
return
((
map
!= i.
map
) || (
nuit
!= i.
nuit
)); }
110
private
:
112
typename
T::iterator
nuit
;
114
std::set<typename T::mapped_type::element_type*>
uniques
;
116
T*
map
;
117
};
118
}
119
120
#endif // GNSSTK_NDFUNIQUEITERATOR_HPP
gnsstk::NDFUniqIterator::operator++
NDFUniqIterator & operator++()
Definition:
NDFUniqIterator.hpp:78
gnsstk
For Sinex::InputHistory.
Definition:
BasicFramework.cpp:50
gnsstk::NDFUniqIterator::NDFUniqIterator
NDFUniqIterator(T &omap)
Definition:
NDFUniqIterator.hpp:66
gnsstk::NDFUniqIterator::nuit
T::iterator nuit
non-unique iterator.
Definition:
NDFUniqIterator.hpp:112
gnsstk::NDFUniqIterator::map
T * map
Original map.
Definition:
NDFUniqIterator.hpp:116
gnsstk::NDFUniqIterator::NDFUniqIterator
NDFUniqIterator(std::shared_ptr< T > omap, typename T::iterator i)
Definition:
NDFUniqIterator.hpp:75
gnsstk::NDFUniqIterator::operator!=
bool operator!=(const NDFUniqIterator &i)
Definition:
NDFUniqIterator.hpp:108
gnsstk::NDFUniqIterator::end
NDFUniqIterator end()
Definition:
NDFUniqIterator.hpp:106
gnsstk::NDFUniqIterator::NDFUniqIterator
NDFUniqIterator(T &omap, typename T::iterator i)
Definition:
NDFUniqIterator.hpp:69
gnsstk::NDFUniqIterator::uniques
std::set< typename T::mapped_type::element_type * > uniques
Pointers already encountered. This assumes a map to a shared_ptr.
Definition:
NDFUniqIterator.hpp:114
gnsstk::NDFUniqIterator::begin
NDFUniqIterator begin()
Definition:
NDFUniqIterator.hpp:104
gnsstk::NavDataFactory
Definition:
NavDataFactory.hpp:60
gnsstk::NDFUniqIterator
Definition:
NDFUniqIterator.hpp:60
gnsstk::NDFUniqIterator::NDFUniqIterator
NDFUniqIterator(std::shared_ptr< T > omap)
Definition:
NDFUniqIterator.hpp:72
gnsstk::NDFUniqIterator::NDFUniqIterator
NDFUniqIterator()
Definition:
NDFUniqIterator.hpp:63
gnsstk::NDFUniqIterator::operator*
T::value_type & operator*()
Definition:
NDFUniqIterator.hpp:94
gnsstk
Author(s):
autogenerated on Wed Oct 25 2023 02:40:40