48 template <
typename CONT_T,
typename TRAIT,
bool CONST_T = true >
56 using pointer =
typename std::conditional<CONST_T, typename CONT_T::value_type const*, typename CONT_T::value_type*>::type;
57 using reference =
typename std::conditional<CONST_T, typename CONT_T::value_type const&, typename CONT_T::value_type&>::type;
59 using CONT_IT =
typename std::conditional<CONST_T, typename CONT_T::const_iterator, typename CONT_T::iterator>::type;
116 if (
this == &rhs)
return true;
132 return !(*
this == rhs);
136 template<
bool _CONST = CONST_T >
137 typename std::enable_if< _CONST, reference >::type
operator*()
const
141 template<
bool _CONST = CONST_T >
142 typename std::enable_if< !_CONST, reference >::type
operator*()
148 template<
bool _CONST = CONST_T >
149 typename std::enable_if< _CONST, pointer >::type
operator->()
const
153 template<
bool _CONST = CONST_T >
154 typename std::enable_if< !_CONST, pointer >::type
operator->()
229 double max_dist = TRAIT::allowedTol(
tol_, *
it_ref_);
251 if (
float(diff) <= max_dist)
return;
271 template <
typename T>
277 template <
typename T>
280 return fabs(elem_ref - elem_tgt);
288 template <
typename T>
294 template <
typename T>
297 return fabs(elem_ref.getMZ() - elem_tgt.getMZ());
305 template <
typename T>
311 template <
typename T>
314 return fabs(elem_ref.getMZ() - elem_tgt.getMZ());
For each element in the reference container the closest peak in the target will be searched....
Definition MatchedIterator.h:50
CONT_IT it_ref_
Definition MatchedIterator.h:263
MatchedIterator & operator=(const MatchedIterator &rhs)=default
Assignment operator (default)
bool operator!=(const MatchedIterator &rhs) const
Definition MatchedIterator.h:130
MatchedIterator & operator++()
Advances to the next valid pair.
Definition MatchedIterator.h:182
CONST_CONT_IT ref_end_
Definition MatchedIterator.h:261
MatchedIterator(const MatchedIterator &rhs)=default
Copy CTor (default)
CONST_CONT_IT tgt_end_
Definition MatchedIterator.h:262
typename std::conditional< CONST_T, typename CONT_T::value_type const &, typename CONT_T::value_type & >::type reference
Definition MatchedIterator.h:57
CONT_IT it_tgt_
Definition MatchedIterator.h:263
MatchedIterator(const CONST_CONT_IT ref_begin, const CONST_CONT_IT ref_end, const CONST_CONT_IT tgt_begin, const CONST_CONT_IT tgt_end, float tolerance)
Constructs a MatchedIterator on two containers. The way a match is found, depends on the TRAIT type (...
Definition MatchedIterator.h:87
MatchedIterator(bool)
Definition MatchedIterator.h:209
size_t refIdx() const
index into reference container
Definition MatchedIterator.h:166
bool isEnd_() const
Definition MatchedIterator.h:219
MatchedIterator(const CONT_T &ref, const CONT_T &target, float tolerance)
Constructs a MatchedIterator on two containers. The way a match is found, depends on the TRAIT type (...
Definition MatchedIterator.h:71
std::forward_iterator_tag iterator_category
Definition MatchedIterator.h:53
typename CONT_T::const_iterator CONST_CONT_IT
Definition MatchedIterator.h:60
void advanceTarget_()
Definition MatchedIterator.h:224
bool operator==(const MatchedIterator &rhs) const
Definition MatchedIterator.h:114
size_t tgtIdx() const
index into target container
Definition MatchedIterator.h:172
MatchedIterator operator++(int)
post-increment
Definition MatchedIterator.h:192
bool is_end_
Definition MatchedIterator.h:265
typename CONT_T::value_type value_type
Definition MatchedIterator.h:54
const value_type & ref() const
current element in reference container
Definition MatchedIterator.h:160
std::enable_if<!_CONST, reference >::type operator*()
Definition MatchedIterator.h:142
std::enable_if< _CONST, reference >::type operator*() const
dereference current target element
Definition MatchedIterator.h:137
typename std::conditional< CONST_T, typename CONT_T::value_type const *, typename CONT_T::value_type * >::type pointer
Definition MatchedIterator.h:56
std::enable_if<!_CONST, pointer >::type operator->()
Definition MatchedIterator.h:154
static MatchedIterator end()
the end iterator
Definition MatchedIterator.h:200
CONST_CONT_IT tgt_begin_
Definition MatchedIterator.h:262
std::enable_if< _CONST, pointer >::type operator->() const
pointer to current target element
Definition MatchedIterator.h:149
std::ptrdiff_t difference_type
Definition MatchedIterator.h:55
MatchedIterator()
Default CTor; do not use this for anything other than assigning to it;.
Definition MatchedIterator.h:103
CONST_CONT_IT ref_begin_
Definition MatchedIterator.h:261
void setToEnd_()
Definition MatchedIterator.h:214
float tol_
Definition MatchedIterator.h:264
typename std::conditional< CONST_T, typename CONT_T::const_iterator, typename CONT_T::iterator >::type CONT_IT
Definition MatchedIterator.h:59
#define OPENMS_PRECONDITION(condition, message)
Precondition macro.
Definition openms/include/OpenMS/CONCEPT/Macros.h:91
T ppmToMass(T ppm, T mz_ref)
Compute the mass diff in [Th], given a ppm value and a reference point.
Definition MathFunctions.h:405
Main OpenMS namespace.
Definition openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/ISpectrumAccess.h:19
Definition MatchedIterator.h:304
static float getDiffAbsolute(const T &elem_ref, const T &elem_tgt)
for Peak1D & Co
Definition MatchedIterator.h:312
static float allowedTol(float tol, const T &)
Definition MatchedIterator.h:306
Definition MatchedIterator.h:287
static float getDiffAbsolute(const T &elem_ref, const T &elem_tgt)
for Peak1D & Co
Definition MatchedIterator.h:295
static float allowedTol(float tol, const T &elem_ref)
Definition MatchedIterator.h:289
Trait for MatchedIterator to find pairs with a certain distance, which is computed directly on the va...
Definition MatchedIterator.h:270
static T getDiffAbsolute(const T &elem_ref, const T &elem_tgt)
just use fabs on the value directly
Definition MatchedIterator.h:278
static float allowedTol(float tol, const T &)
Definition MatchedIterator.h:272