24#ifndef _MZRTFIELD_HPP_
25#define _MZRTFIELD_HPP_
31#include "boost/shared_ptr.hpp"
32#include "boost/concept/assert.hpp"
33#include "boost/concept/usage.hpp"
42using chemistry::MZTolerance;
53 typedef boost::shared_ptr<T> TPtr;
55 bool operator()(
const T& a,
const T& b)
const
57 if (a.mz < b.mz)
return true;
58 if (b.mz < a.mz)
return false;
59 return (a.retentionTime < b.retentionTime);
62 bool operator()(
const TPtr& a,
const TPtr& b)
const
64 return (*
this)(*a, *b);
75 BOOST_CONCEPT_USAGE(HasMZRT)
81 a = c.retentionTimeMin();
82 a = c.retentionTimeMax();
94struct MZRTField :
public std::set< boost::shared_ptr<T>, LessThan_MZRT<T> >
98 typedef boost::shared_ptr<T>
TPtr;
102 template <
typename RTMatches>
166template <
typename RTMatches>
167std::vector< boost::shared_ptr<T> >
174 target->mz = mz - mzTolerance;
177 target->mz = mz + mzTolerance;
182 std::vector<TPtr> result;
186 result.push_back(*it);
196 range = this->equal_range(p);
199 found = std::find(range.first, range.second, p);
201 if (found == range.second)
throw std::runtime_error(
"[MZRTField::remove()] TPtr not found.");
MZRTField< pwiz::data::peakdata::Feature > FeatureField
PWIZ_API_DECL std::ostream & operator<<(std::ostream &os, PepxmlRecordReader &prr)
MZRTField< pwiz::data::peakdata::Peakel > PeakelField
MZRTField is a std::set of boost::shared_ptrs, stored as a binary tree ordered by LessThan_MZRT.
std::vector< TPtr > find(double mz, MZTolerance mzTolerance, RTMatches matches) const
find all objects with a given m/z, within a given m/z tolerance, satisfying the 'matches' predicate
void remove(const TPtr &p)
remove an object via a shared reference, rather than an iterator into the set
boost::shared_ptr< T > TPtr
predicate always returns true
bool operator()(const T &t) const
predicate returns true iff the object's retention time range contains the specified retention time
RTMatches_Contains(double rt, double rtTolerance=0)
bool operator()(const T &t) const
predicate returns true iff the object's retention time range is completely contained within the range...
RTMatches_IsContainedIn(const T &reference, double rtTolerance=0)
bool operator()(const T &t) const
struct for expressing m/z tolerance in either amu or ppm