ProteoWizard
Public Types | Public Member Functions
pwiz::analysis::MZRTField< T > Struct Template Reference

MZRTField is a std::set of boost::shared_ptrs, stored as a binary tree ordered by LessThan_MZRT. More...

#include <MZRTField.hpp>

Inherits std::set< K >.

List of all members.

Public Types

typedef boost::shared_ptr< T > TPtr

Public Member Functions

template<typename RTMatches >
std::vector< TPtrfind (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

Additional Inherited Members

- Public Attributes inherited from std::set< K >
K keys
 STL member.

Detailed Description

template<typename T>
struct pwiz::analysis::MZRTField< T >

MZRTField is a std::set of boost::shared_ptrs, stored as a binary tree ordered by LessThan_MZRT.

Definition at line 94 of file MZRTField.hpp.


Member Typedef Documentation

template<typename T>
typedef boost::shared_ptr<T> pwiz::analysis::MZRTField< T >::TPtr

Definition at line 98 of file MZRTField.hpp.


Member Function Documentation

template<typename T >
template<typename RTMatches >
std::vector< boost::shared_ptr< T > > pwiz::analysis::MZRTField< T >::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

Definition at line 168 of file MZRTField.hpp.

Referenced by testFeatureField(), testFind(), testPeakelField(), verifyBombesinFeatures(), and verifyBombesinPeakels().

{
TPtr target(new T);
// use binary search to get a std::set iterator range
target->mz = mz - mzTolerance;
typename MZRTField<T>::const_iterator begin = this->lower_bound(target);
target->mz = mz + mzTolerance;
typename MZRTField<T>::const_iterator end = this->upper_bound(target);
// linear copy_if within range
std::vector<TPtr> result;
for (typename MZRTField<T>::const_iterator it=begin; it!=end; ++it)
if (matches(**it))
result.push_back(*it);
return result;
}
template<typename T >
void pwiz::analysis::MZRTField< T >::remove ( const TPtr p)

remove an object via a shared reference, rather than an iterator into the set

Definition at line 193 of file MZRTField.hpp.

Referenced by testPeakelField().

{
std::pair<typename MZRTField<T>::iterator, typename MZRTField<T>::iterator>
range = this->equal_range(p); // uses LessThan_MZRT
typename MZRTField<T>::iterator
found = std::find(range.first, range.second, p); // uses shared_ptr::operator==
if (found == range.second) throw std::runtime_error("[MZRTField::remove()] TPtr not found.");
this->erase(found);
}

The documentation for this struct was generated from the following file: