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"
42 using 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();
94 struct MZRTField :
public std::set< boost::shared_ptr<T>, LessThan_MZRT<T> >
98 typedef boost::shared_ptr<T>
TPtr;
102 template <
typename RTMatches>
104 find(
double mz, MZTolerance mzTolerance, RTMatches matches)
const;
107 void remove(
const TPtr& p);
120 template <
typename T>
129 template <
typename T>
147 template <
typename T>
165 template <
typename T>
166 template <
typename RTMatches>
167 std::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);
192 template <
typename T>
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.");
211 #endif // _MZRTFIELD_HPP_